From 53b407da84909dffb54c44dc8a1106723a23a546 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Wed, 13 Dec 2000 15:29:29 +0000 Subject: [PATCH] Problem: bn_mul_normal() misbehaves if the size of b is 0. Solution: multiply a with 0, putting the result in r, and return. --- crypto/bn/bn_mul.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 (;;) { -- 2.25.1