# The patch is based on the following commit from the upstream:
# https://git.openssl.org/?p=openssl.git;a=commit;h=399944622df7bd81af62e67ea967c470534090e2
# The fix is patched until the new version becomes available
# from the upstream.
--- a/crypto/dsa/dsa_ossl.c 2016-06-20 08:06:46.793733045 -0700
+++ b/crypto/dsa/dsa_ossl.c 2016-06-20 08:07:42.133601060 -0700
@@ -248,9 +248,6 @@
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_CONSTTIME);
- }
if (dsa->flags & DSA_FLAG_CACHE_MONT_P) {
if (!BN_MONT_CTX_set_locked(&dsa->method_mont_p,
@@ -282,6 +279,11 @@
} else {
K = &k;
}
+
+ if ((dsa->flags & DSA_FLAG_NO_EXP_CONSTTIME) == 0) {
+ BN_set_flags(K, BN_FLG_CONSTTIME);
+ }
+
DSA_BN_MOD_EXP(goto err, dsa, r, dsa->g, K, dsa->p, ctx,
dsa->method_mont_p);
if (!BN_mod(r, r, dsa->q, ctx))