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

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