summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_mont.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2015-07-22 06:44:50 -0400
committerRich Salz <rsalz@openssl.org>2015-07-22 14:43:05 -0400
commit9f040d6decca7930e978784c917f731e5c45e8f0 (patch)
treec3e09cfde8f467f10f63ce01e787cd10d4c95bdd /crypto/bn/bn_mont.c
parent4445704f912495227e9e99835e94219d7e79684c (diff)
Some cleanups for crypto/bn
Create bn_free_d utility routine and use it. Fix RT3950 Also a missing cleanse, from Loganaden Velvindron (loganaden@gmail.com), who noticed it in a Cloudflare patch. Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/bn/bn_mont.c')
-rw-r--r--crypto/bn/bn_mont.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/bn/bn_mont.c b/crypto/bn/bn_mont.c
index c869101384..e3955fe475 100644
--- a/crypto/bn/bn_mont.c
+++ b/crypto/bn/bn_mont.c
@@ -196,7 +196,9 @@ static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont)
rp = r->d;
/* clear the top words of T */
- memset(&rp[r->top], 0, sizeof(*rp) * (max - r->top));
+ i = max - r->top;
+ if (i)
+ memset(&rp[r->top], 0, sizeof(*rp) * i);
r->top = max;
n0 = mont->n0[0];