Repository navigation
Tests: Add ML-DSA to swdev for crypto cb testing - #11753
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new handlers allow invalid hash-algorithm requests to execute as plain-message signing or verification.
1 open finding
What changed in this PR
Adds ML-DSA support to the software crypto callback provider and enables existing tests for callback-only builds.
Changes:
- Implements ML-DSA callback handlers.
- Expands API and self-test coverage while retaining native-only guards.
- Combines ML-DSA and SLH-DSA in the all-algorithms CI configuration.
| File | Description |
|---|---|
| wolfcrypt/test/test.c | Enables callback-backed ML-DSA self-tests. |
| tests/swdev/user_settings.h | Keeps native ML-DSA available in the provider. |
| tests/swdev/swdev.c | Adds ML-DSA operation dispatch. |
| tests/swdev/README.md | Documents ML-DSA callback-only support. |
| tests/api/test_mldsa.h | Defines shared implementation availability. |
| tests/api/test_mldsa.c | Enables API tests with swdev. |
| tests/api/test_mldsa_legacy.c | Enables legacy API testing with swdev. |
| tests/api.c | Enables callback-backed ML-DSA CRL testing. |
| .github/workflows/cryptocb-only.yml | Consolidates combined-algorithm CI coverage. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11753
Scan targets checked: wolfcrypt-bugs, wolfssl-bugs
Coverage: 3 of 5 in-scope changed file(s) opened by the reviewer; not opened: tests/api.c, tests/api/test_mldsa_legacy.c
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Lite
8cb5821 to
dfdfa21
Compare
dfdfa21 to
a6b8749
Compare
|
retest this please |
|
|
jenkins retest this please |
a6b8749 to
723a864
Compare
723a864 to
b80f74b
Compare
|
Retest this please. (fips-ready passed but hung?) |
|
@claude review |
There was a problem hiding this comment.
Findings marked 🟡 are optional suggestions and need no follow-up push.
Additional findings (outside the current diff — GitHub can't attach inline comments there):
-
🟡
tests/api/test_mldsa.c— Conditional: native ML-DSA builds that add --enable-swdev and WOLFSSL_MLDSA_TEST_REJ_NTT_FAIL with MAKE_KEY_SMALL_MEM now fail test_mldsa_make_key_rej_ntt_fail. swdev now serves ML-DSA keygen, sign and verify for keys with no device. The test arms the fault hook in the main library, but the work runs in swdev's private copy, where the hook is never armed. Fix: exclude this test under WOLFSSL_SWDEV (add !defined(WOLFSSL_SWDEV) to the gate at test_mldsa.c:32756), as test_falcon.c:1241 does for FALCON_VERIFY_OOM_TEST.Why this was flagged
I could not rule out this population from the checkout: no CI config combines --enable-swdev with WOLFSSL_MLDSA_TEST_REJ_NTT_FAIL, and pq-all.json:176/183/189/208 use the hook without swdev. In such a build, the test calls wc_mldsa_test_rej_ntt_fail(l + 1) (test_mldsa.c:32786) on the library's static mldsa_rej_ntt_fail_countdown (wc_mldsa.c:3021). It then calls wc_MlDsaKey_MakeKeyFromSeed on an INVALID_DEVID key. Under WOLF_CRYPTO_CB_FIND, wc_SwDev_FindCb (swdev_loader.c:79) sends that call to swdev, and swdev_mldsa_keygen (swdev.c:786-797) now runs it in swdev's own copy of wc_mldsa.c, where the countdown is a separate, unarmed static. The call returns 0 instead of BAD_STATE_E, and the disarm call returns the untouched countdown instead of 0. The SignCtx/VerifyCtx checks at 32837 and 32852 fail the same way. On the base branch, swdev_pqc_sig had no ML-DSA case and returned CRYPTOCB_UNAVAILABLE, so the main library ran the armed native path. The gate only checks WC_MLDSA_HAVE_NATIVE, which is still defined in native+swdev builds.
Verification: Before this PR, swdev_pqc_sig had no WC_PQC_SIG_TYPE_MLDSA case, so it returned CRYPTOCB_UNAVAILABLE and the main library's native code ran with the armed hook. swdev's copy has its own
static int mldsa_rej_ntt_fail_countdown(wc_mldsa.c:3021). The gate at test_mldsa.c:32756 checks onlyWC_MLDSA_HAVE_NATIVE, with no!defined(WOLFSSL_SWDEV).
…CTX, gate rej_ntt_fail
|
Retest this please. (fips v6 tests hung) |
|
Tests good with multi-test with various |

Description
Adds ML-DSA support to the software "device" used in crypto callback testing.
Testing
New tests.
Checklist