Commit 8923ea5
committed
SecurityReview FND 40.2 + FND 36.1: integrity HMAC SHA-512 + SLH-DSA PCT
Two findings from the v7.0.0 security review, squashed into one
commit per the Part3 branch invariant.
FND 40.2 (in-core integrity HMAC upgraded to SHA-512)
FIPS 140-3 v7.0.0 security review: the in-core integrity test must
use HMAC-SHA-512 with a 512-bit key for NSA 2.0 compliance (customers
requiring no SHA-256 usage anywhere in the validated module).
- wolfssl/wolfcrypt/fips_test.h: add v7+ branch that selects SHA-512 /
64-byte digest / 512-bit key / 64-byte verify-size. Older versions
(v5.3, v6.x) keep HMAC-SHA-256.
- fips-hash.sh: drop the hardcoded cut -c1-64 so the script works for
SHA-512 (128 hex chars) as well as SHA-256. Length is guarded at
compile time by the static_assert on sizeof(verifyCore).
Companion change in kh-fork-fips updates fips_test.c verifyCore
placeholder, coreKey (fresh 512-bit random), and the static_assert to
use FIPS_IN_CORE_DIGEST_SIZE.
Paperwork (PQ-FS-dev-area/Final_Submission_Paperwork/):
- PL-R36 compliance summary already reflects HMAC-SHA-512 (no change).
- PL-R34 Security Policy section 5.1 updated via tracked changes to
say HMAC-SHA2-512 with a 512-bit key.
FND 36.1 (SLH-DSA KeyGen now runs a Pairwise Consistency Test)
wc_SlhDsaKey_MakeKey previously generated random seeds and delegated
to MakeKeyWithRandom without any PCT. ML-KEM and ML-DSA both have
inline PCTs citing FIPS 140-3 IG 10.3.A TE10.35.02; SLH-DSA had none.
SLH-DSA is a stateless hash-based signature scheme (FIPS 205), so the
relaxed PCT rule for stateful HBS (LMS/XMSS) does not apply -- PCT is
mandatory on every KeyGen.
Changes:
- wolfssl/wolfcrypt/error-crypt.h: add SLH_DSA_PCT_E = -1013, shift
WC_SPAN2_LAST_E / WC_LAST_E to -1013.
- wolfcrypt/src/error.c: add a description string for SLH_DSA_PCT_E.
- wolfcrypt/src/wc_slhdsa.c wc_SlhDsaKey_MakeKey: after MakeKeyWithRandom
succeeds, sign a fixed PCT message with the new sk using
wc_SlhDsaKey_SignDeterministic (no extra RNG state; reproducible)
and verify with the matching pk. Signature buffer is heap-allocated
(SLH-DSA sigs can be ~50 KB) and ForceZero'd before XFREE. On PCT
failure the key is wc_SlhDsaKey_Free'd so a caller that ignores the
return value cannot use the broken key pair.
Companion fips change: fips.c DEGRADE_STATE handler for SLH_DSA_PCT_E
and optest-140-3/optest.h case_1013 entry.
Verified: make + fips-hash.sh + make; make check all pass.1 parent 13d5cd9 commit 8923ea5
5 files changed
Lines changed: 68 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
692 | 692 | | |
693 | 693 | | |
694 | 694 | | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
695 | 698 | | |
696 | 699 | | |
697 | 700 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6570 | 6570 | | |
6571 | 6571 | | |
6572 | 6572 | | |
| 6573 | + | |
| 6574 | + | |
| 6575 | + | |
| 6576 | + | |
| 6577 | + | |
| 6578 | + | |
| 6579 | + | |
| 6580 | + | |
| 6581 | + | |
| 6582 | + | |
| 6583 | + | |
| 6584 | + | |
| 6585 | + | |
| 6586 | + | |
| 6587 | + | |
| 6588 | + | |
| 6589 | + | |
| 6590 | + | |
| 6591 | + | |
| 6592 | + | |
| 6593 | + | |
| 6594 | + | |
| 6595 | + | |
| 6596 | + | |
| 6597 | + | |
| 6598 | + | |
| 6599 | + | |
| 6600 | + | |
| 6601 | + | |
| 6602 | + | |
| 6603 | + | |
| 6604 | + | |
| 6605 | + | |
| 6606 | + | |
| 6607 | + | |
| 6608 | + | |
| 6609 | + | |
| 6610 | + | |
| 6611 | + | |
6573 | 6612 | | |
6574 | 6613 | | |
6575 | 6614 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | | - | |
323 | | - | |
324 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
325 | 326 | | |
326 | 327 | | |
327 | 328 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
36 | 51 | | |
37 | 52 | | |
38 | 53 | | |
| |||
0 commit comments