summaryrefslogtreecommitdiffstats
path: root/crypto/bn
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2000-12-13 15:29:29 +0000
committerRichard Levitte <levitte@openssl.org>2000-12-13 15:29:29 +0000
commit53b407da84909dffb54c44dc8a1106723a23a546 (patch)
treeb797948da2d39b24d0aa331dee001b75d234c9ae /crypto/bn
parent765e5311590b9970d8bd33771fb198cea30b0c05 (diff)
Problem: bn_mul_normal() misbehaves if the size of b is 0.
Solution: multiply a with 0, putting the result in r, and return.
Diffstat (limited to 'crypto/bn')
-rw-r--r--crypto/bn/bn_mul.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/crypto/bn/bn_mul.c b/crypto/bn/bn_mul.c
index b4ed7e23e6..94db7c05e6 100644
--- a/crypto/bn/bn_mul.c
+++ b/crypto/bn/bn_mul.c
@@ -1110,7 +1110,13 @@ void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb)
}
rr= &(r[na]);
- rr[0]=bn_mul_words(r,a,na,b[0]);
+ if (nb <= 0)
+ {
+ (void)bn_mul_words(r,a,na,0);
+ return;
+ }
+ else
+ rr[0]=bn_mul_words(r,a,na,b[0]);
for (;;)
{