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

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