Repository navigation
Conversation
SignMuWithSeed and VerifyMu take a precomputed mu but nothing produced one, so a message could not be hashed apart from the key holder.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the new standalone ML-DSA mu-generation API.
No open issues 🎉
What changed in this PR
Adds wc_MlDsaKey_GenMu() so applications can compute an ML-DSA message digest separately from the private-key holder and use it with the existing external-mu signing and verification APIs.
Changes:
- Computes the FIPS 204 context-aware mu from public or private key material, with argument validation and draft-key rejection.
- Adds tests for signing equivalence, verification, key-source consistency, empty messages, and invalid inputs.
- Documents the API and its incompatibility with legacy no-context signing.
| File | Description |
|---|---|
wolfssl/wolfcrypt/wc_mldsa.h |
Declares the public wc_MlDsaKey_GenMu() API. |
wolfcrypt/src/wc_mldsa.c |
Implements mu generation and input validation. |
tests/api/test_mldsa.h |
Registers the new API test. |
tests/api/test_mldsa.c |
Adds functional tests and a canonical API check. |
doc/dox_comments/header_files/wc_mldsa.h |
Documents behavior, constraints, and example usage. |
Review effort: Balanced
|
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #12070
Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Not reviewed (no scan target covers them): doc/dox_comments/header_files/wc_mldsa.h, tests/api/test_mldsa.h
Coverage: 3 of 3 in-scope changed file(s) opened by the reviewer
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: Max
Description
SignMuWithSeed and VerifyMu take a precomputed mu but nothing produced one, so a message could not be hashed apart from the key holder. wc_MlDsaKey_GenMu now does that. It computes mu = SHAKE256(tr || 0 || ctxLen || ctx || msg, 64) as defined in FIPS 204.
Testing
Checked the flow from gen mu to sign mu and verify mu.
Checklist