Skip to content

Commit 5a30e0b

Browse files
committed
deps: float 3984ef0 from openssl / CVE-2018-0732
Pending OpenSSL 1.0.2p release. Ref: #21282 Upstream: openssl/openssl@3984ef0 Reviewed-By: James M Snell <[email protected]> Original commit message: Reject excessively large primes in DH key generation. CVE-2018-0732 Signed-off-by: Guido Vranken <[email protected]> (cherry picked from commit 91f7361) Reviewed-by: Tim Hudson <[email protected]> Reviewed-by: Matt Caswell <[email protected]> (Merged from #6457)
1 parent a5d1ab3 commit 5a30e0b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

deps/openssl/openssl/crypto/dh/dh_key.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,15 @@ static int generate_key(DH *dh)
130130
int ok = 0;
131131
int generate_new_key = 0;
132132
unsigned l;
133-
BN_CTX *ctx;
133+
BN_CTX *ctx = NULL;
134134
BN_MONT_CTX *mont = NULL;
135135
BIGNUM *pub_key = NULL, *priv_key = NULL;
136136

137+
if (BN_num_bits(dh->p) > OPENSSL_DH_MAX_MODULUS_BITS) {
138+
DHerr(DH_F_GENERATE_KEY, DH_R_MODULUS_TOO_LARGE);
139+
return 0;
140+
}
141+
137142
ctx = BN_CTX_new();
138143
if (ctx == NULL)
139144
goto err;

0 commit comments

Comments
 (0)