crypto: remove OPENSSL_FIPS guard for OpenSSL 3

The OPENSSL_FIPS guard is only needed for versions of OpenSSL earlier
than 3.0.

Removing the guard for OpenSSL 3 fixes `parallel/test-crypto-fips`
when run with a FIPS enabled OpenSSL 3 configuration.

PR-URL: https://github.com/nodejs/node/pull/48392
Refs: https://github.com/nodejs/node/issues/48379
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
This commit is contained in:
Richard Lau authored and Ruy Adorno committed 2023-09-12 10:58:20 -04:00
1 parent 9cf8fe6b93
commit b2bc839d4c
1 file changed
+2 -2
+2 -2
View File
@@ -254,7 +254,6 @@ void TestFipsCrypto(const v8::FunctionCallbackInfo<v8::Value>& args) {
Mutex::ScopedLock lock(per_process::cli_options_mutex);
Mutex::ScopedLock fips_lock(fips_mutex);
#ifdef OPENSSL_FIPS
#if OPENSSL_VERSION_MAJOR >= 3
OSSL_PROVIDER* fips_provider = nullptr;
if (OSSL_PROVIDER_available(nullptr, "fips")) {
@@ -263,11 +262,12 @@ void TestFipsCrypto(const v8::FunctionCallbackInfo<v8::Value>& args) {
const auto enabled = fips_provider == nullptr ? 0 :
OSSL_PROVIDER_self_test(fips_provider) ? 1 : 0;
#else
#ifdef OPENSSL_FIPS
const auto enabled = FIPS_selftest() ? 1 : 0;
#endif
#else // OPENSSL_FIPS
const auto enabled = 0;
#endif // OPENSSL_FIPS
#endif
args.GetReturnValue().Set(enabled);
}