components/openssl/openssl-1.0.1/patches/44_cve-2016-2178.patch
author Ronald Jordan <ron.jordan@oracle.com>
Wed, 22 Jun 2016 17:06:49 -0700
branchs11u3-sru
changeset 6269 0134818ac836
permissions -rw-r--r--
23599994 problem in LIBRARY/OPENSSL 23598249 problem in LIBRARY/OPENSSL

# 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))