|
|
4fb6d9 |
From 38ed745edf7725660c59c9db63ad722aee126487 Mon Sep 17 00:00:00 2001
|
|
|
3f476a |
From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= <jstanek@redhat.com>
|
|
|
effb77 |
Date: Wed, 13 Jul 2022 14:30:43 +0200
|
|
|
effb77 |
Subject: [PATCH] Disable unsupported OpenSSL features
|
|
|
3f476a |
MIME-Version: 1.0
|
|
|
3f476a |
Content-Type: text/plain; charset=UTF-8
|
|
|
3f476a |
Content-Transfer-Encoding: 8bit
|
|
|
3f476a |
|
|
|
3f476a |
- Disable no-certificate PSK authentication
|
|
|
3f476a |
|
|
|
3f476a |
There is no obvious way to reimplement it using only OpenSSL 1.0 public APIs.
|
|
|
3f476a |
|
|
|
3f476a |
- Disable queries for standard cipher name
|
|
|
3f476a |
|
|
|
3f476a |
OpenSSL 1.0 does not record said names.
|
|
|
3f476a |
|
|
|
3f476a |
- Remove ClientHello getters
|
|
|
3f476a |
|
|
|
3f476a |
The disabled functions internally use
|
|
|
3f476a |
`SSL_client_hello_get0_ext`/`SSL_client_hello_get0_ciphers`,
|
|
|
3f476a |
which are not available on legacy OpenSSL.
|
|
|
3f476a |
There may be another way to get to the same data,
|
|
|
3f476a |
but nothing jumps out in the OpenSSL 1.0.2 documentation.
|
|
|
3f476a |
|
|
|
3f476a |
- Remove TLSv1.3 CLI options
|
|
|
3f476a |
|
|
|
9500a8 |
- Remove usage of OPENSSL_secure_{malloc,clear_free}
|
|
|
9500a8 |
|
|
|
9500a8 |
Unsupported in OpenSSL 1.0.
|
|
|
9500a8 |
|
|
|
9500a8 |
The expected semantics is the same as using the regular versions,
|
|
|
9500a8 |
so the possibility of using the secure heap was simply removed.
|
|
|
9500a8 |
|
|
|
effb77 |
- Revert "src,deps,build,test: add OpenSSL config appname"
|
|
|
effb77 |
|
|
|
effb77 |
This reverts commit 8e8aef836cb9807c9fe5ca350f1e7febdb40c3a7.
|
|
|
effb77 |
|
|
|
3f476a |
Signed-off-by: Jan Staněk <jstanek@redhat.com>
|
|
|
4fb6d9 |
Signed-off-by: rpm-build <rpm-build>
|
|
|
3f476a |
---
|
|
|
effb77 |
BUILDING.md | 14 ------
|
|
|
effb77 |
configure.py | 8 ----
|
|
|
4fb6d9 |
doc/api/cli.md | 18 -------
|
|
|
4fb6d9 |
doc/api/tls.md | 15 +++---
|
|
|
effb77 |
src/env.h | 11 ++++-
|
|
|
4fb6d9 |
src/node.cc | 48 -------------------
|
|
|
effb77 |
src/node_crypto.cc | 8 +++-
|
|
|
4fb6d9 |
src/node_crypto_common.cc | 12 +++++
|
|
|
effb77 |
src/node_crypto_common.h | 6 +++
|
|
|
4fb6d9 |
src/node_options.cc | 10 +++-
|
|
|
effb77 |
test/fixtures/openssl_fips_disabled.cnf | 2 +-
|
|
|
effb77 |
test/fixtures/openssl_fips_enabled.cnf | 2 +-
|
|
|
effb77 |
.../test-tls-cli-max-version-1.3.js | 0
|
|
|
effb77 |
.../test-tls-cli-min-max-conflict.js | 0
|
|
|
effb77 |
.../test-tls-cli-min-version-1.3.js | 0
|
|
|
effb77 |
test/parallel/test-crypto-fips.js | 2 +-
|
|
|
4fb6d9 |
16 files changed, 53 insertions(+), 103 deletions(-)
|
|
|
3f476a |
rename test/{parallel => known_issues}/test-tls-cli-max-version-1.3.js (100%)
|
|
|
3f476a |
rename test/{parallel => known_issues}/test-tls-cli-min-max-conflict.js (100%)
|
|
|
3f476a |
rename test/{parallel => known_issues}/test-tls-cli-min-version-1.3.js (100%)
|
|
|
3f476a |
|
|
|
effb77 |
diff --git a/BUILDING.md b/BUILDING.md
|
|
|
4fb6d9 |
index 0ae3c09..5d2459e 100644
|
|
|
effb77 |
--- a/BUILDING.md
|
|
|
effb77 |
+++ b/BUILDING.md
|
|
|
effb77 |
@@ -52,7 +52,6 @@ file a new issue.
|
|
|
effb77 |
* [Build with a specific ICU](#build-with-a-specific-icu)
|
|
|
effb77 |
* [Unix/macOS](#unixmacos-3)
|
|
|
effb77 |
* [Windows](#windows-4)
|
|
|
effb77 |
-* [Configuring OpenSSL config appname](#configure-openssl-appname)
|
|
|
effb77 |
* [Building Node.js with FIPS-compliant OpenSSL](#building-nodejs-with-fips-compliant-openssl)
|
|
|
effb77 |
* [Building Node.js with external core modules](#building-nodejs-with-external-core-modules)
|
|
|
effb77 |
* [Unix/macOS](#unixmacos-4)
|
|
|
effb77 |
@@ -767,19 +766,6 @@ as `deps/icu` (You'll have: `deps/icu/source/...`)
|
|
|
effb77 |
> .\vcbuild full-icu
|
|
|
effb77 |
```
|
|
|
effb77 |
|
|
|
effb77 |
-### Configure OpenSSL appname
|
|
|
effb77 |
-
|
|
|
effb77 |
-Node.js can use an OpenSSL configuration file by specifying the environment
|
|
|
effb77 |
-variable `OPENSSL_CONF`, or using the command line option `--openssl-conf`, and
|
|
|
effb77 |
-if none of those are specified will default to reading the default OpenSSL
|
|
|
effb77 |
-configuration file `openssl.cnf`. Node.js will only read a section that is by
|
|
|
effb77 |
-default named `nodejs_conf`, but this name can be overridden using the following
|
|
|
effb77 |
-configure option:
|
|
|
effb77 |
-
|
|
|
effb77 |
-```console
|
|
|
effb77 |
-$ ./configure --openssl-conf-name=<some_conf_name>
|
|
|
effb77 |
-```
|
|
|
effb77 |
-
|
|
|
effb77 |
## Building Node.js with FIPS-compliant OpenSSL
|
|
|
effb77 |
|
|
|
effb77 |
The current version of Node.js does not support FIPS.
|
|
|
effb77 |
diff --git a/configure.py b/configure.py
|
|
|
4fb6d9 |
index 892e1d4..2ea4eb6 100755
|
|
|
effb77 |
--- a/configure.py
|
|
|
effb77 |
+++ b/configure.py
|
|
|
effb77 |
@@ -176,12 +176,6 @@ parser.add_option("--link-module",
|
|
|
effb77 |
"e.g. /root/x/y.js will be referenced via require('root/x/y'). "
|
|
|
effb77 |
"Can be used multiple times")
|
|
|
effb77 |
|
|
|
effb77 |
-parser.add_option("--openssl-conf-name",
|
|
|
effb77 |
- action="store",
|
|
|
effb77 |
- dest="openssl_conf_name",
|
|
|
effb77 |
- default='nodejs_conf',
|
|
|
effb77 |
- help="The OpenSSL config appname (config section name) used by Node.js")
|
|
|
effb77 |
-
|
|
|
effb77 |
parser.add_option('--openssl-default-cipher-list',
|
|
|
effb77 |
action='store',
|
|
|
effb77 |
dest='openssl_default_cipher_list',
|
|
|
effb77 |
@@ -1343,8 +1337,6 @@ def configure_openssl(o):
|
|
|
effb77 |
if options.openssl_no_asm:
|
|
|
effb77 |
variables['openssl_no_asm'] = 1
|
|
|
effb77 |
|
|
|
effb77 |
- o['defines'] += ['NODE_OPENSSL_CONF_NAME=' + options.openssl_conf_name]
|
|
|
effb77 |
-
|
|
|
effb77 |
if options.without_ssl:
|
|
|
effb77 |
def without_ssl_error(option):
|
|
|
effb77 |
error('--without-ssl is incompatible with %s' % option)
|
|
|
3f476a |
diff --git a/doc/api/cli.md b/doc/api/cli.md
|
|
|
4fb6d9 |
index 92cf190..a6a77ea 100644
|
|
|
3f476a |
--- a/doc/api/cli.md
|
|
|
3f476a |
+++ b/doc/api/cli.md
|
|
|
4fb6d9 |
@@ -917,14 +917,6 @@ added:
|
|
|
3f476a |
Set [`tls.DEFAULT_MAX_VERSION`][] to 'TLSv1.2'. Use to disable support for
|
|
|
3f476a |
TLSv1.3.
|
|
|
3f476a |
|
|
|
3f476a |
-### `--tls-max-v1.3`
|
|
|
3f476a |
-
|
|
|
3f476a |
-added: v12.0.0
|
|
|
3f476a |
--->
|
|
|
3f476a |
-
|
|
|
3f476a |
-Set default [`tls.DEFAULT_MAX_VERSION`][] to 'TLSv1.3'. Use to enable support
|
|
|
3f476a |
-for TLSv1.3.
|
|
|
3f476a |
-
|
|
|
3f476a |
### `--tls-min-v1.0`
|
|
|
3f476a |
|
|
|
3f476a |
added:
|
|
|
4fb6d9 |
@@ -956,14 +948,6 @@ Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1.2'. This is the default for
|
|
|
3f476a |
12.x and later, but the option is supported for compatibility with older Node.js
|
|
|
3f476a |
versions.
|
|
|
3f476a |
|
|
|
3f476a |
-### `--tls-min-v1.3`
|
|
|
3f476a |
-
|
|
|
3f476a |
-added: v12.0.0
|
|
|
3f476a |
--->
|
|
|
3f476a |
-
|
|
|
3f476a |
-Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1.3'. Use to disable support
|
|
|
3f476a |
-for TLSv1.2, which is not as secure as TLSv1.3.
|
|
|
3f476a |
-
|
|
|
3f476a |
### `--trace-atomics-wait`
|
|
|
3f476a |
|
|
|
3f476a |
added: v14.3.0
|
|
|
4fb6d9 |
@@ -1407,11 +1391,9 @@ Node.js options that are allowed are:
|
|
|
3f476a |
* `--tls-cipher-list`
|
|
|
3f476a |
* `--tls-keylog`
|
|
|
3f476a |
* `--tls-max-v1.2`
|
|
|
3f476a |
-* `--tls-max-v1.3`
|
|
|
3f476a |
* `--tls-min-v1.0`
|
|
|
3f476a |
* `--tls-min-v1.1`
|
|
|
3f476a |
* `--tls-min-v1.2`
|
|
|
3f476a |
-* `--tls-min-v1.3`
|
|
|
3f476a |
* `--trace-atomics-wait`
|
|
|
3f476a |
* `--trace-deprecation`
|
|
|
3f476a |
* `--trace-event-categories`
|
|
|
3f476a |
diff --git a/doc/api/tls.md b/doc/api/tls.md
|
|
|
4fb6d9 |
index 271dd09..0e8125f 100644
|
|
|
3f476a |
--- a/doc/api/tls.md
|
|
|
3f476a |
+++ b/doc/api/tls.md
|
|
|
effb77 |
@@ -1988,10 +1988,10 @@ added: v11.4.0
|
|
|
3f476a |
|
|
|
3f476a |
* {string} The default value of the `maxVersion` option of
|
|
|
3f476a |
[`tls.createSecureContext()`][]. It can be assigned any of the supported TLS
|
|
|
3f476a |
- protocol versions, `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`.
|
|
|
3f476a |
- **Default:** `'TLSv1.3'`, unless changed using CLI options. Using
|
|
|
3f476a |
- `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using `--tls-max-v1.3` sets
|
|
|
3f476a |
- the default to `'TLSv1.3'`. If multiple of the options are provided, the
|
|
|
3f476a |
+ protocol versions, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`.
|
|
|
3f476a |
+ **Default:** `'TLSv1.2'`, unless changed using CLI options. Using
|
|
|
3f476a |
+ `--tls-max-v1.2` sets the default to `'TLSv1.2'`.
|
|
|
3f476a |
+ If multiple of the options are provided, the
|
|
|
3f476a |
highest maximum is used.
|
|
|
3f476a |
|
|
|
3f476a |
## `tls.DEFAULT_MIN_VERSION`
|
|
|
effb77 |
@@ -2001,12 +2001,11 @@ added: v11.4.0
|
|
|
3f476a |
|
|
|
3f476a |
* {string} The default value of the `minVersion` option of
|
|
|
3f476a |
[`tls.createSecureContext()`][]. It can be assigned any of the supported TLS
|
|
|
3f476a |
- protocol versions, `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`.
|
|
|
3f476a |
+ protocol versions, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`.
|
|
|
3f476a |
**Default:** `'TLSv1.2'`, unless changed using CLI options. Using
|
|
|
3f476a |
`--tls-min-v1.0` sets the default to `'TLSv1'`. Using `--tls-min-v1.1` sets
|
|
|
3f476a |
- the default to `'TLSv1.1'`. Using `--tls-min-v1.3` sets the default to
|
|
|
3f476a |
- `'TLSv1.3'`. If multiple of the options are provided, the lowest minimum is
|
|
|
3f476a |
- used.
|
|
|
3f476a |
+ the default to `'TLSv1.1'`. If multiple of the options are provided,
|
|
|
3f476a |
+ the lowest minimum is used.
|
|
|
3f476a |
|
|
|
effb77 |
[CVE-2021-44531]: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44531
|
|
|
3f476a |
[Chrome's 'modern cryptography' setting]: https://www.chromium.org/Home/chromium-security/education/tls#TOC-Cipher-Suites
|
|
|
3f476a |
diff --git a/src/env.h b/src/env.h
|
|
|
4fb6d9 |
index 824202e..90b04e2 100644
|
|
|
3f476a |
--- a/src/env.h
|
|
|
3f476a |
+++ b/src/env.h
|
|
|
3f476a |
@@ -50,6 +50,8 @@
|
|
|
3f476a |
#include <unordered_set>
|
|
|
3f476a |
#include <vector>
|
|
|
3f476a |
|
|
|
3f476a |
+#include <node-ssl-shim/ssl-shim.h>
|
|
|
3f476a |
+
|
|
|
3f476a |
namespace node {
|
|
|
3f476a |
|
|
|
3f476a |
namespace contextify {
|
|
|
3f476a |
@@ -141,6 +143,13 @@ constexpr size_t kFsStatsBufferLength =
|
|
|
3f476a |
// Make sure that any macro V defined for use with the PER_ISOLATE_* macros is
|
|
|
3f476a |
// undefined again after use.
|
|
|
3f476a |
|
|
|
3f476a |
+// Some symbols/strings are not defined when using legacy OpenSSL
|
|
|
3f476a |
+#if OPENSSL_IS_LEGACY
|
|
|
3f476a |
+# define NODE_ENV_STANDARD_NAME_STRING
|
|
|
3f476a |
+#else // OPENSSL_IS_LEGACY
|
|
|
3f476a |
+# define NODE_ENV_STANDARD_NAME_STRING V(standard_name_string, "standardName")
|
|
|
3f476a |
+#endif // OPENSSL_IS_LEGACY
|
|
|
3f476a |
+
|
|
|
3f476a |
// Private symbols are per-isolate primitives but Environment proxies them
|
|
|
3f476a |
// for the sake of convenience. Strings should be ASCII-only and have a
|
|
|
3f476a |
// "node:" prefix to avoid name clashes with third-party code.
|
|
|
9500a8 |
@@ -368,7 +377,7 @@ constexpr size_t kFsStatsBufferLength =
|
|
|
3f476a |
V(sni_context_string, "sni_context") \
|
|
|
3f476a |
V(source_string, "source") \
|
|
|
3f476a |
V(stack_string, "stack") \
|
|
|
3f476a |
- V(standard_name_string, "standardName") \
|
|
|
3f476a |
+ NODE_ENV_STANDARD_NAME_STRING \
|
|
|
3f476a |
V(start_time_string, "startTime") \
|
|
|
3f476a |
V(status_string, "status") \
|
|
|
3f476a |
V(stdio_string, "stdio") \
|
|
|
effb77 |
diff --git a/src/node.cc b/src/node.cc
|
|
|
4fb6d9 |
index 9e7bf07..8a29f76 100644
|
|
|
effb77 |
--- a/src/node.cc
|
|
|
effb77 |
+++ b/src/node.cc
|
|
|
effb77 |
@@ -44,7 +44,6 @@
|
|
|
effb77 |
#if HAVE_OPENSSL
|
|
|
effb77 |
#include "allocated_buffer-inl.h" // Inlined functions needed by node_crypto.h
|
|
|
effb77 |
#include "node_crypto.h"
|
|
|
effb77 |
-#include <openssl/conf.h>
|
|
|
effb77 |
#endif
|
|
|
effb77 |
|
|
|
effb77 |
#if defined(NODE_HAVE_I18N_SUPPORT)
|
|
|
effb77 |
@@ -155,9 +154,6 @@ uint64_t node_start_time;
|
|
|
effb77 |
struct V8Platform v8_platform;
|
|
|
effb77 |
} // namespace per_process
|
|
|
effb77 |
|
|
|
effb77 |
-// The section in the OpenSSL configuration file to be loaded.
|
|
|
effb77 |
-const char* conf_section_name = STRINGIFY(NODE_OPENSSL_CONF_NAME);
|
|
|
effb77 |
-
|
|
|
effb77 |
#ifdef __POSIX__
|
|
|
effb77 |
void SignalExit(int signo, siginfo_t* info, void* ucontext) {
|
|
|
effb77 |
ResetStdio();
|
|
|
effb77 |
@@ -979,7 +975,6 @@ void Init(int* argc,
|
|
|
effb77 |
argv[i] = strdup(argv_[i].c_str());
|
|
|
effb77 |
}
|
|
|
effb77 |
|
|
|
effb77 |
-
|
|
|
effb77 |
InitializationResult InitializeOncePerProcess(int argc, char** argv) {
|
|
|
effb77 |
// Initialized the enabled list for Debug() calls with system
|
|
|
effb77 |
// environment variables.
|
|
|
4fb6d9 |
@@ -1046,49 +1041,6 @@ InitializationResult InitializeOncePerProcess(int argc, char** argv) {
|
|
|
effb77 |
crypto::UseExtraCaCerts(extra_ca_certs);
|
|
|
effb77 |
}
|
|
|
4fb6d9 |
|
|
|
effb77 |
- // Passing NULL as the config file will allow the default openssl.cnf file
|
|
|
effb77 |
- // to be loaded, but the default section in that file will not be used,
|
|
|
effb77 |
- // instead only the section that matches the value of conf_section_name
|
|
|
effb77 |
- // will be read from the default configuration file.
|
|
|
effb77 |
- const char* conf_file = nullptr;
|
|
|
effb77 |
- // Use OPENSSL_CONF environment variable is set.
|
|
|
effb77 |
- std::string env_openssl_conf;
|
|
|
4fb6d9 |
- // To allow for using the previous default where the 'openssl_conf' appname
|
|
|
4fb6d9 |
- // was used, the command line option 'openssl-shared-config' can be used to
|
|
|
4fb6d9 |
- // force the old behavior.
|
|
|
4fb6d9 |
- if (per_process::cli_options->openssl_shared_config) {
|
|
|
4fb6d9 |
- conf_section_name = "openssl_conf";
|
|
|
4fb6d9 |
- }
|
|
|
effb77 |
- credentials::SafeGetenv("OPENSSL_CONF", &env_openssl_conf);
|
|
|
effb77 |
- if (!env_openssl_conf.empty()) {
|
|
|
effb77 |
- conf_file = env_openssl_conf.c_str();
|
|
|
effb77 |
- }
|
|
|
effb77 |
- // Use --openssl-conf command line option if specified.
|
|
|
effb77 |
- if (!per_process::cli_options->openssl_config.empty()) {
|
|
|
effb77 |
- conf_file = per_process::cli_options->openssl_config.c_str();
|
|
|
effb77 |
- }
|
|
|
effb77 |
-
|
|
|
effb77 |
- OPENSSL_INIT_SETTINGS* settings = OPENSSL_INIT_new();
|
|
|
effb77 |
- OPENSSL_INIT_set_config_filename(settings, conf_file);
|
|
|
effb77 |
- OPENSSL_INIT_set_config_appname(settings, conf_section_name);
|
|
|
effb77 |
- OPENSSL_INIT_set_config_file_flags(settings,
|
|
|
effb77 |
- CONF_MFLAGS_IGNORE_MISSING_FILE);
|
|
|
effb77 |
-
|
|
|
effb77 |
- OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, settings);
|
|
|
effb77 |
- OPENSSL_INIT_free(settings);
|
|
|
effb77 |
-
|
|
|
effb77 |
- if (ERR_peek_error() != 0) {
|
|
|
effb77 |
- int ossl_error_code = ERR_GET_REASON(ERR_peek_error());
|
|
|
effb77 |
- if (ossl_error_code != EVP_R_FIPS_MODE_NOT_SUPPORTED) {
|
|
|
effb77 |
- result.exit_code = ossl_error_code;
|
|
|
effb77 |
- result.early_return = true;
|
|
|
effb77 |
- fprintf(stderr, "%s", "OpenSSL configuration error:\n");
|
|
|
effb77 |
- ERR_print_errors_fp(stderr);
|
|
|
effb77 |
- return result;
|
|
|
effb77 |
- }
|
|
|
effb77 |
- }
|
|
|
effb77 |
-
|
|
|
effb77 |
-
|
|
|
effb77 |
// In the case of FIPS builds we should make sure
|
|
|
effb77 |
// the random source is properly initialized first.
|
|
|
effb77 |
if (FIPS_mode()) {
|
|
|
9500a8 |
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
|
|
|
4fb6d9 |
index 975a148..8bb34ab 100644
|
|
|
9500a8 |
--- a/src/node_crypto.cc
|
|
|
9500a8 |
+++ b/src/node_crypto.cc
|
|
|
effb77 |
@@ -7124,11 +7124,15 @@ namespace {
|
|
|
9500a8 |
// make use of secure heap, this has the same semantics as
|
|
|
9500a8 |
// using OPENSSL_malloc. However, if the secure heap is
|
|
|
9500a8 |
// initialized, SecureBuffer will automatically use it.
|
|
|
9500a8 |
+//
|
|
|
9500a8 |
+// RHEL 7 Note: secure_{malloc,clear_free} is not available in OpenSSL 1.0
|
|
|
9500a8 |
+// As in this case the expected behaviour is to fall back to their
|
|
|
9500a8 |
+// "regular" counterparts, the "secure" calls were replaced with them.
|
|
|
9500a8 |
void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
|
|
|
9500a8 |
CHECK(args[0]->IsUint32());
|
|
|
9500a8 |
Environment* env = Environment::GetCurrent(args);
|
|
|
9500a8 |
uint32_t len = args[0].As<Uint32>()->Value();
|
|
|
9500a8 |
- char* data = static_cast<char*>(OPENSSL_secure_malloc(len));
|
|
|
9500a8 |
+ char* data = static_cast<char*>(OPENSSL_malloc(len));
|
|
|
9500a8 |
if (data == nullptr) {
|
|
|
9500a8 |
// There's no memory available for the allocation.
|
|
|
9500a8 |
// Return nothing.
|
|
|
effb77 |
@@ -7140,7 +7144,7 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
|
|
|
9500a8 |
data,
|
|
|
9500a8 |
len,
|
|
|
9500a8 |
[](void* data, size_t len, void* deleter_data) {
|
|
|
9500a8 |
- OPENSSL_secure_clear_free(data, len);
|
|
|
9500a8 |
+ OPENSSL_clear_free(data, len);
|
|
|
9500a8 |
},
|
|
|
9500a8 |
data);
|
|
|
9500a8 |
Local<ArrayBuffer> buffer = ArrayBuffer::New(env->isolate(), store);
|
|
|
3f476a |
diff --git a/src/node_crypto_common.cc b/src/node_crypto_common.cc
|
|
|
4fb6d9 |
index 7d313dd..a7bde45 100644
|
|
|
3f476a |
--- a/src/node_crypto_common.cc
|
|
|
3f476a |
+++ b/src/node_crypto_common.cc
|
|
|
effb77 |
@@ -143,6 +143,7 @@ long VerifyPeerCertificate( // NOLINT(runtime/int)
|
|
|
3f476a |
if (X509* peer_cert = SSL_get_peer_certificate(ssl.get())) {
|
|
|
3f476a |
X509_free(peer_cert);
|
|
|
3f476a |
err = SSL_get_verify_result(ssl.get());
|
|
|
3f476a |
+#if !OPENSSL_IS_LEGACY
|
|
|
3f476a |
} else {
|
|
|
3f476a |
const SSL_CIPHER* curr_cipher = SSL_get_current_cipher(ssl.get());
|
|
|
3f476a |
const SSL_SESSION* sess = SSL_get_session(ssl.get());
|
|
|
effb77 |
@@ -154,6 +155,7 @@ long VerifyPeerCertificate( // NOLINT(runtime/int)
|
|
|
3f476a |
SSL_session_reused(ssl.get()))) {
|
|
|
3f476a |
return X509_V_OK;
|
|
|
3f476a |
}
|
|
|
3f476a |
+#endif // !OPENSSL_IS_LEGACY
|
|
|
3f476a |
}
|
|
|
3f476a |
return err;
|
|
|
3f476a |
}
|
|
|
effb77 |
@@ -171,6 +173,7 @@ int UseSNIContext(const SSLPointer& ssl, BaseObjectPtr<SecureContext> context) {
|
|
|
3f476a |
return err;
|
|
|
3f476a |
}
|
|
|
3f476a |
|
|
|
3f476a |
+#if !OPENSSL_IS_LEGACY
|
|
|
3f476a |
const char* GetClientHelloALPN(const SSLPointer& ssl) {
|
|
|
3f476a |
const unsigned char* buf;
|
|
|
3f476a |
size_t len;
|
|
|
effb77 |
@@ -217,6 +220,7 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) {
|
|
|
3f476a |
return nullptr;
|
|
|
3f476a |
return reinterpret_cast<const char*>(buf + 5);
|
|
|
3f476a |
}
|
|
|
3f476a |
+#endif // !OPENSSL_IS_LEGACY
|
|
|
3f476a |
|
|
|
3f476a |
const char* GetServerName(SSL* ssl) {
|
|
|
3f476a |
return SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name);
|
|
|
effb77 |
@@ -330,11 +334,13 @@ MaybeLocal<Value> GetCipherName(Environment* env, const SSL_CIPHER* cipher) {
|
|
|
3f476a |
return GetCipherValue(env, cipher, SSL_CIPHER_get_name);
|
|
|
3f476a |
}
|
|
|
3f476a |
|
|
|
3f476a |
+#if !OPENSSL_IS_LEGACY
|
|
|
3f476a |
MaybeLocal<Value> GetCipherStandardName(
|
|
|
3f476a |
Environment* env,
|
|
|
3f476a |
const SSL_CIPHER* cipher) {
|
|
|
3f476a |
return GetCipherValue(env, cipher, SSL_CIPHER_standard_name);
|
|
|
3f476a |
}
|
|
|
3f476a |
+#endif // !OPENSSL_IS_LEGACY
|
|
|
3f476a |
|
|
|
3f476a |
MaybeLocal<Value> GetCipherVersion(Environment* env, const SSL_CIPHER* cipher) {
|
|
|
3f476a |
#if OPENSSL_IS_LEGACY
|
|
|
effb77 |
@@ -1088,16 +1094,19 @@ MaybeLocal<Value> GetCipherName(Environment* env, const SSLPointer& ssl) {
|
|
|
3f476a |
return GetCipherName(env, SSL_get_current_cipher(ssl.get()));
|
|
|
3f476a |
}
|
|
|
3f476a |
|
|
|
3f476a |
+#if !OPENSSL_IS_LEGACY
|
|
|
3f476a |
MaybeLocal<Value> GetCipherStandardName(
|
|
|
3f476a |
Environment* env,
|
|
|
3f476a |
const SSLPointer& ssl) {
|
|
|
3f476a |
return GetCipherStandardName(env, SSL_get_current_cipher(ssl.get()));
|
|
|
3f476a |
}
|
|
|
3f476a |
+#endif // !OPENSSL_IS_LEGACY
|
|
|
3f476a |
|
|
|
3f476a |
MaybeLocal<Value> GetCipherVersion(Environment* env, const SSLPointer& ssl) {
|
|
|
3f476a |
return GetCipherVersion(env, SSL_get_current_cipher(ssl.get()));
|
|
|
3f476a |
}
|
|
|
3f476a |
|
|
|
3f476a |
+#if !OPENSSL_IS_LEGACY
|
|
|
3f476a |
MaybeLocal<Array> GetClientHelloCiphers(
|
|
|
3f476a |
Environment* env,
|
|
|
3f476a |
const SSLPointer& ssl) {
|
|
|
effb77 |
@@ -1130,6 +1139,7 @@ MaybeLocal<Array> GetClientHelloCiphers(
|
|
|
3f476a |
Local<Array> ret = Array::New(env->isolate(), ciphers.out(), count);
|
|
|
3f476a |
return scope.Escape(ret);
|
|
|
3f476a |
}
|
|
|
3f476a |
+#endif // !OPENSSL_IS_LEGACY
|
|
|
3f476a |
|
|
|
3f476a |
|
|
|
3f476a |
MaybeLocal<Object> GetCipherInfo(Environment* env, const SSLPointer& ssl) {
|
|
|
effb77 |
@@ -1140,10 +1150,12 @@ MaybeLocal<Object> GetCipherInfo(Environment* env, const SSLPointer& ssl) {
|
|
|
3f476a |
info,
|
|
|
3f476a |
env->name_string(),
|
|
|
3f476a |
GetCipherName(env, ssl)) ||
|
|
|
3f476a |
+#if !OPENSSL_IS_LEGACY
|
|
|
3f476a |
!Set<Value>(env->context(),
|
|
|
3f476a |
info,
|
|
|
3f476a |
env->standard_name_string(),
|
|
|
3f476a |
GetCipherStandardName(env, ssl)) ||
|
|
|
3f476a |
+#endif // !OPENSSL_IS_LEGACY
|
|
|
3f476a |
!Set<Value>(env->context(),
|
|
|
3f476a |
info,
|
|
|
3f476a |
env->version_string(),
|
|
|
3f476a |
diff --git a/src/node_crypto_common.h b/src/node_crypto_common.h
|
|
|
4fb6d9 |
index bf58df1..8e1ac58 100644
|
|
|
3f476a |
--- a/src/node_crypto_common.h
|
|
|
3f476a |
+++ b/src/node_crypto_common.h
|
|
|
effb77 |
@@ -67,15 +67,19 @@ long VerifyPeerCertificate( // NOLINT(runtime/int)
|
|
|
3f476a |
|
|
|
3f476a |
int UseSNIContext(const SSLPointer& ssl, BaseObjectPtr<SecureContext> context);
|
|
|
3f476a |
|
|
|
3f476a |
+#if !OPENSSL_IS_LEGACY
|
|
|
3f476a |
const char* GetClientHelloALPN(const SSLPointer& ssl);
|
|
|
3f476a |
|
|
|
3f476a |
const char* GetClientHelloServerName(const SSLPointer& ssl);
|
|
|
3f476a |
+#endif // !OPENSSL_IS_LEGACY
|
|
|
3f476a |
|
|
|
3f476a |
const char* GetServerName(SSL* ssl);
|
|
|
3f476a |
|
|
|
3f476a |
+#if !OPENSSL_IS_LEGACY
|
|
|
3f476a |
v8::MaybeLocal<v8::Array> GetClientHelloCiphers(
|
|
|
3f476a |
Environment* env,
|
|
|
3f476a |
const SSLPointer& ssl);
|
|
|
3f476a |
+#endif // !OPENSSL_IS_LEGACY
|
|
|
3f476a |
|
|
|
3f476a |
bool SetGroups(SecureContext* sc, const char* groups);
|
|
|
3f476a |
|
|
|
effb77 |
@@ -91,9 +95,11 @@ v8::MaybeLocal<v8::Value> GetCipherName(
|
|
|
3f476a |
Environment* env,
|
|
|
3f476a |
const SSLPointer& ssl);
|
|
|
3f476a |
|
|
|
3f476a |
+#if !OPENSSL_IS_LEGACY
|
|
|
3f476a |
v8::MaybeLocal<v8::Value> GetCipherStandardName(
|
|
|
3f476a |
Environment* env,
|
|
|
3f476a |
const SSLPointer& ssl);
|
|
|
3f476a |
+#endif // !OPENSSL_IS_LEGACY
|
|
|
3f476a |
|
|
|
3f476a |
v8::MaybeLocal<v8::Value> GetCipherVersion(
|
|
|
3f476a |
Environment* env,
|
|
|
3f476a |
diff --git a/src/node_options.cc b/src/node_options.cc
|
|
|
4fb6d9 |
index 35d518b..26a891a 100644
|
|
|
3f476a |
--- a/src/node_options.cc
|
|
|
3f476a |
+++ b/src/node_options.cc
|
|
|
3f476a |
@@ -9,6 +9,8 @@
|
|
|
3f476a |
#include <sstream>
|
|
|
3f476a |
#include <cstdlib> // strtoul, errno
|
|
|
3f476a |
|
|
|
3f476a |
+#include <node-ssl-shim/features.h>
|
|
|
3f476a |
+
|
|
|
3f476a |
using v8::Boolean;
|
|
|
3f476a |
using v8::Context;
|
|
|
3f476a |
using v8::FunctionCallbackInfo;
|
|
|
3f476a |
@@ -113,10 +115,12 @@ void EnvironmentOptions::CheckOptions(std::vector<std::string>* errors) {
|
|
|
3f476a |
errors->push_back("invalid value for --unhandled-rejections");
|
|
|
3f476a |
}
|
|
|
3f476a |
|
|
|
3f476a |
+#if !OPENSSL_IS_LEGACY
|
|
|
3f476a |
if (tls_min_v1_3 && tls_max_v1_2) {
|
|
|
3f476a |
errors->push_back("either --tls-min-v1.3 or --tls-max-v1.2 can be "
|
|
|
3f476a |
"used, not both");
|
|
|
3f476a |
}
|
|
|
3f476a |
+#endif // !OPENSSL_IS_LEGACY
|
|
|
3f476a |
|
|
|
9500a8 |
if (heap_snapshot_near_heap_limit < 0) {
|
|
|
9500a8 |
errors->push_back("--heap-snapshot-near-heap-limit must not be negative");
|
|
|
effb77 |
@@ -563,14 +567,17 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
|
|
|
3f476a |
"set default TLS minimum to TLSv1.2 (default: TLSv1.2)",
|
|
|
3f476a |
&EnvironmentOptions::tls_min_v1_2,
|
|
|
3f476a |
kAllowedInEnvironment);
|
|
|
3f476a |
+#if !OPENSSL_IS_LEGACY
|
|
|
3f476a |
AddOption("--tls-min-v1.3",
|
|
|
3f476a |
"set default TLS minimum to TLSv1.3 (default: TLSv1.2)",
|
|
|
3f476a |
&EnvironmentOptions::tls_min_v1_3,
|
|
|
3f476a |
kAllowedInEnvironment);
|
|
|
3f476a |
+#endif // !OPENSSL_IS_LEGACY
|
|
|
3f476a |
AddOption("--tls-max-v1.2",
|
|
|
3f476a |
- "set default TLS maximum to TLSv1.2 (default: TLSv1.3)",
|
|
|
3f476a |
+ "set default TLS maximum to TLSv1.2 (default: TLSv1.2)",
|
|
|
3f476a |
&EnvironmentOptions::tls_max_v1_2,
|
|
|
3f476a |
kAllowedInEnvironment);
|
|
|
3f476a |
+#if !OPENSSL_IS_LEGACY
|
|
|
3f476a |
// Current plan is:
|
|
|
3f476a |
// - 11.x and below: TLS1.3 is opt-in with --tls-max-v1.3
|
|
|
3f476a |
// - 12.x: TLS1.3 is opt-out with --tls-max-v1.2
|
|
|
effb77 |
@@ -579,6 +586,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
|
|
|
3f476a |
"set default TLS maximum to TLSv1.3 (default: TLSv1.3)",
|
|
|
3f476a |
&EnvironmentOptions::tls_max_v1_3,
|
|
|
3f476a |
kAllowedInEnvironment);
|
|
|
3f476a |
+#endif // !OPENSSL_IS_LEGACY
|
|
|
3f476a |
}
|
|
|
3f476a |
|
|
|
3f476a |
PerIsolateOptionsParser::PerIsolateOptionsParser(
|
|
|
effb77 |
diff --git a/test/fixtures/openssl_fips_disabled.cnf b/test/fixtures/openssl_fips_disabled.cnf
|
|
|
4fb6d9 |
index 253c690..8668370 100644
|
|
|
effb77 |
--- a/test/fixtures/openssl_fips_disabled.cnf
|
|
|
effb77 |
+++ b/test/fixtures/openssl_fips_disabled.cnf
|
|
|
effb77 |
@@ -1,6 +1,6 @@
|
|
|
effb77 |
# Skeleton openssl.cnf for testing with FIPS
|
|
|
effb77 |
|
|
|
effb77 |
-nodejs_conf = openssl_conf_section
|
|
|
effb77 |
+openssl_conf = openssl_conf_section
|
|
|
effb77 |
authorityKeyIdentifier=keyid:always,issuer:always
|
|
|
effb77 |
|
|
|
effb77 |
[openssl_conf_section]
|
|
|
effb77 |
diff --git a/test/fixtures/openssl_fips_enabled.cnf b/test/fixtures/openssl_fips_enabled.cnf
|
|
|
4fb6d9 |
index 79733c6..9c1a90f 100644
|
|
|
effb77 |
--- a/test/fixtures/openssl_fips_enabled.cnf
|
|
|
effb77 |
+++ b/test/fixtures/openssl_fips_enabled.cnf
|
|
|
effb77 |
@@ -1,6 +1,6 @@
|
|
|
effb77 |
# Skeleton openssl.cnf for testing with FIPS
|
|
|
effb77 |
|
|
|
effb77 |
-nodejs_conf = openssl_conf_section
|
|
|
effb77 |
+openssl_conf = openssl_conf_section
|
|
|
effb77 |
authorityKeyIdentifier=keyid:always,issuer:always
|
|
|
effb77 |
|
|
|
effb77 |
[openssl_conf_section]
|
|
|
3f476a |
diff --git a/test/parallel/test-tls-cli-max-version-1.3.js b/test/known_issues/test-tls-cli-max-version-1.3.js
|
|
|
3f476a |
similarity index 100%
|
|
|
3f476a |
rename from test/parallel/test-tls-cli-max-version-1.3.js
|
|
|
3f476a |
rename to test/known_issues/test-tls-cli-max-version-1.3.js
|
|
|
3f476a |
diff --git a/test/parallel/test-tls-cli-min-max-conflict.js b/test/known_issues/test-tls-cli-min-max-conflict.js
|
|
|
3f476a |
similarity index 100%
|
|
|
3f476a |
rename from test/parallel/test-tls-cli-min-max-conflict.js
|
|
|
3f476a |
rename to test/known_issues/test-tls-cli-min-max-conflict.js
|
|
|
3f476a |
diff --git a/test/parallel/test-tls-cli-min-version-1.3.js b/test/known_issues/test-tls-cli-min-version-1.3.js
|
|
|
3f476a |
similarity index 100%
|
|
|
3f476a |
rename from test/parallel/test-tls-cli-min-version-1.3.js
|
|
|
3f476a |
rename to test/known_issues/test-tls-cli-min-version-1.3.js
|
|
|
effb77 |
diff --git a/test/parallel/test-crypto-fips.js b/test/parallel/test-crypto-fips.js
|
|
|
4fb6d9 |
index bf8b3c1..a1ed645 100644
|
|
|
effb77 |
--- a/test/parallel/test-crypto-fips.js
|
|
|
effb77 |
+++ b/test/parallel/test-crypto-fips.js
|
|
|
effb77 |
@@ -64,7 +64,7 @@ testHelper(
|
|
|
effb77 |
[],
|
|
|
effb77 |
FIPS_DISABLED,
|
|
|
effb77 |
'require("crypto").getFips()',
|
|
|
effb77 |
- { ...process.env, 'OPENSSL_CONF': ' ' });
|
|
|
effb77 |
+ { ...process.env, 'OPENSSL_CONF': '' });
|
|
|
effb77 |
|
|
|
effb77 |
// --enable-fips should turn FIPS mode on
|
|
|
effb77 |
testHelper(
|
|
|
3f476a |
--
|
|
|
4fb6d9 |
2.38.1
|
|
|
3f476a |
|