Skip to content

Commit 004cc22

Browse files
committed
tests: skip KDF MC/DC suites under FIPS/selftest (behavioral divergence)
The FIPS build diverges from the OPEN build on KDF behavior these exhaustive MC/DC probes assert: wc_HmacSetKey enforces the 14-byte HMAC_FIPS_MIN_KEY, so wc_Tls13_HKDF_Extract with the short salt/ikm here returns HMAC_MIN_KEYLEN_E (-200) instead of 0 (test_kdf.c:766), and wc_PRF with resLen==0 returns 0 instead of BAD_FUNC_ARG (test_kdf.c:118). kdf.c coverage is measured only in non-FIPS campaign variants, so guard both test_wc_KdfDecisionCoverage and test_wc_KdfFeatureCoverage bodies with !HAVE_FIPS && !HAVE_SELFTEST; they run in full in OPEN builds and skip cleanly under FIPS/selftest. Verified against a --enable-fips=v5 build (both now skip, 0 failures).
1 parent 28a9c59 commit 004cc22

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tests/api/test_kdf.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ static int test_kdf_cryptocb(int cbDevId, wc_CryptoInfo* info, void* ctx)
9595
int test_wc_KdfDecisionCoverage(void)
9696
{
9797
EXPECT_DECLS;
98+
/* FIPS/selftest builds diverge on KDF behavior: wc_HmacSetKey enforces the
99+
* 14-byte HMAC_FIPS_MIN_KEY (returns HMAC_MIN_KEYLEN_E for the short keys
100+
* these probes use), the MD5/TLS1.0 PRF is disallowed, and several argument
101+
* checks differ, so these OPEN-build MC/DC assertions do not hold. kdf.c
102+
* coverage is measured only in non-FIPS campaign variants, so skip the whole
103+
* suite under FIPS/selftest. */
104+
#if !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)
98105
#ifndef NO_KDF
99106

100107
/* ---------------------------------------------------------------- */
@@ -647,6 +654,7 @@ int test_wc_KdfDecisionCoverage(void)
647654
#endif /* HAVE_CMAC_KDF && WOLFSSL_AES_128 */
648655

649656
#endif /* !NO_KDF */
657+
#endif /* !HAVE_FIPS && !HAVE_SELFTEST */
650658
return EXPECT_RESULT();
651659
} /* END test_wc_KdfDecisionCoverage */
652660

@@ -657,6 +665,11 @@ int test_wc_KdfDecisionCoverage(void)
657665
int test_wc_KdfFeatureCoverage(void)
658666
{
659667
EXPECT_DECLS;
668+
/* See test_wc_KdfDecisionCoverage: FIPS/selftest builds diverge on KDF
669+
* behavior (14-byte minimum HMAC key, MD5/TLS1.0 PRF disallowed, differing
670+
* argument checks), so skip this OPEN-build positive-path suite there;
671+
* kdf.c is measured only in non-FIPS campaign variants. */
672+
#if !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)
660673
#ifndef NO_KDF
661674

662675
/* wc_PRF() across every enabled hash arm, and both the
@@ -909,5 +922,6 @@ int test_wc_KdfFeatureCoverage(void)
909922
#endif /* WC_SRTP_KDF */
910923

911924
#endif /* !NO_KDF */
925+
#endif /* !HAVE_FIPS && !HAVE_SELFTEST */
912926
return EXPECT_RESULT();
913927
} /* END test_wc_KdfFeatureCoverage */

0 commit comments

Comments
 (0)