Skip to content

20261112-WC_HAVE_FIPS_INDICATOR - #12124

Draft
douzzer wants to merge 9 commits into
wolfSSL:masterfrom
douzzer:20261112-WC_HAVE_FIPS_INDICATOR
Draft

douzzer wants to merge 9 commits into
wolfSSL:masterfrom
douzzer:20261112-WC_HAVE_FIPS_INDICATOR

Conversation

@douzzer

@douzzer douzzer commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

tested with

wolfssl-multi-test.sh ...
fips-140-3-ready-optest-acvp-sp-asm
fips-140-3-dev-optest-acvp-sp-asm
all-crypto-only-allintelasm-fips-dev-linuxkm-next-insmod-optest

with and without
LIBWOLFSSL_CONFIGURE_ARGS_OVERRIDE=CFLAGS=-DWC_HAVE_FIPS_INDICATOR

Copilot AI balanced review requested due to automatic review settings November 13, 2026 05:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The FIPS v7 wrapper sources are missing, requiring module-owner review against the matching bundle to confirm SHA-1 HKDF rejection gates and seeded-operation indicators across nonblocking and crypto-callback paths.

No open issues 🎉

What changed in this PR

Updates wolfCrypt self-tests to handle WC_HAVE_FIPS_INDICATOR return values and FIPS v7 restrictions.

Changes:

  • Skips SHA-1 HKDF tests when FIPS v7 approved-mode gates are enabled.
  • Handles SEED_OK in caller-seeded ML-KEM, ML-DSA, and SLH-DSA tests, including nonblocking paths.
  • Normalizes seeded success returns to zero in callback implementations and related tests.
File Description
wolfcrypt/​test/​test.c Adjusts HKDF guards and post-quantum test return handling for FIPS indicator compatibility.

Review effort: Balanced

@douzzer
douzzer force-pushed the 20261112-WC_HAVE_FIPS_INDICATOR branch from 7de1fb4 to 04ae83a Compare November 17, 2026 19:46
…-seeded

SLH-DSA keygen and SLH-DSA/ML-DSA signing services return the
WC_FIPS_NOT_APPROVED indicator on success.  Accordingly, change the call sites
that predate the SEED_OK convention to expect SEED_OK (slh_dsa_param_test, the
WOLFSSL_TEST_PQC_SEED_KAT blocks) or to absorb the indicator where the calling
contract has no ride for it (myCryptoDevCb, the devId sw/hw comparison in
cryptocb_pqc_mldsa_test).  No behavior changes in builds without
WC_HAVE_FIPS_INDICATOR.
wc_MlKemKey_EncapsulateWithRandom returns WC_FIPS_NOT_APPROVED on success.
Change the KAT-vector call sites and the WC_NO_RNG arm of the parameter
loop to expect SEED_OK, absorb the indicator in the devId sw/hw comparison
(cryptocb_pqc_mlkem_encap), and add NB_STEP_SEEDED()/NB_RUN_SEEDED() for
the caller-seeded calls in the ML-KEM and ML-DSA non-blocking tests, which
also covers the seeded keygen and signing indicators there.  Calls under
NB_START() are left in flight and never return the indicator, so they are
unchanged.
… add

WC_HAS_ATTRIBUTE() clauses to conjunctions in existing setup where appropriate;
refactor WC_KEEP_FOR_ASM as WC_USED and #define WC_KEEP_FOR_ASM WC_USED, subject
to override.
…acks, check LINUXKM_LKCAPI_KEEP_FIPS_WRAPPERS, and never unwrap on FIPS >=v7 (wrappers are effectively free on v7+ due to optimizations).
…or the FIPS v7 folded-state module FSM.

Adds _DEGRADED_PENDING (degraded latched, pre-op uncommitted), _UNENTERED
(fipsEntry()'s pre-test work not yet in effect), _IN_ENTRY_SETUP (an entrant's
exclusive claim).  wolfCrypt_GetMode_fips() returns the state verbatim, and in
v7.0.0+ it can return the new states, but FIPS_MODE_FAILED remains the one and
only state that signals that restart is required.
Use the new wolfCrypt_IntegrityRetest_fips() for retest runs on clean modules,
and in FIPS_rerun_self_test_handler(), add several error path kernel log
messages and percolate appropriate errno values.  Also, on v7+, fix the mock
reset in the optest harness to manhandle fipsMode to the new FIPS_MODE_UNENTERED
state.
LKCAPI_FIPS_APPROVED_MODE_GATES names the regime (HAVE_FIPS +
WC_HAVE_FIPS_INDICATOR, v7+, wrappers on).  Under it,
LKCAPI_ABSORB_SEED_INDICATOR() absorbs WC_FIPS_NOT_APPROVED at the
three caller-seeded PQ keygen sites (the LKCAPI calling contract has
no ride for the indicator, and it is the only positive return), and
ECDH P-192 registration compiles out (EccCurveAllowed() admits only
P-256/384/521 for ECDH; ECDSA P-192 verify stays, legacy use).
@douzzer
douzzer force-pushed the 20261112-WC_HAVE_FIPS_INDICATOR branch from 04ae83a to 2fc8f3e Compare November 19, 2026 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants