From b2bc839d4c043d8032d69b644bbc4f1a28fbd55c Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Mon, 12 Jun 2023 19:43:22 +0000 Subject: [PATCH] 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 Reviewed-By: Michael Dawson --- src/crypto/crypto_util.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc index 87d6ab3b9970e4..1cfebb5e41d35d 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc @@ -254,7 +254,6 @@ void TestFipsCrypto(const v8::FunctionCallbackInfo& 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& 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); }