diff options
author | Richard Levitte <levitte@openssl.org> | 2000-12-13 15:29:29 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2000-12-13 15:29:29 +0000 |
commit | 53b407da84909dffb54c44dc8a1106723a23a546 (patch) | |
tree | b797948da2d39b24d0aa331dee001b75d234c9ae | |
parent | 765e5311590b9970d8bd33771fb198cea30b0c05 (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.
-rw-r--r-- | crypto/bn/bn_mul.c | 8 |
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 (;;) { |