aboutsummaryrefslogtreecommitdiff
path: root/crypto/bn/bn_word.c
diff options
context:
space:
mode:
authorNils Larsch <nils@openssl.org>2005-07-17 16:09:09 +0000
committerNils Larsch <nils@openssl.org>2005-07-17 16:09:09 +0000
commit449bd384ed0577ab9a0899c9237ad1ee918ec870 (patch)
tree27a32324ed0fbab0835d75479cc4d62fe104d69b /crypto/bn/bn_word.c
parent3eeaab4bed46e3320947d0f609b82007b65b5a46 (diff)
downloadopenssl-449bd384ed0577ab9a0899c9237ad1ee918ec870.zip
openssl-449bd384ed0577ab9a0899c9237ad1ee918ec870.tar.gz
openssl-449bd384ed0577ab9a0899c9237ad1ee918ec870.tar.bz2
bugfix: 0 - w (w != 0) is actually negative
Diffstat (limited to 'crypto/bn/bn_word.c')
-rw-r--r--crypto/bn/bn_word.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/crypto/bn/bn_word.c b/crypto/bn/bn_word.c
index 1bcb37e..bc5905f 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)
{