diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d99edf1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +SOURCES/node-ssl-shim-6fc0b05.tar.gz +SOURCES/node-v14.15.0-stripped.tar.gz diff --git a/.rh-nodejs14-nodejs.metadata b/.rh-nodejs14-nodejs.metadata new file mode 100644 index 0000000..250715c --- /dev/null +++ b/.rh-nodejs14-nodejs.metadata @@ -0,0 +1,2 @@ +9fe6761bd237af8be0e4d26184c5a01e01d7967d SOURCES/node-ssl-shim-6fc0b05.tar.gz +fdc54e8dbaec8f3a477e9708a3299a40e995eb91 SOURCES/node-v14.15.0-stripped.tar.gz diff --git a/SOURCES/0001-Link-with-ssl-shim.patch b/SOURCES/0001-Link-with-ssl-shim.patch new file mode 100644 index 0000000..87c7f13 --- /dev/null +++ b/SOURCES/0001-Link-with-ssl-shim.patch @@ -0,0 +1,65 @@ +From 75268fbb6bbe32db695595e2b30f4600732767ad 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 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Jan Staněk +--- + node.gypi | 10 +++++++--- + src/node_crypto.cc | 2 +- + src/node_crypto.h | 2 ++ + 3 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/node.gypi b/node.gypi +index 43dbda7bbf..070f212d96 100644 +--- a/node.gypi ++++ b/node.gypi +@@ -364,9 +364,13 @@ + ], + }], + ], +- }]] +- +- }, { ++ }], ++ [ 'node_shared_openssl=="true"', { ++ 'include_dirs': ['deps/node-ssl-shim/include'], ++ 'libraries': ['& args) { + + void SecureContext::SetCipherSuites(const FunctionCallbackInfo& args) { + // BoringSSL doesn't allow API config of TLS1.3 cipher suites. +-#ifndef OPENSSL_IS_BORINGSSL ++#if !defined OPENSSL_IS_BORINGSSL && !OPENSSL_IS_LEGACY + SecureContext* sc; + ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); + Environment* env = sc->env(); +diff --git a/src/node_crypto.h b/src/node_crypto.h +index bef98b3e24..d46730c9ba 100644 +--- a/src/node_crypto.h ++++ b/src/node_crypto.h +@@ -42,6 +42,8 @@ + #include + #include + ++#include ++ + namespace node { + namespace crypto { + +-- +2.26.2 + diff --git a/SOURCES/0002-Use-OpenSSL-1.0-API.patch b/SOURCES/0002-Use-OpenSSL-1.0-API.patch new file mode 100644 index 0000000..d5e7561 --- /dev/null +++ b/SOURCES/0002-Use-OpenSSL-1.0-API.patch @@ -0,0 +1,147 @@ +From 779cd3cc604a0efdeba1e0e2bcacab27880675c4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= +Date: Wed, 16 Sep 2020 12:46:38 +0200 +Subject: [PATCH] Use OpenSSL 1.0 API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- Pass non-const pointer to BIO_new + + In legacy OpenSSL, the method parameter for BIO_new is not marked const, + although the function does not need it to be mutable. + This is likely an oversight in the interface. + + The provided "fix" is potentially dangerous, + as casting away `const`-ness is potentially an undefined behaviour. + Since the code around assumes it is constant anyway, + it *should* be fine here – but use with care. + +- Remove const-classifier for SSL_SESSION callback argument + + In legacy OpenSSL, the parameter is expected to be mutable. + Using `const` prevents passing the method as a function pointer + to other OpenSSL API functions. + +- Sanitize inputs into PBKDF2 + +- Return const char from SSL_CIPHER_get_version + +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(-) + +diff --git a/src/node_crypto.cc b/src/node_crypto.cc +index 6118829b43..77940f0dea 100644 +--- a/src/node_crypto.cc ++++ b/src/node_crypto.cc +@@ -124,7 +124,11 @@ template int SSLWrap::SetCACerts(SecureContext* sc); + template void SSLWrap::MemoryInfo(MemoryTracker* tracker) const; + template SSL_SESSION* SSLWrap::GetSessionCallback( + SSL* s, ++#if OPENSSL_IS_LEGACY ++ unsigned char *key, ++#else + const unsigned char* key, ++#endif + int len, + int* copy); + template int SSLWrap::NewSessionCallback(SSL* s, +@@ -1766,7 +1770,11 @@ void SSLWrap::ConfigureSecureContext(SecureContext* sc) { + + template + SSL_SESSION* SSLWrap::GetSessionCallback(SSL* s, ++#if OPENSSL_IS_LEGACY ++ unsigned char* key, ++#else + const unsigned char* key, ++#endif + int len, + int* copy) { + Base* w = static_cast(SSL_get_app_data(s)); +@@ -5895,9 +5903,23 @@ struct PBKDF2Job : public CryptoJob { + } + + inline void DoThreadPoolWork() override { +- auto salt_data = reinterpret_cast(salt.data()); ++ static const char * const empty = ""; ++ ++ auto pass_data = reinterpret_cast(empty); ++ auto pass_size = int(0); ++ auto salt_data = reinterpret_cast(empty); ++ auto salt_size = int(0); ++ ++ if (pass.size() > 0) { ++ pass_data = pass.data(), pass_size = pass.size(); ++ } ++ if (salt.size() > 0) { ++ salt_data = reinterpret_cast(salt.data()); ++ salt_size = salt.size(); ++ } ++ + const bool ok = +- PKCS5_PBKDF2_HMAC(pass.data(), pass.size(), salt_data, salt.size(), ++ PKCS5_PBKDF2_HMAC(pass_data, pass_size, salt_data, salt_size, + iteration_count, digest, keybuf_size, keybuf_data); + success = Just(ok); + Cleanse(); +diff --git a/src/node_crypto.h b/src/node_crypto.h +index d46730c9ba..dbc46fbec8 100644 +--- a/src/node_crypto.h ++++ b/src/node_crypto.h +@@ -235,7 +235,11 @@ class SSLWrap { + static void AddMethods(Environment* env, v8::Local t); + + static SSL_SESSION* GetSessionCallback(SSL* s, ++#if OPENSSL_IS_LEGACY ++ unsigned char* key, ++#else // OPENSSL_IS_LEGACY + const unsigned char* key, ++#endif // OPENSSL_IS_LEGACY + int len, + int* copy); + static int NewSessionCallback(SSL* s, SSL_SESSION* sess); +diff --git a/src/node_crypto_bio.cc b/src/node_crypto_bio.cc +index 8c58e31f86..319580c9b6 100644 +--- a/src/node_crypto_bio.cc ++++ b/src/node_crypto_bio.cc +@@ -32,7 +32,11 @@ namespace node { + namespace crypto { + + BIOPointer NodeBIO::New(Environment* env) { ++#if OPENSSL_IS_LEGACY ++ BIOPointer bio(BIO_new(const_cast(GetMethod()))); ++#else + BIOPointer bio(BIO_new(GetMethod())); ++#endif + 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 6473b652ac..da1033fdef 100644 +--- a/src/node_crypto_common.cc ++++ b/src/node_crypto_common.cc +@@ -405,7 +405,15 @@ MaybeLocal GetCipherStandardName( + } + + MaybeLocal GetCipherVersion(Environment* env, const SSL_CIPHER* cipher) { +- return GetCipherValue(env, cipher, SSL_CIPHER_get_version); ++#if OPENSSL_IS_LEGACY ++ auto get_version = [](const SSL_CIPHER *cipher){ ++ return const_cast(SSL_CIPHER_get_version(cipher)); ++ }; ++#else // OPENSSL_IS_LEGACY ++ auto get_version = SSL_CIPHER_get_version; ++#endif // OPENSSL_IS_LEGACY ++ ++ return GetCipherValue(env, cipher, get_version); + } + + StackOfX509 CloneSSLCerts(X509Pointer&& cert, +-- +2.26.2 + diff --git a/SOURCES/0003-Backport-necessary-OpenSSL-features.patch b/SOURCES/0003-Backport-necessary-OpenSSL-features.patch new file mode 100644 index 0000000..48a8c4f --- /dev/null +++ b/SOURCES/0003-Backport-necessary-OpenSSL-features.patch @@ -0,0 +1,357 @@ +From afdb783c2b6c97e4e8c4a8b69bff4187a1cb4bd2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= +Date: Wed, 16 Sep 2020 12:47:35 +0200 +Subject: [PATCH] Backport necessary OpenSSL features +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- Remove uses of SSL_CTX_{get,set}_{min,max}_proto_version() + + These functions are not provided by OpenSSL v1.0, + and unfortunately cannot be fully re-implemented using available APIs. + +- Implement SSL_{get,set}_{min,max}_proto_version on NodeJS level + + The shim layer cannot provide implementation for the above functions, + as there is no place to store the current boundary information. + Setting them can be simulated by using SSL_CTX options, + but getting them is tricky and starts to fail once the boundaries meet. + + Since Node wraps the secure context in it's own structure, + that structure can be extended to record the last set boundaries, + and then set the appropriate options on the OpenSSL structure. + + This patch is a first draft of this implementation. + The boundaries are stored directly as private members of + `node::crypto::SecureContext`. + In order to actually apply them, a new private `_SyncMinMaxProto()` + method has to be called. + This will modify the option mask of the associated SSL_CTX structure + to match the recorded boundaries. + Use with care! + +- Provide locking mechanism for legacy OpenSSL + + This commit is probably a good candidate for inclusion in the shim, + although probably as some sort of extras – it is not trivial! + +Signed-off-by: Jan Staněk +--- + src/node_crypto.cc | 192 +++++++++++++++++++++++++++++++++++++++------ + src/node_crypto.h | 14 ++++ + 2 files changed, 180 insertions(+), 26 deletions(-) + +diff --git a/src/node_crypto.cc b/src/node_crypto.cc +index 77940f0dea..ff562e3563 100644 +--- a/src/node_crypto.cc ++++ b/src/node_crypto.cc +@@ -538,6 +538,11 @@ inline void SecureContext::Reset() { + ctx_.reset(); + cert_.reset(); + issuer_.reset(); ++ ++#if OPENSSL_IS_LEGACY ++ _min_proto_version = 0; ++ _max_proto_version = 0; ++#endif // OPENSSL_IS_LEGACY + } + + SecureContext::~SecureContext() { +@@ -551,7 +556,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. ++#if OPENSSL_IS_LEGACY ++const int MAX_SUPPORTED_VERSION = TLS1_2_VERSION; ++#else // OPENSSL_IS_LEGACY + const int MAX_SUPPORTED_VERSION = TLS1_3_VERSION; ++#endif // OPENSSL_IS_LEGACY + + void SecureContext::Init(const FunctionCallbackInfo& args) { + SecureContext* sc; +@@ -606,38 +615,23 @@ void SecureContext::Init(const FunctionCallbackInfo& args) { + max_version = MAX_SUPPORTED_VERSION; + method = TLS_client_method(); + } else if (sslmethod == "TLSv1_method") { +- min_version = TLS1_VERSION; +- max_version = TLS1_VERSION; ++ method = TLSv1_method(); + } else if (sslmethod == "TLSv1_server_method") { +- min_version = TLS1_VERSION; +- max_version = TLS1_VERSION; +- method = TLS_server_method(); ++ method = TLSv1_server_method(); + } else if (sslmethod == "TLSv1_client_method") { +- min_version = TLS1_VERSION; +- max_version = TLS1_VERSION; +- method = TLS_client_method(); ++ method = TLSv1_client_method(); + } else if (sslmethod == "TLSv1_1_method") { +- min_version = TLS1_1_VERSION; +- max_version = TLS1_1_VERSION; ++ method = TLSv1_1_method(); + } 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 (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 (sslmethod == "TLSv1_2_method") { +- min_version = TLS1_2_VERSION; +- max_version = TLS1_2_VERSION; ++ method = TLSv1_2_method(); + } 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 (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()); +@@ -667,8 +661,14 @@ void SecureContext::Init(const FunctionCallbackInfo& args) { + SSL_SESS_CACHE_NO_INTERNAL | + SSL_SESS_CACHE_NO_AUTO_CLEAR); + ++#if OPENSSL_IS_LEGACY ++ sc->_min_proto_version = min_version; ++ sc->_max_proto_version = max_version; ++ sc->_SyncMinMaxProto(); ++#else + SSL_CTX_set_min_proto_version(sc->ctx_.get(), min_version); + SSL_CTX_set_max_proto_version(sc->ctx_.get(), max_version); ++#endif // !OPENSSL_IS_LEGACY + + // 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 +@@ -1264,6 +1264,65 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo& args) { + return env->ThrowTypeError("Error setting temp DH parameter"); + } + ++#if OPENSSL_IS_LEGACY ++int SecureContext::_SyncMinMaxProto() { ++ // Node explicitly disables SSLv2 and v3 – do not intefere with that ++ static const auto ALL_SUPPORTED_VERSIONS = ++ SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1 | SSL_OP_NO_TLSv1_2; ++ ++ auto mask = long(0); ++ ++ // Setup minimum version ++ switch (_min_proto_version) { ++ default: return 0; // unsupported version ++ case TLS1_3_VERSION: ++ mask |= SSL_OP_NO_TLSv1_2; ++ [[fallthrough]]; ++ case TLS1_2_VERSION: ++ mask |= SSL_OP_NO_TLSv1_1; ++ [[fallthrough]]; ++ case TLS1_1_VERSION: ++ mask |= SSL_OP_NO_TLSv1; ++ [[fallthrough]]; ++ case TLS1_VERSION: ++ mask |= SSL_OP_NO_SSLv3; ++ [[fallthrough]]; ++ case SSL3_VERSION: ++ mask |= SSL_OP_NO_SSLv2; ++ [[fallthrough]]; ++ case 0: // any supported version ++ break; ++ } ++ ++ // Setup maximum version ++ switch (_max_proto_version) { ++ default: return 0; // unsupported version ++ case SSL3_VERSION: ++ mask |= SSL_OP_NO_TLSv1; ++ [[fallthrough]]; ++ case TLS1_VERSION: ++ mask |= SSL_OP_NO_TLSv1_1; ++ [[fallthrough]]; ++ case TLS1_1_VERSION: ++ mask |= SSL_OP_NO_TLSv1_2; ++ [[fallthrough]]; ++ case TLS1_2_VERSION: ++ // no-op, legacy OpenSSL does not know about TLSv1.3 ++ [[fallthrough]]; ++ case TLS1_3_VERSION: ++ [[fallthrough]]; ++ case 0: // any version ++ break; ++ } ++ ++ // Reset current context mask ++ auto *raw_context = ctx_.get(); ++ SSL_CTX_clear_options(raw_context, ALL_SUPPORTED_VERSIONS); ++ SSL_CTX_set_options(raw_context, mask); ++ ++ return 1; ++} ++#endif // OPENSSL_IS_LEGACY + + void SecureContext::SetMinProto(const FunctionCallbackInfo& args) { + SecureContext* sc; +@@ -1274,7 +1333,12 @@ void SecureContext::SetMinProto(const FunctionCallbackInfo& args) { + + int version = args[0].As()->Value(); + ++#if OPENSSL_IS_LEGACY ++ sc->_min_proto_version = version; ++ CHECK(sc->_SyncMinMaxProto()); ++#else // OPENSSL_IS_LEGACY + CHECK(SSL_CTX_set_min_proto_version(sc->ctx_.get(), version)); ++#endif // OPENSSL_IS_LEGACY + } + + +@@ -1287,7 +1351,12 @@ void SecureContext::SetMaxProto(const FunctionCallbackInfo& args) { + + int version = args[0].As()->Value(); + ++#if OPENSSL_IS_LEGACY ++ sc->_max_proto_version = version; ++ CHECK(sc->_SyncMinMaxProto()); ++#else // OPENSSL_IS_LEGACY + CHECK(SSL_CTX_set_max_proto_version(sc->ctx_.get(), version)); ++#endif // OPENSSL_IS_LEGACY + } + + +@@ -1298,7 +1367,11 @@ void SecureContext::GetMinProto(const FunctionCallbackInfo& args) { + CHECK_EQ(args.Length(), 0); + + long version = // NOLINT(runtime/int) ++#if OPENSSL_IS_LEGACY ++ sc->_min_proto_version; ++#else // OPENSSL_IS_LEGACY + SSL_CTX_get_min_proto_version(sc->ctx_.get()); ++#endif // OPENSSL_IS_LEGACY + args.GetReturnValue().Set(static_cast(version)); + } + +@@ -1310,11 +1383,14 @@ void SecureContext::GetMaxProto(const FunctionCallbackInfo& args) { + CHECK_EQ(args.Length(), 0); + + long version = // NOLINT(runtime/int) ++#if OPENSSL_IS_LEGACY ++ sc->_max_proto_version; ++#else // OPENSSL_IS_LEGACY + SSL_CTX_get_max_proto_version(sc->ctx_.get()); ++#endif // OPENSSL_IS_LEGACY + args.GetReturnValue().Set(static_cast(version)); + } + +- + void SecureContext::SetOptions(const FunctionCallbackInfo& args) { + SecureContext* sc; + ASSIGN_OR_RETURN_UNWRAP(&sc, args.Holder()); +@@ -6870,8 +6946,72 @@ void TimingSafeEqual(const FunctionCallbackInfo& args) { + CRYPTO_memcmp(buf1.data(), buf2.data(), buf1.length()) == 0); + } + ++ ++#if OPENSSL_IS_LEGACY ++// Array of mutexes provided for OpenSSL internal use ++static std::unique_ptr openssl_lock_array = nullptr; ++ ++// OpenSSL callback – lock/unlock a mutex ++static void openssl_lock_callback( ++ int mode, int which, const char *file [[maybe_unused]], int line [[maybe_unused]]) ++{ ++ // Exactly one of CRYPTO_LOCK or CRYPTO_UNLOCK is set ++ CHECK(!(mode & CRYPTO_LOCK) ^ !(mode & CRYPTO_UNLOCK)); ++ // Exactly one of CRYPTO_READ or CRYPTO_WRITE is set ++ CHECK(!(mode & CRYPTO_READ) ^ !(mode & CRYPTO_WRITE)); ++ // FIXME: No easy way to make a array bounds check ++ ++ auto mtx = &openssl_lock_array[which]; ++ if (mode & CRYPTO_LOCK) { ++ mtx->Lock(); ++ } else { ++ mtx->Unlock(); ++ } ++} ++ ++// OpenSSL callback - retrieve current thread ID ++static void openssl_threadid_callback(CRYPTO_THREADID *thread_id) { ++ static_assert(sizeof (uv_thread_t) <= sizeof (void *), "uv_thread_t does not fit in a pointer"); ++ CRYPTO_THREADID_set_pointer(thread_id, reinterpret_cast(uv_thread_self())); ++} ++ ++// Initialize (reset) the provided locking mechanism ++static void openssl_reset_locking() { ++ openssl_lock_array = std::make_unique(CRYPTO_num_locks()); ++ ++ CRYPTO_THREADID_set_callback(openssl_threadid_callback); ++ CRYPTO_set_locking_callback(openssl_lock_callback); ++} ++ ++#endif // OPENSSL_IS_LEGACY ++ + void InitCryptoOnce() { +-#ifndef OPENSSL_IS_BORINGSSL ++#if defined(OPENSSL_IS_BORINGSSL) || OPENSSL_IS_LEGACY ++ SSL_load_error_strings(); ++ OPENSSL_no_config(); ++ ++ if (!per_process::cli_options->openssl_config.empty()) { ++ OPENSSL_load_builtin_modules(); ++#ifndef OPENSSL_NO_ENGINE ++ ENGINE_load_builtin_engines(); ++#endif // OPENSSL_NO_ENGINE ++ ERR_clear_error(); ++ ++ const char *conf_path = per_process::cli_options->openssl_config.c_str(); ++ CONF_modules_load_file(conf_path, nullptr, CONF_MFLAGS_DEFAULT_SECTION); ++ auto err = ERR_get_error(); ++ if (err != 0) { ++ fprintf(stderr, "openssl config failed: %s\n", ERR_error_string(err, nullptr)); ++ CHECK_NE(err, 0); ++ } ++ } ++ ++ // Initialize OpenSSL library ++ SSL_library_init(); ++ OpenSSL_add_all_algorithms(); ++ // Provide mutex array for OpenSSL ++ openssl_reset_locking(); ++#else + OPENSSL_INIT_SETTINGS* settings = OPENSSL_INIT_new(); + + // --openssl-config=... +diff --git a/src/node_crypto.h b/src/node_crypto.h +index dbc46fbec8..d27125042b 100644 +--- a/src/node_crypto.h ++++ b/src/node_crypto.h +@@ -183,6 +183,20 @@ class SecureContext final : public BaseObject { + + SecureContext(Environment* env, v8::Local wrap); + void Reset(); ++ ++#if OPENSSL_IS_LEGACY ++ private: ++ // Legacy OpenSSL does not store min-max allowed versions of SSL/TLS; ++ // instead it relies on flags and enabling/disabling specific versions. ++ // ++ // In order to provide enough information for *getting* the allowed ++ // versions last set, record the boundaries on our secure context. ++ int _min_proto_version = 0; ++ int _max_proto_version = 0; ++ ++ /** Sync _{min,max}_proto_version to wrapped context. */ ++ int _SyncMinMaxProto(); ++#endif // OPENSSL_IS_LEGACY + }; + + // SSLWrap implicitly depends on the inheriting class' handle having an +-- +2.26.2 + diff --git a/SOURCES/0004-Disable-unsupported-OpenSSL-features.patch b/SOURCES/0004-Disable-unsupported-OpenSSL-features.patch new file mode 100644 index 0000000..7319353 --- /dev/null +++ b/SOURCES/0004-Disable-unsupported-OpenSSL-features.patch @@ -0,0 +1,354 @@ +From 86227ed377d723a157bcd95ffb39bc14900a8576 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= +Date: Wed, 16 Sep 2020 12:49:21 +0200 +Subject: [PATCH] Disable unsupported OpenSSL features +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- Disable no-certificate PSK authentication + + There is no obvious way to reimplement it using only OpenSSL 1.0 public APIs. + +- Disable queries for standard cipher name + + OpenSSL 1.0 does not record said names. + +- Remove ClientHello getters + + The disabled functions internally use + `SSL_client_hello_get0_ext`/`SSL_client_hello_get0_ciphers`, + which are not available on legacy OpenSSL. + There may be another way to get to the same data, + but nothing jumps out in the OpenSSL 1.0.2 documentation. + +- Remove TLSv1.3 CLI options + +Signed-off-by: Jan Staněk +--- + doc/api/cli.md | 18 ------------------ + doc/api/tls.md | 15 +++++++-------- + src/env.h | 11 ++++++++++- + 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 + 9 files changed, 44 insertions(+), 28 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/doc/api/cli.md b/doc/api/cli.md +index 0112319a3a..eb39adfd16 100644 +--- a/doc/api/cli.md ++++ b/doc/api/cli.md +@@ -806,14 +806,6 @@ added: + Set [`tls.DEFAULT_MAX_VERSION`][] to 'TLSv1.2'. Use to disable support for + TLSv1.3. + +-### `--tls-max-v1.3` +- +- +-Set default [`tls.DEFAULT_MAX_VERSION`][] to 'TLSv1.3'. Use to enable support +-for TLSv1.3. +- + ### `--tls-min-v1.0` + +- +-Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1.3'. Use to disable support +-for TLSv1.2, which is not as secure as TLSv1.3. +- + ### `--trace-atomics-wait` +