aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2002-10-14 11:27:11 +0000
committerRichard Levitte <levitte@openssl.org>2002-10-14 11:27:11 +0000
commit495ac8e429efc0a9aa919dc857d34f87d3cb8a37 (patch)
treebbec226b8afd73169f13c6b07d84f5318bd9d3eb
parent0bde80f9325e9ab0819bd1dc249c66792c5dade6 (diff)
downloadopenssl-495ac8e429efc0a9aa919dc857d34f87d3cb8a37.tar.gz
When BN_add_word() reaches top, it shouldn't try to add the the corresponding
word, since that word may not be zero.
-rw-r--r--crypto/bn/bn_word.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/bn/bn_word.c b/crypto/bn/bn_word.c
index cd59baa2c4..988e0ca7b3 100644
--- a/crypto/bn/bn_word.c
+++ b/crypto/bn/bn_word.c
@@ -123,7 +123,10 @@ int BN_add_word(BIGNUM *a, BN_ULONG w)
i=0;
for (;;)
{
- l=(a->d[i]+(BN_ULONG)w)&BN_MASK2;
+ if (i >= a->top)
+ l=w;
+ else
+ l=(a->d[i]+(BN_ULONG)w)&BN_MASK2;
a->d[i]=l;
if (w > l)
w=1;