bn: fix occurance of negative zero in BN_rshift1()
authorRichard Levitte <levitte@openssl.org>
Wed, 1 Feb 2017 01:29:46 +0000 (02:29 +0100)
committerRichard Levitte <levitte@openssl.org>
Wed, 1 Feb 2017 01:31:41 +0000 (02:31 +0100)
Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/bn/bn_shift.c

index b320602..6a1eec8 100644 (file)
@@ -74,6 +74,8 @@ int BN_rshift1(BIGNUM *r, const BIGNUM *a)
         c = (t & 1) ? BN_TBIT : 0;
     }
     r->top = j;
+    if (!r->top)
+        r->neg = 0; /* don't allow negative zero */
     bn_check_top(r);
     return (1);
 }