summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicola Tuveri <nic.tuv@gmail.com>2019-02-08 12:42:25 +0200
committerNicola Tuveri <nic.tuv@gmail.com>2019-02-20 23:02:09 +0200
commit9acdddf1acd6f6be41ddb711b6b55fe7f5481320 (patch)
tree883248a18b3f846faa0be941d24a4c25a43d94ec
parentd769ce09b690237c35c32032edbaf0339c480e85 (diff)
Clear BN_FLG_CONSTTIME on BN_CTX_get()
(cherry picked from commit c8147d37ccaaf28c430d3fb45a14af36597e48b8) Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/8295)
-rw-r--r--crypto/bn/bn_ctx.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/bn/bn_ctx.c b/crypto/bn/bn_ctx.c
index 526c6a046d..3391134d7b 100644
--- a/crypto/bn/bn_ctx.c
+++ b/crypto/bn/bn_ctx.c
@@ -299,6 +299,8 @@ BIGNUM *BN_CTX_get(BN_CTX *ctx)
}
/* OK, make sure the returned bignum is "zero" */
BN_zero(ret);
+ /* clear BN_FLG_CONSTTIME if leaked from previous frames */
+ ret->flags &= (~BN_FLG_CONSTTIME);
ctx->used++;
CTXDBG_RET(ctx, ret);
return ret;