diff --git a/.gitignore b/.gitignore index ee06d4c..e1f0b9c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ SOURCES/node-ssl-shim-6fc0b05.tar.gz -SOURCES/node-v12.18.4-stripped.tar.gz +SOURCES/node-v12.19.1-stripped.tar.gz diff --git a/.rh-nodejs12-nodejs.metadata b/.rh-nodejs12-nodejs.metadata index aa63d7a..7f0c8fc 100644 --- a/.rh-nodejs12-nodejs.metadata +++ b/.rh-nodejs12-nodejs.metadata @@ -1,2 +1,2 @@ 9fe6761bd237af8be0e4d26184c5a01e01d7967d SOURCES/node-ssl-shim-6fc0b05.tar.gz -002418dc06158c9068be2c4e18847243a6c4d9c5 SOURCES/node-v12.18.4-stripped.tar.gz +52b6a7856356c8cd8c5ddae0550c4d65238ea33a SOURCES/node-v12.19.1-stripped.tar.gz diff --git a/SOURCES/0001-Link-with-ssl-shim.patch b/SOURCES/0001-Link-with-ssl-shim.patch index 6b3f0bf..bf0d6fc 100644 --- a/SOURCES/0001-Link-with-ssl-shim.patch +++ b/SOURCES/0001-Link-with-ssl-shim.patch @@ -1,4 +1,4 @@ -From ef86c8e2907c82e956a997e2ed6cbce5e8d33312 Mon Sep 17 00:00:00 2001 +From f2b5ee60b7e1f01a6678ee3172c6fa59c6ce8da1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Tue, 28 Apr 2020 11:15:24 +0200 Subject: [PATCH] Link with ssl-shim @@ -35,10 +35,10 @@ index 116c1c7149..0e40a2b441 100644 }], diff --git a/src/node_crypto.cc b/src/node_crypto.cc -index c132e6a089..5783500b16 100644 +index db2e122ab0..90df5f25e0 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc -@@ -1142,7 +1142,7 @@ void SecureContext::AddRootCerts(const FunctionCallbackInfo& args) { +@@ -1135,7 +1135,7 @@ void SecureContext::AddRootCerts(const FunctionCallbackInfo& args) { void SecureContext::SetCipherSuites(const FunctionCallbackInfo& args) { // BoringSSL doesn't allow API config of TLS1.3 cipher suites. @@ -48,10 +48,10 @@ index c132e6a089..5783500b16 100644 ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); Environment* env = sc->env(); diff --git a/src/node_crypto.h b/src/node_crypto.h -index 772a34a7da..ec86debfea 100644 +index 38fd806e62..0b9dab833d 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h -@@ -40,6 +40,8 @@ +@@ -41,6 +41,8 @@ #include #include @@ -61,5 +61,5 @@ index 772a34a7da..ec86debfea 100644 namespace crypto { -- -2.26.2 +2.28.0 diff --git a/SOURCES/0002-Use-OpenSSL-1.0-API.patch b/SOURCES/0002-Use-OpenSSL-1.0-API.patch index d7f98be..d672569 100644 --- a/SOURCES/0002-Use-OpenSSL-1.0-API.patch +++ b/SOURCES/0002-Use-OpenSSL-1.0-API.patch @@ -1,6 +1,6 @@ -From 338901851f23e9d42b86fe88bed99bada47e099c Mon Sep 17 00:00:00 2001 +From ae4f772872661d6435c27e50937a0c3cbcede43c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= -Date: Fri, 2 Oct 2020 13:00:17 +0200 +Date: Mon, 23 Nov 2020 11:56:26 +0100 Subject: [PATCH] Use OpenSSL 1.0 API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -23,17 +23,20 @@ Content-Transfer-Encoding: 8bit Using `const` prevents passing the method as a function pointer to other OpenSSL API functions. +- Provide GetCipherValue wrapper for non-const strings + - Sanitize inputs into PBKDF2 Signed-off-by: Jan Staněk --- - src/node_crypto.cc | 26 ++++++++++++++++++++++++-- - src/node_crypto.h | 4 ++++ - src/node_crypto_bio.cc | 4 ++++ - 3 files changed, 32 insertions(+), 2 deletions(-) + src/node_crypto.cc | 26 ++++++++++++++++++++++++-- + src/node_crypto.h | 4 ++++ + src/node_crypto_bio.cc | 4 ++++ + src/node_crypto_common.cc | 8 ++++++++ + 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc -index 5783500b16..23c460ee49 100644 +index 90df5f25e0..7be3f77e1a 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -123,7 +123,11 @@ template int SSLWrap::SetCACerts(SecureContext* sc); @@ -48,7 +51,7 @@ index 5783500b16..23c460ee49 100644 int len, int* copy); template int SSLWrap::NewSessionCallback(SSL* s, -@@ -1755,7 +1759,11 @@ void SSLWrap::ConfigureSecureContext(SecureContext* sc) { +@@ -1746,7 +1750,11 @@ void SSLWrap::ConfigureSecureContext(SecureContext* sc) { template SSL_SESSION* SSLWrap::GetSessionCallback(SSL* s, @@ -60,7 +63,7 @@ index 5783500b16..23c460ee49 100644 int len, int* copy) { Base* w = static_cast(SSL_get_app_data(s)); -@@ -5845,9 +5853,23 @@ struct PBKDF2Job : public CryptoJob { +@@ -5917,9 +5925,23 @@ struct PBKDF2Job : public CryptoJob { } inline void DoThreadPoolWork() override { @@ -87,10 +90,10 @@ index 5783500b16..23c460ee49 100644 success = Just(ok); Cleanse(); diff --git a/src/node_crypto.h b/src/node_crypto.h -index ec86debfea..5e8e6ac000 100644 +index 0b9dab833d..7d6417b66f 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h -@@ -233,7 +233,11 @@ class SSLWrap { +@@ -234,7 +234,11 @@ class SSLWrap { static void AddMethods(Environment* env, v8::Local t); static SSL_SESSION* GetSessionCallback(SSL* s, @@ -118,6 +121,25 @@ index 55f5e8a5a3..c2a44fdb86 100644 if (bio && env != nullptr) NodeBIO::FromBIO(bio.get())->env_ = env; return bio; +diff --git a/src/node_crypto_common.cc b/src/node_crypto_common.cc +index 6c3bb0b1b6..d1d9edd6cd 100644 +--- a/src/node_crypto_common.cc ++++ b/src/node_crypto_common.cc +@@ -392,6 +392,14 @@ MaybeLocal GetCipherValue(Environment* env, + + return OneByteString(env->isolate(), getstr(cipher)); + } ++MaybeLocal GetCipherValue(Environment* env, ++ const SSL_CIPHER* cipher, ++ char* (*getstr)(const SSL_CIPHER* cipher)) { ++ if (cipher == nullptr) { ++ return Undefined(env->isolate()); ++ } ++ return OneByteString(env->isolate(), const_cast(getstr(cipher))); ++} + + MaybeLocal GetCipherName(Environment* env, const SSL_CIPHER* cipher) { + return GetCipherValue(env, cipher, SSL_CIPHER_get_name); -- -2.26.2 +2.28.0 diff --git a/SOURCES/0003-Backport-necessary-OpenSSL-features.patch b/SOURCES/0003-Backport-necessary-OpenSSL-features.patch index 20237da..dcff61a 100644 --- a/SOURCES/0003-Backport-necessary-OpenSSL-features.patch +++ b/SOURCES/0003-Backport-necessary-OpenSSL-features.patch @@ -1,6 +1,6 @@ -From b443972d6f464c613eecdd410987eb34d78c3b9c Mon Sep 17 00:00:00 2001 +From 7dc5dae056d1b77a748ebfb8a3e312b4306789b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= -Date: Fri, 2 Oct 2020 13:01:01 +0200 +Date: Mon, 23 Nov 2020 11:57:01 +0100 Subject: [PATCH] Backport necessary OpenSSL features MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -38,15 +38,15 @@ Content-Transfer-Encoding: 8bit Signed-off-by: Jan Staněk --- - src/node_crypto.cc | 192 +++++++++++++++++++++++++++++++++++++++------ + src/node_crypto.cc | 174 ++++++++++++++++++++++++++++++++++++++++++--- src/node_crypto.h | 14 ++++ - 2 files changed, 180 insertions(+), 26 deletions(-) + 2 files changed, 180 insertions(+), 8 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc -index 23c460ee49..3cee36d62c 100644 +index 7be3f77e1a..c2b5aaa1a1 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc -@@ -517,6 +517,11 @@ inline void SecureContext::Reset() { +@@ -518,6 +518,11 @@ inline void SecureContext::Reset() { ctx_.reset(); cert_.reset(); issuer_.reset(); @@ -58,7 +58,7 @@ index 23c460ee49..3cee36d62c 100644 } SecureContext::~SecureContext() { -@@ -530,7 +535,11 @@ void SecureContext::New(const FunctionCallbackInfo& args) { +@@ -531,7 +536,11 @@ void SecureContext::New(const FunctionCallbackInfo& args) { // A maxVersion of 0 means "any", but OpenSSL may support TLS versions that // Node.js doesn't, so pin the max to what we do support. @@ -70,55 +70,53 @@ index 23c460ee49..3cee36d62c 100644 void SecureContext::Init(const FunctionCallbackInfo& args) { SecureContext* sc; -@@ -593,38 +602,23 @@ void SecureContext::Init(const FunctionCallbackInfo& args) { - max_version = MAX_SUPPORTED_VERSION; - method = TLS_client_method(); - } else if (strcmp(*sslmethod, "TLSv1_method") == 0) { -- min_version = TLS1_VERSION; -- max_version = TLS1_VERSION; +@@ -588,36 +597,39 @@ void SecureContext::Init(const FunctionCallbackInfo& args) { + } else if (sslmethod == "TLSv1_method") { + min_version = TLS1_VERSION; + max_version = TLS1_VERSION; + method = TLSv1_method(); - } else if (strcmp(*sslmethod, "TLSv1_server_method") == 0) { -- min_version = TLS1_VERSION; -- max_version = TLS1_VERSION; + } else if (sslmethod == "TLSv1_server_method") { + min_version = TLS1_VERSION; + max_version = TLS1_VERSION; - method = TLS_server_method(); + method = TLSv1_server_method(); - } else if (strcmp(*sslmethod, "TLSv1_client_method") == 0) { -- min_version = TLS1_VERSION; -- max_version = TLS1_VERSION; + } else if (sslmethod == "TLSv1_client_method") { + min_version = TLS1_VERSION; + max_version = TLS1_VERSION; - method = TLS_client_method(); + method = TLSv1_client_method(); - } else if (strcmp(*sslmethod, "TLSv1_1_method") == 0) { -- min_version = TLS1_1_VERSION; -- max_version = TLS1_1_VERSION; + } else if (sslmethod == "TLSv1_1_method") { + min_version = TLS1_1_VERSION; + max_version = TLS1_1_VERSION; + method = TLSv1_1_method(); - } else if (strcmp(*sslmethod, "TLSv1_1_server_method") == 0) { -- min_version = TLS1_1_VERSION; -- max_version = TLS1_1_VERSION; + } else if (sslmethod == "TLSv1_1_server_method") { + min_version = TLS1_1_VERSION; + max_version = TLS1_1_VERSION; - method = TLS_server_method(); + method = TLSv1_1_server_method(); - } else if (strcmp(*sslmethod, "TLSv1_1_client_method") == 0) { -- min_version = TLS1_1_VERSION; -- max_version = TLS1_1_VERSION; + } else if (sslmethod == "TLSv1_1_client_method") { + min_version = TLS1_1_VERSION; + max_version = TLS1_1_VERSION; - method = TLS_client_method(); + method = TLSv1_1_client_method(); - } else if (strcmp(*sslmethod, "TLSv1_2_method") == 0) { -- min_version = TLS1_2_VERSION; -- max_version = TLS1_2_VERSION; + } else if (sslmethod == "TLSv1_2_method") { + min_version = TLS1_2_VERSION; + max_version = TLS1_2_VERSION; + method = TLSv1_2_method(); - } else if (strcmp(*sslmethod, "TLSv1_2_server_method") == 0) { -- min_version = TLS1_2_VERSION; -- max_version = TLS1_2_VERSION; + } else if (sslmethod == "TLSv1_2_server_method") { + min_version = TLS1_2_VERSION; + max_version = TLS1_2_VERSION; - method = TLS_server_method(); + method = TLSv1_2_server_method(); - } else if (strcmp(*sslmethod, "TLSv1_2_client_method") == 0) { -- min_version = TLS1_2_VERSION; -- max_version = TLS1_2_VERSION; + } else if (sslmethod == "TLSv1_2_client_method") { + min_version = TLS1_2_VERSION; + max_version = TLS1_2_VERSION; - method = TLS_client_method(); + method = TLSv1_2_client_method(); } else { const std::string msg("Unknown method: "); THROW_ERR_TLS_INVALID_PROTOCOL_METHOD(env, (msg + * sslmethod).c_str()); -@@ -654,8 +648,14 @@ void SecureContext::Init(const FunctionCallbackInfo& args) { +@@ -647,8 +659,14 @@ void SecureContext::Init(const FunctionCallbackInfo& args) { SSL_SESS_CACHE_NO_INTERNAL | SSL_SESS_CACHE_NO_AUTO_CLEAR); @@ -133,7 +131,7 @@ index 23c460ee49..3cee36d62c 100644 // OpenSSL 1.1.0 changed the ticket key size, but the OpenSSL 1.0.x size was // exposed in the public API. To retain compatibility, install a callback -@@ -1251,6 +1251,65 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo& args) { +@@ -1244,6 +1262,65 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo& args) { return env->ThrowTypeError("Error setting temp DH parameter"); } @@ -199,7 +197,7 @@ index 23c460ee49..3cee36d62c 100644 void SecureContext::SetMinProto(const FunctionCallbackInfo& args) { SecureContext* sc; -@@ -1261,7 +1320,12 @@ void SecureContext::SetMinProto(const FunctionCallbackInfo& args) { +@@ -1254,7 +1331,12 @@ void SecureContext::SetMinProto(const FunctionCallbackInfo& args) { int version = args[0].As()->Value(); @@ -212,7 +210,7 @@ index 23c460ee49..3cee36d62c 100644 } -@@ -1274,7 +1338,12 @@ void SecureContext::SetMaxProto(const FunctionCallbackInfo& args) { +@@ -1267,7 +1349,12 @@ void SecureContext::SetMaxProto(const FunctionCallbackInfo& args) { int version = args[0].As()->Value(); @@ -225,7 +223,7 @@ index 23c460ee49..3cee36d62c 100644 } -@@ -1285,7 +1354,11 @@ void SecureContext::GetMinProto(const FunctionCallbackInfo& args) { +@@ -1278,7 +1365,11 @@ void SecureContext::GetMinProto(const FunctionCallbackInfo& args) { CHECK_EQ(args.Length(), 0); long version = // NOLINT(runtime/int) @@ -237,7 +235,7 @@ index 23c460ee49..3cee36d62c 100644 args.GetReturnValue().Set(static_cast(version)); } -@@ -1297,11 +1370,14 @@ void SecureContext::GetMaxProto(const FunctionCallbackInfo& args) { +@@ -1290,11 +1381,14 @@ void SecureContext::GetMaxProto(const FunctionCallbackInfo& args) { CHECK_EQ(args.Length(), 0); long version = // NOLINT(runtime/int) @@ -253,7 +251,7 @@ index 23c460ee49..3cee36d62c 100644 void SecureContext::SetOptions(const FunctionCallbackInfo& args) { SecureContext* sc; ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); -@@ -6797,8 +6873,72 @@ void TimingSafeEqual(const FunctionCallbackInfo& args) { +@@ -6892,8 +6986,72 @@ void TimingSafeEqual(const FunctionCallbackInfo& args) { CRYPTO_memcmp(buf1.data(), buf2.data(), buf1.length()) == 0); } @@ -328,10 +326,10 @@ index 23c460ee49..3cee36d62c 100644 // --openssl-config=... diff --git a/src/node_crypto.h b/src/node_crypto.h -index 5e8e6ac000..d165b5f194 100644 +index 7d6417b66f..746a2a3fc7 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h -@@ -181,6 +181,20 @@ class SecureContext final : public BaseObject { +@@ -182,6 +182,20 @@ class SecureContext final : public BaseObject { SecureContext(Environment* env, v8::Local wrap); void Reset(); @@ -353,5 +351,5 @@ index 5e8e6ac000..d165b5f194 100644 // SSLWrap implicitly depends on the inheriting class' handle having an -- -2.26.2 +2.28.0 diff --git a/SOURCES/0004-Disable-unsupported-OpenSSL-features.patch b/SOURCES/0004-Disable-unsupported-OpenSSL-features.patch index 799d660..67a2a97 100644 --- a/SOURCES/0004-Disable-unsupported-OpenSSL-features.patch +++ b/SOURCES/0004-Disable-unsupported-OpenSSL-features.patch @@ -1,6 +1,6 @@ -From a081a5fc3d039d1863fed4b0aa07cdbc27f92dc3 Mon Sep 17 00:00:00 2001 +From 77cbd12e600a599351ec3b0b0302c7fcd1f9ec0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= -Date: Fri, 2 Oct 2020 13:01:37 +0200 +Date: Mon, 23 Nov 2020 11:57:32 +0100 Subject: [PATCH] Disable unsupported OpenSSL features MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -41,10 +41,10 @@ Signed-off-by: Jan Staněk rename test/{parallel => known_issues}/test-tls-cli-min-version-1.3.js (100%) diff --git a/doc/api/cli.md b/doc/api/cli.md -index 27ab46d555..60fcf6b592 100644 +index e6d49feef6..47976c670b 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md -@@ -770,14 +770,6 @@ added: v12.0.0 +@@ -810,14 +810,6 @@ added: v12.0.0 Set [`tls.DEFAULT_MAX_VERSION`][] to 'TLSv1.2'. Use to disable support for TLSv1.3. @@ -59,7 +59,7 @@ index 27ab46d555..60fcf6b592 100644 ### `--tls-min-v1.0`