In the case where a < 0 and |a| < w, the result (assigned to a) from
authorRichard Levitte <levitte@openssl.org>
Thu, 27 Jul 2000 21:17:14 +0000 (21:17 +0000)
committerRichard Levitte <levitte@openssl.org>
Thu, 27 Jul 2000 21:17:14 +0000 (21:17 +0000)
BN_add_word becomes wrongly negative...
This was discovered by Darrel Hankerson <dhankers@cacr.math.uwaterloo.ca>

crypto/bn/bn_word.c

index 73157a7d43fda6711572abe34dd28a11b0855a42..7e7ca58842bb92dbd732924a05d247d7aa8f6682 100644 (file)
@@ -115,7 +115,7 @@ int BN_add_word(BIGNUM *a, BN_ULONG w)
                a->neg=0;
                i=BN_sub_word(a,w);
                if (!BN_is_zero(a))
-                       a->neg=1;
+                       a->neg=!(a->neg);
                return(i);
                }
        w&=BN_MASK2;