From 2a5450809a4f734d64251bf544c07ad83ca1ba31 Mon Sep 17 00:00:00 2001 From: otto <> Date: Thu, 21 Aug 2003 08:14:19 +0000 Subject: Do not produce a corrupt BIGNUM when adding 0 to 0 using BN_add_word(). ok markus@ --- src/lib/libcrypto/bn/bn_word.c | 3 +++ src/lib/libssl/src/crypto/bn/bn_word.c | 3 +++ 2 files changed, 6 insertions(+) (limited to 'src') 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) BN_ULONG l; int i; + if ((w & BN_MASK2) == 0) + return(1); + if (a->neg) { 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) BN_ULONG l; int i; + if ((w & BN_MASK2) == 0) + return(1); + if (a->neg) { a->neg=0; -- cgit v1.2.3-55-g6feb