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

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