Use memset in bn_mont
authorRich Salz <rsalz@openssl.org>
Thu, 5 Feb 2015 20:07:40 +0000 (15:07 -0500)
committerRich Salz <rsalz@openssl.org>
Thu, 5 Feb 2015 20:07:40 +0000 (15:07 -0500)
Use memset() not inline code.  Compilers are smarter now.

Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/bn/bn_mont.c

index 175145e7b757901cd1211efd26d19ddc12fceb81..45deed7558e8ff32abbd5786b18c2869b8087dd4 100644 (file)
@@ -196,12 +196,7 @@ static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont)
     rp = r->d;
 
     /* clear the top words of T */
     rp = r->d;
 
     /* clear the top words of T */
-# if 1
-    for (i = r->top; i < max; i++) /* memset? XXX */
-        rp[i] = 0;
-# else
     memset(&(rp[r->top]), 0, (max - r->top) * sizeof(BN_ULONG));
     memset(&(rp[r->top]), 0, (max - r->top) * sizeof(BN_ULONG));
-# endif
 
     r->top = max;
     n0 = mont->n0[0];
 
     r->top = max;
     n0 = mont->n0[0];