From: Nils Larsch Date: Sun, 17 Jul 2005 16:08:21 +0000 (+0000) Subject: bugfix: 0 - w (w != 0) is actually negative X-Git-Tag: OpenSSL_0_9_8a~79 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c6ab9aad940e8571745004cf3e4aff8b8a91ed6;p=openssl bugfix: 0 - w (w != 0) is actually negative --- diff --git a/crypto/bn/bn_word.c b/crypto/bn/bn_word.c index 1bcb37e292..bc5905fef4 100644 --- a/crypto/bn/bn_word.c +++ b/crypto/bn/bn_word.c @@ -175,7 +175,13 @@ int BN_sub_word(BIGNUM *a, BN_ULONG w) /* degenerate case: w is zero */ if (!w) return 1; /* degenerate case: a is zero */ - if(BN_is_zero(a)) return BN_set_word(a,w); + if(BN_is_zero(a)) + { + i = BN_set_word(a,w); + if (i != 0) + BN_set_negative(a, 1); + return i; + } /* handle 'a' when negative */ if (a->neg) {