From c318368c29217c3ef4f067a260c0f7822c188e52 Mon Sep 17 00:00:00 2001 From: qmuntal Date: Mon, 4 Nov 2024 12:37:57 +0100 Subject: [PATCH] add short-circuit --- openssl.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openssl.go b/openssl.go index 541ea2ef..1817ef9b 100644 --- a/openssl.go +++ b/openssl.go @@ -160,8 +160,11 @@ func FIPSProvider() bool { // Load the provider with and without the `fips=yes` query. // If the providers are the same, then the default provider is FIPS-capable. provFIPS := provFn(propFIPS) + if provFIPS == nil { + return false + } provDefault := provFn(nil) - return provFIPS != nil && provFIPS == provDefault + return provFIPS == provDefault } // isProviderAvailable checks if the provider with the given name is available.