]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
test: use runtime FIPS detection instead of compile-time check
authorAnatolii Ohorodnyk <anatolii.ohorodnyk@gmail.com>
Wed, 31 Dec 2025 20:40:11 +0000 (20:40 +0000)
committerPauli <paul.dale@oracle.com>
Tue, 6 Jan 2026 21:28:51 +0000 (08:28 +1100)
Replace #ifdef FIPS_MODULE with OSSL_PROVIDER_available() runtime check
in ecdsatest.c. The compile-time check is not meaningful for test cases
as the test binary may be compiled without FIPS_MODULE but run with the
FIPS provider loaded.

Fixes #28255

CLA: trivial

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29527)

test/ecdsatest.c

index aa81e39f0f14872771ce556e5fa4964340010a18..2641603fc6a177ea75b92dffb25e3f1ee6958766 100644 (file)
@@ -96,10 +96,8 @@ static int x9_62_tests(int n)
 
     TEST_info("ECDSA KATs for curve %s", OBJ_nid2sn(nid));
 
-#ifdef FIPS_MODULE
-    if (EC_curve_nid2nist(nid) == NULL)
-        return TEST_skip("skip non approved curves");
-#endif /* FIPS_MODULE */
+    if (OSSL_PROVIDER_available(NULL, "fips") && EC_curve_nid2nist(nid) == NULL)
+        return TEST_skip("skip non approved curves in FIPS mode");
 
     if (!TEST_ptr(mctx = EVP_MD_CTX_new())
         /* get the message digest */