Implement fixed-window exponentiation to mitigate hyper-threading
[openssl.git] / crypto / dsa / dsa_ossl.c
index 25cd8484aabf335421c169e39f9cc50f85e4989d..2e5ede78268c1491ba1ddbc0a67715b3dcb722e4 100644 (file)
@@ -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)
                {