diff --git a/.gitignore b/.gitignore index 1472b88..cddf1b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ SOURCES/node-ssl-shim-70e39fd.tar.gz -SOURCES/node-v14.18.2-stripped.tar.gz +SOURCES/node-v14.20.0-stripped.tar.gz diff --git a/.rh-nodejs14-nodejs.metadata b/.rh-nodejs14-nodejs.metadata index a010fee..f483f68 100644 --- a/.rh-nodejs14-nodejs.metadata +++ b/.rh-nodejs14-nodejs.metadata @@ -1,2 +1,2 @@ a49b02166a7bdba54fb45cba26a18fa48928ca0e SOURCES/node-ssl-shim-70e39fd.tar.gz -2fbd74467b816a6319c33e0df147817a87b6bd39 SOURCES/node-v14.18.2-stripped.tar.gz +fac24a1c927ac8f47ddfb8694513836127c9afa4 SOURCES/node-v14.20.0-stripped.tar.gz diff --git a/SOURCES/0001-Link-with-ssl-shim.patch b/SOURCES/0001-Link-with-ssl-shim.patch index 30ff22f..ed3955e 100644 --- a/SOURCES/0001-Link-with-ssl-shim.patch +++ b/SOURCES/0001-Link-with-ssl-shim.patch @@ -1,7 +1,7 @@ -From ac25a4c4c88d234b52bdc3d47d5d8d5d9783aaa0 Mon Sep 17 00:00:00 2001 +From acc0bf44f8f822bf1dd07f62c8d2533ad4f0c1ce 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 1/7] Link with ssl-shim +Subject: [PATCH] Link with ssl-shim MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -14,10 +14,10 @@ Signed-off-by: Jan Staněk 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/node.gypi b/node.gypi -index 43dbda7bbf..070f212d96 100644 +index ad088b133b..45f6a9f45c 100644 --- a/node.gypi +++ b/node.gypi -@@ -364,9 +364,13 @@ +@@ -361,9 +361,13 @@ ], }], ], @@ -35,10 +35,10 @@ index 43dbda7bbf..070f212d96 100644 }], diff --git a/src/node_crypto.cc b/src/node_crypto.cc -index 61db9f04bb..798568bb8f 100644 +index 61e5a32854..d7c7d06646 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc -@@ -1158,7 +1158,7 @@ void SecureContext::AddRootCerts(const FunctionCallbackInfo& args) { +@@ -1174,7 +1174,7 @@ void SecureContext::AddRootCerts(const FunctionCallbackInfo& args) { void SecureContext::SetCipherSuites(const FunctionCallbackInfo& args) { // BoringSSL doesn't allow API config of TLS1.3 cipher suites. @@ -61,5 +61,5 @@ index bef98b3e24..d46730c9ba 100644 namespace crypto { -- -2.33.1 +2.36.1 diff --git a/SOURCES/0002-Use-OpenSSL-1.0-API.patch b/SOURCES/0002-Use-OpenSSL-1.0-API.patch index 24d2554..9d962a7 100644 --- a/SOURCES/0002-Use-OpenSSL-1.0-API.patch +++ b/SOURCES/0002-Use-OpenSSL-1.0-API.patch @@ -1,7 +1,7 @@ -From e3830b75429a24e10939323941074ce9fa938e73 Mon Sep 17 00:00:00 2001 +From 58e2804cb0802a751f3b4069252b904eedf17f56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= -Date: Wed, 7 Jul 2021 13:37:46 +0200 -Subject: [PATCH 2/7] Use OpenSSL 1.0 API +Date: Wed, 13 Jul 2022 14:26:36 +0200 +Subject: [PATCH] Use OpenSSL 1.0 API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -27,19 +27,21 @@ Content-Transfer-Encoding: 8bit - Return const char from SSL_CIPHER_get_version +- Use non-const signature for X509 name functions + Signed-off-by: Jan Staněk --- src/node_crypto.cc | 26 ++++++++++++++++++++++++-- src/node_crypto.h | 4 ++++ src/node_crypto_bio.cc | 4 ++++ - src/node_crypto_common.cc | 10 +++++++++- - 4 files changed, 41 insertions(+), 3 deletions(-) + src/node_crypto_common.cc | 14 +++++++++++--- + 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc -index 798568bb8f..d246132209 100644 +index d7c7d06646..de8b26930b 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc -@@ -127,7 +127,11 @@ template int SSLWrap::SetCACerts(SecureContext* sc); +@@ -133,7 +133,11 @@ template int SSLWrap::SetCACerts(SecureContext* sc); template void SSLWrap::MemoryInfo(MemoryTracker* tracker) const; template SSL_SESSION* SSLWrap::GetSessionCallback( SSL* s, @@ -51,7 +53,7 @@ index 798568bb8f..d246132209 100644 int len, int* copy); template int SSLWrap::NewSessionCallback(SSL* s, -@@ -1769,7 +1773,11 @@ void SSLWrap::ConfigureSecureContext(SecureContext* sc) { +@@ -1785,7 +1789,11 @@ void SSLWrap::ConfigureSecureContext(SecureContext* sc) { template SSL_SESSION* SSLWrap::GetSessionCallback(SSL* s, @@ -63,7 +65,7 @@ index 798568bb8f..d246132209 100644 int len, int* copy) { Base* w = static_cast(SSL_get_app_data(s)); -@@ -5898,9 +5906,23 @@ struct PBKDF2Job : public CryptoJob { +@@ -5908,9 +5916,23 @@ struct PBKDF2Job : public CryptoJob { } inline void DoThreadPoolWork() override { @@ -122,10 +124,10 @@ index 8c58e31f86..319580c9b6 100644 NodeBIO::FromBIO(bio.get())->env_ = env; return bio; diff --git a/src/node_crypto_common.cc b/src/node_crypto_common.cc -index 6473b652ac..da1033fdef 100644 +index d43e5af2b5..7d313dd3df 100644 --- a/src/node_crypto_common.cc +++ b/src/node_crypto_common.cc -@@ -405,7 +405,15 @@ MaybeLocal GetCipherStandardName( +@@ -337,7 +337,15 @@ MaybeLocal GetCipherStandardName( } MaybeLocal GetCipherVersion(Environment* env, const SSL_CIPHER* cipher) { @@ -142,6 +144,24 @@ index 6473b652ac..da1033fdef 100644 } StackOfX509 CloneSSLCerts(X509Pointer&& cert, +@@ -845,7 +853,7 @@ v8::MaybeLocal GetInfoAccessString( + return ToV8Value(env, bio); + } + +-template ++template + static MaybeLocal GetX509NameObject(Environment* env, X509* cert) { + X509_NAME* name = get_name(cert); + CHECK_NOT_NULL(name); +@@ -868,7 +876,7 @@ static MaybeLocal GetX509NameObject(Environment* env, X509* cert) { + // anyway, and multi-value RDNs are rare, i.e., the vast majority of + // Relative Distinguished Names contains a single type-value pair only. + const ASN1_OBJECT* type = X509_NAME_ENTRY_get_object(entry); +- const ASN1_STRING* value = X509_NAME_ENTRY_get_data(entry); ++ ASN1_STRING* value = X509_NAME_ENTRY_get_data(entry); + + // If OpenSSL knows the type, use the short name of the type as the key, and + // the numeric representation of the type's OID otherwise. -- -2.33.1 +2.36.1 diff --git a/SOURCES/0003-Backport-necessary-OpenSSL-features.patch b/SOURCES/0003-Backport-necessary-OpenSSL-features.patch index 35735a2..977b643 100644 --- a/SOURCES/0003-Backport-necessary-OpenSSL-features.patch +++ b/SOURCES/0003-Backport-necessary-OpenSSL-features.patch @@ -1,7 +1,7 @@ -From 8c2d8893a51440e20c2e3c22f8981b64cf4fd643 Mon Sep 17 00:00:00 2001 +From 683dd65f2b3dd67e64ef4d4aaadf390d08b481aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= -Date: Wed, 7 Jul 2021 13:37:47 +0200 -Subject: [PATCH 3/7] Backport necessary OpenSSL features +Date: Wed, 13 Jul 2022 14:27:40 +0200 +Subject: [PATCH] Backport necessary OpenSSL features MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -52,10 +52,10 @@ Signed-off-by: Jan Staněk 2 files changed, 184 insertions(+), 26 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc -index d246132209..81ac3b5dd4 100644 +index de8b26930b..975a148fc8 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc -@@ -541,6 +541,11 @@ inline void SecureContext::Reset() { +@@ -557,6 +557,11 @@ inline void SecureContext::Reset() { ctx_.reset(); cert_.reset(); issuer_.reset(); @@ -67,7 +67,7 @@ index d246132209..81ac3b5dd4 100644 } SecureContext::~SecureContext() { -@@ -554,7 +559,11 @@ void SecureContext::New(const FunctionCallbackInfo& args) { +@@ -570,7 +575,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. @@ -79,7 +79,7 @@ index d246132209..81ac3b5dd4 100644 void SecureContext::Init(const FunctionCallbackInfo& args) { SecureContext* sc; -@@ -609,38 +618,23 @@ void SecureContext::Init(const FunctionCallbackInfo& args) { +@@ -625,38 +634,23 @@ void SecureContext::Init(const FunctionCallbackInfo& args) { max_version = MAX_SUPPORTED_VERSION; method = TLS_client_method(); } else if (sslmethod == "TLSv1_method") { @@ -127,7 +127,7 @@ index d246132209..81ac3b5dd4 100644 } else { const std::string msg("Unknown method: "); THROW_ERR_TLS_INVALID_PROTOCOL_METHOD(env, (msg + * sslmethod).c_str()); -@@ -670,8 +664,14 @@ void SecureContext::Init(const FunctionCallbackInfo& args) { +@@ -686,8 +680,14 @@ void SecureContext::Init(const FunctionCallbackInfo& args) { SSL_SESS_CACHE_NO_INTERNAL | SSL_SESS_CACHE_NO_AUTO_CLEAR); @@ -142,7 +142,7 @@ index d246132209..81ac3b5dd4 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 -@@ -1216,6 +1216,10 @@ void SecureContext::SetECDHCurve(const FunctionCallbackInfo& args) { +@@ -1232,6 +1232,10 @@ void SecureContext::SetECDHCurve(const FunctionCallbackInfo& args) { THROW_AND_RETURN_IF_NOT_STRING(env, args[0], "ECDH curve name"); node::Utf8Value curve(env->isolate(), args[0]); @@ -153,7 +153,7 @@ index d246132209..81ac3b5dd4 100644 if (strcmp(*curve, "auto") == 0) return; -@@ -1267,6 +1271,65 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo& args) { +@@ -1283,6 +1287,65 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo& args) { return env->ThrowTypeError("Error setting temp DH parameter"); } @@ -219,7 +219,7 @@ index d246132209..81ac3b5dd4 100644 void SecureContext::SetMinProto(const FunctionCallbackInfo& args) { SecureContext* sc; -@@ -1277,7 +1340,12 @@ void SecureContext::SetMinProto(const FunctionCallbackInfo& args) { +@@ -1293,7 +1356,12 @@ void SecureContext::SetMinProto(const FunctionCallbackInfo& args) { int version = args[0].As()->Value(); @@ -232,7 +232,7 @@ index d246132209..81ac3b5dd4 100644 } -@@ -1290,7 +1358,12 @@ void SecureContext::SetMaxProto(const FunctionCallbackInfo& args) { +@@ -1306,7 +1374,12 @@ void SecureContext::SetMaxProto(const FunctionCallbackInfo& args) { int version = args[0].As()->Value(); @@ -245,7 +245,7 @@ index d246132209..81ac3b5dd4 100644 } -@@ -1301,7 +1374,11 @@ void SecureContext::GetMinProto(const FunctionCallbackInfo& args) { +@@ -1317,7 +1390,11 @@ void SecureContext::GetMinProto(const FunctionCallbackInfo& args) { CHECK_EQ(args.Length(), 0); long version = // NOLINT(runtime/int) @@ -257,7 +257,7 @@ index d246132209..81ac3b5dd4 100644 args.GetReturnValue().Set(static_cast(version)); } -@@ -1313,11 +1390,14 @@ void SecureContext::GetMaxProto(const FunctionCallbackInfo& args) { +@@ -1329,11 +1406,14 @@ void SecureContext::GetMaxProto(const FunctionCallbackInfo& args) { CHECK_EQ(args.Length(), 0); long version = // NOLINT(runtime/int) @@ -273,7 +273,7 @@ index d246132209..81ac3b5dd4 100644 void SecureContext::SetOptions(const FunctionCallbackInfo& args) { SecureContext* sc; ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); -@@ -6873,8 +6953,72 @@ void TimingSafeEqual(const FunctionCallbackInfo& args) { +@@ -6883,8 +6963,72 @@ void TimingSafeEqual(const FunctionCallbackInfo& args) { CRYPTO_memcmp(buf1.data(), buf2.data(), buf1.length()) == 0); } @@ -373,5 +373,5 @@ index dbc46fbec8..d27125042b 100644 // SSLWrap implicitly depends on the inheriting class' handle having an -- -2.33.1 +2.36.1 diff --git a/SOURCES/0004-Disable-unsupported-OpenSSL-features.patch b/SOURCES/0004-Disable-unsupported-OpenSSL-features.patch index dbec230..68af894 100644 --- a/SOURCES/0004-Disable-unsupported-OpenSSL-features.patch +++ b/SOURCES/0004-Disable-unsupported-OpenSSL-features.patch @@ -1,7 +1,7 @@ -From 76a36980372b8dbf82a0ada18a1ebae3d94c5fa0 Mon Sep 17 00:00:00 2001 +From 4ba04fcbfd74f9b214c6dd25d82dad5a87cf8465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= -Date: Wed, 7 Jul 2021 13:37:48 +0200 -Subject: [PATCH 4/7] Disable unsupported OpenSSL features +Date: Wed, 13 Jul 2022 14:30:43 +0200 +Subject: [PATCH] Disable unsupported OpenSSL features MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -31,28 +31,96 @@ Content-Transfer-Encoding: 8bit The expected semantics is the same as using the regular versions, so the possibility of using the secure heap was simply removed. +- Revert "src,deps,build,test: add OpenSSL config appname" + + This reverts commit 8e8aef836cb9807c9fe5ca350f1e7febdb40c3a7. + Signed-off-by: Jan Staněk --- - doc/api/cli.md | 18 ------------------ - doc/api/tls.md | 15 +++++++-------- - src/env.h | 11 ++++++++++- - src/node_crypto.cc | 8 ++++++-- - src/node_crypto_common.cc | 12 ++++++++++++ - src/node_crypto_common.h | 6 ++++++ - src/node_options.cc | 10 +++++++++- - .../test-tls-cli-max-version-1.3.js | 0 - .../test-tls-cli-min-max-conflict.js | 0 - .../test-tls-cli-min-version-1.3.js | 0 - 10 files changed, 50 insertions(+), 30 deletions(-) + BUILDING.md | 14 ------ + configure.py | 8 ---- + doc/api/cli.md | 18 -------- + doc/api/tls.md | 15 +++---- + src/env.h | 11 ++++- + src/node.cc | 43 ------------------- + src/node_crypto.cc | 8 +++- + src/node_crypto_common.cc | 12 ++++++ + src/node_crypto_common.h | 6 +++ + src/node_options.cc | 10 ++++- + test/fixtures/openssl_fips_disabled.cnf | 2 +- + test/fixtures/openssl_fips_enabled.cnf | 2 +- + .../test-tls-cli-max-version-1.3.js | 0 + .../test-tls-cli-min-max-conflict.js | 0 + .../test-tls-cli-min-version-1.3.js | 0 + test/parallel/test-crypto-fips.js | 2 +- + 16 files changed, 53 insertions(+), 98 deletions(-) rename test/{parallel => known_issues}/test-tls-cli-max-version-1.3.js (100%) rename test/{parallel => known_issues}/test-tls-cli-min-max-conflict.js (100%) rename test/{parallel => known_issues}/test-tls-cli-min-version-1.3.js (100%) +diff --git a/BUILDING.md b/BUILDING.md +index 0ae3c09d99..5d2459eb76 100644 +--- a/BUILDING.md ++++ b/BUILDING.md +@@ -52,7 +52,6 @@ file a new issue. + * [Build with a specific ICU](#build-with-a-specific-icu) + * [Unix/macOS](#unixmacos-3) + * [Windows](#windows-4) +-* [Configuring OpenSSL config appname](#configure-openssl-appname) + * [Building Node.js with FIPS-compliant OpenSSL](#building-nodejs-with-fips-compliant-openssl) + * [Building Node.js with external core modules](#building-nodejs-with-external-core-modules) + * [Unix/macOS](#unixmacos-4) +@@ -767,19 +766,6 @@ as `deps/icu` (You'll have: `deps/icu/source/...`) + > .\vcbuild full-icu + ``` + +-### Configure OpenSSL appname +- +-Node.js can use an OpenSSL configuration file by specifying the environment +-variable `OPENSSL_CONF`, or using the command line option `--openssl-conf`, and +-if none of those are specified will default to reading the default OpenSSL +-configuration file `openssl.cnf`. Node.js will only read a section that is by +-default named `nodejs_conf`, but this name can be overridden using the following +-configure option: +- +-```console +-$ ./configure --openssl-conf-name= +-``` +- + ## Building Node.js with FIPS-compliant OpenSSL + + The current version of Node.js does not support FIPS. +diff --git a/configure.py b/configure.py +index 892e1d4202..2ea4eb69f5 100755 +--- a/configure.py ++++ b/configure.py +@@ -176,12 +176,6 @@ parser.add_option("--link-module", + "e.g. /root/x/y.js will be referenced via require('root/x/y'). " + "Can be used multiple times") + +-parser.add_option("--openssl-conf-name", +- action="store", +- dest="openssl_conf_name", +- default='nodejs_conf', +- help="The OpenSSL config appname (config section name) used by Node.js") +- + parser.add_option('--openssl-default-cipher-list', + action='store', + dest='openssl_default_cipher_list', +@@ -1343,8 +1337,6 @@ def configure_openssl(o): + if options.openssl_no_asm: + variables['openssl_no_asm'] = 1 + +- o['defines'] += ['NODE_OPENSSL_CONF_NAME=' + options.openssl_conf_name] +- + if options.without_ssl: + def without_ssl_error(option): + error('--without-ssl is incompatible with %s' % option) diff --git a/doc/api/cli.md b/doc/api/cli.md -index 3f3e5e4eeb..48e51fcdfa 100644 +index ff5dff244e..61bac086bf 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md -@@ -893,14 +893,6 @@ added: +@@ -902,14 +902,6 @@ added: Set [`tls.DEFAULT_MAX_VERSION`][] to 'TLSv1.2'. Use to disable support for TLSv1.3. @@ -67,7 +135,7 @@ index 3f3e5e4eeb..48e51fcdfa 100644 ### `--tls-min-v1.0` - --Enable FIPS-compliant crypto at startup. (Requires Node.js to be built with --`./configure --openssl-fips`.) -+Enable FIPS-compliant crypto at startup. (Requires Node.js to be built -+against FIPS-compatible OpenSSL.) - - ### `--enable-source-maps` - - - Load an OpenSSL configuration file on startup. Among other uses, this can be --used to enable FIPS-compliant crypto if Node.js is built with --`./configure --openssl-fips`. -+used to enable FIPS-compliant crypto if Node.js is built -+against FIPS-enabled OpenSSL. - - ### `--pending-deprecation` -