From 31a571d16c8497d828afccc0c789827af705a6f4 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Fri, 15 Jun 2018 16:13:51 +1000 Subject: [PATCH] deps: float 3984ef0 from openssl / CVE-2018-0732 Pending OpenSSL 1.0.2p release. Ref: https://github.com/nodejs/node/pull/21282 Upstream: https://github.com/openssl/openssl/commit/3984ef0 Reviewed-By: James M Snell Original commit message: Reject excessively large primes in DH key generation. CVE-2018-0732 Signed-off-by: Guido Vranken (cherry picked from commit 91f7361) Reviewed-by: Tim Hudson Reviewed-by: Matt Caswell (Merged from #6457) --- deps/openssl/openssl/crypto/dh/dh_key.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/deps/openssl/openssl/crypto/dh/dh_key.c b/deps/openssl/openssl/crypto/dh/dh_key.c index 387558f1467c81..f235e0d682b130 100644 --- a/deps/openssl/openssl/crypto/dh/dh_key.c +++ b/deps/openssl/openssl/crypto/dh/dh_key.c @@ -130,10 +130,15 @@ static int generate_key(DH *dh) int ok = 0; int generate_new_key = 0; unsigned l; - BN_CTX *ctx; + BN_CTX *ctx = NULL; BN_MONT_CTX *mont = NULL; BIGNUM *pub_key = NULL, *priv_key = NULL; + if (BN_num_bits(dh->p) > OPENSSL_DH_MAX_MODULUS_BITS) { + DHerr(DH_F_GENERATE_KEY, DH_R_MODULUS_TOO_LARGE); + return 0; + } + ctx = BN_CTX_new(); if (ctx == NULL) goto err;