Make sure BN_sqr can never return a negative value.
authorHuzaifa Sidhpurwala <huzaifas@redhat.com>
Thu, 26 Jun 2014 22:45:58 +0000 (23:45 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 26 Jun 2014 22:56:32 +0000 (23:56 +0100)
PR#3410
(cherry picked from commit e14e764c0d5d469da63d0819c6ffc0e1e9e7f0bb)

crypto/bn/bn_sqr.c

index 270d0cd348b90056f14ce429676b700cd577118b..65bbf165d0e2f3bc3de3d662c1c02800dbb33c70 100644 (file)
@@ -77,6 +77,7 @@ int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
        if (al <= 0)
                {
                r->top=0;
+               r->neg = 0;
                return 1;
                }