From: Cesar Pereida Date: Tue, 7 Jun 2016 13:02:01 +0000 (+0300) Subject: Set flag BN_FLG_CONSTTIME earlier X-Git-Tag: OpenSSL_1_1_0-pre6~531 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=47ae05ba6288c831a9aa4282f9cce40372e79ea9;p=oweals%2Fopenssl.git Set flag BN_FLG_CONSTTIME earlier Reviewed-by: Rich Salz Reviewed-by: Matt Caswell --- diff --git a/crypto/dsa/dsa_ossl.c b/crypto/dsa/dsa_ossl.c index 81c5239869..9c97ef949c 100644 --- a/crypto/dsa/dsa_ossl.c +++ b/crypto/dsa/dsa_ossl.c @@ -167,6 +167,8 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, goto err; } while (BN_is_zero(k)); + BN_set_flags(k, BN_FLG_CONSTTIME); + if (dsa->flags & DSA_FLAG_CACHE_MONT_P) { if (!BN_MONT_CTX_set_locked(&dsa->method_mont_p, dsa->lock, dsa->p, ctx)) @@ -189,8 +191,6 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, goto err; } - BN_set_flags(k, BN_FLG_CONSTTIME); - if ((dsa)->meth->bn_mod_exp != NULL) { if (!dsa->meth->bn_mod_exp(dsa, r, dsa->g, k, dsa->p, ctx, dsa->method_mont_p)) @@ -200,7 +200,6 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, goto err; } - if (!BN_mod(r, r, dsa->q, ctx)) goto err;