Blame SOURCES/openssl-1.0.2k-cve-2018-0732.patch

7779df
diff -up openssl-1.0.2k/crypto/dh/dh_key.c.large-dh openssl-1.0.2k/crypto/dh/dh_key.c
7779df
--- openssl-1.0.2k/crypto/dh/dh_key.c.large-dh	2018-06-18 13:46:24.268137362 +0200
7779df
+++ openssl-1.0.2k/crypto/dh/dh_key.c	2018-06-18 13:59:04.605497462 +0200
7779df
@@ -133,7 +133,7 @@ static int generate_key(DH *dh)
7779df
     int ok = 0;
7779df
     int generate_new_key = 0;
7779df
     unsigned l;
7779df
-    BN_CTX *ctx;
7779df
+    BN_CTX *ctx = NULL;
7779df
     BN_MONT_CTX *mont = NULL;
7779df
     BIGNUM *pub_key = NULL, *priv_key = NULL;
7779df
 
7779df
@@ -145,6 +145,11 @@ static int generate_key(DH *dh)
7779df
     }
7779df
 #endif
7779df
 
7779df
+    if (BN_num_bits(dh->p) > OPENSSL_DH_MAX_MODULUS_BITS) {
7779df
+        DHerr(DH_F_GENERATE_KEY, DH_R_MODULUS_TOO_LARGE);
7779df
+        return 0;
7779df
+    }
7779df
+
7779df
     ctx = BN_CTX_new();
7779df
     if (ctx == NULL)
7779df
         goto err;