Problem: bn_mul_normal() misbehaves if the size of b is 0.
authorRichard Levitte <levitte@openssl.org>
Wed, 13 Dec 2000 15:29:29 +0000 (15:29 +0000)
committerRichard Levitte <levitte@openssl.org>
Wed, 13 Dec 2000 15:29:29 +0000 (15:29 +0000)
Solution: multiply a with 0, putting the result in r, and return.

crypto/bn/bn_mul.c

index b4ed7e2..94db7c0 100644 (file)
@@ -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 (;;)
                {