diff options
| author | otto <> | 2003-08-21 08:14:19 +0000 |
|---|---|---|
| committer | otto <> | 2003-08-21 08:14:19 +0000 |
| commit | 2a5450809a4f734d64251bf544c07ad83ca1ba31 (patch) | |
| tree | 821e542412b655f612658c5d70c750068a8e3f91 | |
| parent | 374812f5f6500fbcfb87566cf4faf8060b2c4703 (diff) | |
| download | openbsd-2a5450809a4f734d64251bf544c07ad83ca1ba31.tar.gz openbsd-2a5450809a4f734d64251bf544c07ad83ca1ba31.tar.bz2 openbsd-2a5450809a4f734d64251bf544c07ad83ca1ba31.zip | |
Do not produce a corrupt BIGNUM when adding 0 to 0 using BN_add_word().
ok markus@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_word.c | 3 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/bn/bn_word.c | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/libcrypto/bn/bn_word.c b/src/lib/libcrypto/bn/bn_word.c index 988e0ca7b3..ab858d70ff 100644 --- a/src/lib/libcrypto/bn/bn_word.c +++ b/src/lib/libcrypto/bn/bn_word.c | |||
| @@ -110,6 +110,9 @@ int BN_add_word(BIGNUM *a, BN_ULONG w) | |||
| 110 | BN_ULONG l; | 110 | BN_ULONG l; |
| 111 | int i; | 111 | int i; |
| 112 | 112 | ||
| 113 | if ((w & BN_MASK2) == 0) | ||
| 114 | return(1); | ||
| 115 | |||
| 113 | if (a->neg) | 116 | if (a->neg) |
| 114 | { | 117 | { |
| 115 | a->neg=0; | 118 | a->neg=0; |
diff --git a/src/lib/libssl/src/crypto/bn/bn_word.c b/src/lib/libssl/src/crypto/bn/bn_word.c index 988e0ca7b3..ab858d70ff 100644 --- a/src/lib/libssl/src/crypto/bn/bn_word.c +++ b/src/lib/libssl/src/crypto/bn/bn_word.c | |||
| @@ -110,6 +110,9 @@ int BN_add_word(BIGNUM *a, BN_ULONG w) | |||
| 110 | BN_ULONG l; | 110 | BN_ULONG l; |
| 111 | int i; | 111 | int i; |
| 112 | 112 | ||
| 113 | if ((w & BN_MASK2) == 0) | ||
| 114 | return(1); | ||
| 115 | |||
| 113 | if (a->neg) | 116 | if (a->neg) |
| 114 | { | 117 | { |
| 115 | a->neg=0; | 118 | a->neg=0; |
