In the case where a < 0 and |a| < w, the result (assigned to a) from
[openssl.git] / 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;