Skip to content

Commit

Permalink
Clear BN_FLG_CONSTTIME on BN_CTX_get()
Browse files Browse the repository at this point in the history
(cherry picked from commit c8147d3)

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #8253)
  • Loading branch information
romen committed Feb 20, 2019
1 parent 3c97136 commit e2e69dc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crypto/bn/bn_ctx.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
Expand Down Expand Up @@ -227,6 +227,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;
Expand Down

0 comments on commit e2e69dc

Please sign in to comment.