diff options
author | Matt Caswell <matt@openssl.org> | 2016-05-26 10:55:11 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-06-06 11:09:06 +0100 |
commit | 5584f65a1027b06fe0cfc4be28d1a232cf180e42 (patch) | |
tree | e1d62f81d9d5a23575e4f4063b47d28e680afcdf /crypto/dsa/dsa_key.c | |
parent | f943e640efbb5ec30bf57b59468c094083c99eb2 (diff) |
Deprecate the flags that switch off constant time
The flags RSA_FLAG_NO_CONSTTIME, DSA_FLAG_NO_EXP_CONSTTIME and
DH_FLAG_NO_EXP_CONSTTIME which previously provided the ability to switch
off the constant time implementation for RSA, DSA and DH have been made
no-ops and deprecated.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/dsa/dsa_key.c')
-rw-r--r-- | crypto/dsa/dsa_key.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/crypto/dsa/dsa_key.c b/crypto/dsa/dsa_key.c index 2bb84543d6..aa5d42ce17 100644 --- a/crypto/dsa/dsa_key.c +++ b/crypto/dsa/dsa_key.c @@ -50,24 +50,18 @@ static int dsa_builtin_keygen(DSA *dsa) pub_key = dsa->pub_key; { - BIGNUM *local_prk = NULL; - BIGNUM *prk; + BIGNUM *prk = BN_new(); - if ((dsa->flags & DSA_FLAG_NO_EXP_CONSTTIME) == 0) { - local_prk = prk = BN_new(); - if (local_prk == NULL) - goto err; - BN_with_flags(prk, priv_key, BN_FLG_CONSTTIME); - } else { - prk = priv_key; - } + if (prk == NULL) + goto err; + BN_with_flags(prk, priv_key, BN_FLG_CONSTTIME); if (!BN_mod_exp(pub_key, dsa->g, prk, dsa->p, ctx)) { - BN_free(local_prk); + BN_free(prk); goto err; } - /* We MUST free local_prk before any further use of priv_key */ - BN_free(local_prk); + /* We MUST free prk before any further use of priv_key */ + BN_free(prk); } dsa->priv_key = priv_key; |