summaryrefslogtreecommitdiffstats
path: root/crypto/dsa/dsa_ossl.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2005-05-16 01:43:31 +0000
committerBodo Möller <bodo@openssl.org>2005-05-16 01:43:31 +0000
commit46a643763de6d8e39ecf6f76fa79b4d04885aa59 (patch)
treee1f3cfc98bddba797b5300977dbf3223f008fc4a /crypto/dsa/dsa_ossl.c
parent92c44685724c0d993ea8920577680f3c0a1d79c8 (diff)
Implement fixed-window exponentiation to mitigate hyper-threading
timing attacks. BN_FLG_EXP_CONSTTIME requests this algorithm, and this done by default for RSA/DSA/DH private key computations unless RSA_FLAG_NO_EXP_CONSTTIME/DSA_FLAG_NO_EXP_CONSTTIME/ DH_FLAG_NO_EXP_CONSTTIME is set. Submitted by: Matthew D Wood Reviewed by: Bodo Moeller
Diffstat (limited to 'crypto/dsa/dsa_ossl.c')
-rw-r--r--crypto/dsa/dsa_ossl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/dsa/dsa_ossl.c b/crypto/dsa/dsa_ossl.c
index 25cd8484aa..2e5ede7826 100644
--- a/crypto/dsa/dsa_ossl.c
+++ b/crypto/dsa/dsa_ossl.c
@@ -227,6 +227,10 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
do
if (!BN_rand_range(&k, dsa->q)) goto err;
while (BN_is_zero(&k));
+ if ((dsa->flags & DSA_FLAG_NO_EXP_CONSTTIME) == 0)
+ {
+ BN_set_flags(&k, BN_FLG_EXP_CONSTTIME);
+ }
if (dsa->flags & DSA_FLAG_CACHE_MONT_P)
{