mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
crypto: don't assume FIPS is disabled by default
For binaries that use --shared-openssl FIPs may be enabled by default by the system. Allow --force-fips and --enable-fips to be specified in these cases. Signed-off-by: Michael Dawson <mdawson@devrus.com> PR-URL: https://github.com/nodejs/node/pull/46532 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
1 parent
bdba600d32
commit
b4deb2fcd5
2 files changed
+13
-8
No files matched your search
@@ -120,7 +120,8 @@ bool ProcessFipsOptions() {
|
||||
return EVP_default_properties_enable_fips(nullptr, 1) &&
|
||||
EVP_default_properties_is_fips_enabled(nullptr);
|
||||
#else
|
||||
return FIPS_mode() == 0 && FIPS_mode_set(1);
|
||||
if (FIPS_mode() == 0) return FIPS_mode_set(1);
|
||||
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -77,13 +77,17 @@ testHelper(
|
||||
'process.versions',
|
||||
process.env);
|
||||
|
||||
// By default FIPS should be off in both FIPS and non-FIPS builds.
|
||||
testHelper(
|
||||
'stdout',
|
||||
[],
|
||||
FIPS_DISABLED,
|
||||
'require("crypto").getFips()',
|
||||
{ ...process.env, 'OPENSSL_CONF': ' ' });
|
||||
// By default FIPS should be off in both FIPS and non-FIPS builds
|
||||
// unless Node.js was configured using --shared-openssl in
|
||||
// which case it may be enabled by the system.
|
||||
if (!sharedOpenSSL()) {
|
||||
testHelper(
|
||||
'stdout',
|
||||
[],
|
||||
FIPS_DISABLED,
|
||||
'require("crypto").getFips()',
|
||||
{ ...process.env, 'OPENSSL_CONF': ' ' });
|
||||
}
|
||||
|
||||
// Toggling fips with setFips should not be allowed from a worker thread
|
||||
testHelper(
|
||||
|
||||
Reference in new issue
Block a user