Commit 9af5352
committed
SecurityReview FND 40.2 + 36.1 + 6.4 + 10.1 + 15.1: integrity, PCT, zeroize, CMAC/SHAKE CASTs
Five 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)
- 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.
Companion fips changes update verifyCore placeholder, coreKey, and
static_assert on sizeof(verifyCore). PL-R34 section 5.1 tracked-
changes edit says HMAC-SHA2-512 with a 512-bit key.
FND 36.1 (SLH-DSA KeyGen now runs a Pairwise Consistency Test)
- wolfssl/wolfcrypt/error-crypt.h: add SLH_DSA_PCT_E = -1013.
- wolfcrypt/src/error.c: description string.
- wolfcrypt/src/wc_slhdsa.c wc_SlhDsaKey_MakeKey: sign with
SignDeterministic + verify under HAVE_FIPS. Heap-allocated sig
buffer (SLH-DSA sigs can be ~50 KB), ForceZero + free on failure.
Companion fips: DEGRADE_STATE handler + optest case_1013.
FND 6.4 (AES-GCM decrypt zeroizes output on authentication failure)
- wolfcrypt/src/aes.c wc_AesGcmDecrypt: ForceZero(out, sz) after
VECTOR_REGISTERS_POP when ret == AES_GCM_AUTH_E. All software
sub-implementations funnel through that ret.
- wc_AesGcmDecryptFinal: comment pointing callers at PL-R34 §2.7
operational rule on streaming API.
PL-R34 §2.7 tracked-changes paragraph documents the new rule.
FND 10.1 (AES-CMAC vendor-elected dedicated CAST)
The v7.0.0 module now performs a dedicated AES-CMAC KAT at POST.
FIPS 140-3 IG 10.3.A permits a single authenticated-mode KAT
(AES-GCM, the "more complex" composition) to cover AES-CMAC as
well and the prior v6.0.0 validation was approved on that basis.
For v7.0.0 the vendor determined that the CMAC subkey-derivation
path (K1/K2 via GF(2^128) doubling, final-block padding) is
structurally distinct from GHASH and wished to exercise it with a
dedicated CAST for additional assurance. Voluntary enhancement
exceeding the IG 10.3.A minimum.
- wolfssl/wolfcrypt/fips_test.h: FIPS_CAST_AES_CMAC = 26.
- wolfssl/wolfcrypt/error-crypt.h: CMAC_KAT_FIPS_E = -1014.
- wolfcrypt/src/error.c: description string.
Companion fips: AesCmac_KnownAnswerTest (SP 800-38B D.1 empty-msg
KAT), FIPS_CAST_AES_CMAC case in DoCAST, DEGRADE_STATE handler,
CastIdToStr entry, optest case_1014. PL-R36 tracked-changes
paragraph documents the vendor-elected framing.
FND 15.1 (SHAKE vendor-elected dedicated CAST)
SHAKE was an approved algorithm in the v6.0.0 module; self-testing
was covered by the SHA3-256 CAST (embedded in HMAC-SHA3-256 CAST)
under IG 10.3.B via the shared Keccak-f[1600] permutation. For
v7.0.0 the vendor has elected to refactor SHAKE self-testing into
a dedicated FIPS_CAST_SHAKE that exercises SHAKE's distinct 0x1F
domain separator (vs SHA3's 0x06) and arbitrary-length squeeze.
A single CAST identifier covers both SHAKE-128 and SHAKE-256 to
minimize code footprint. Voluntary enhancement exceeding the
IG 10.3.B minimum.
- wolfssl/wolfcrypt/fips_test.h: FIPS_CAST_SHAKE = 27, bump
FIPS_CAST_COUNT = 28.
- wolfssl/wolfcrypt/error-crypt.h: SHAKE_KAT_FIPS_E = -1015.
- wolfcrypt/src/error.c: description string.
Companion fips: Shake_KnownAnswerTest (variant + msg + outLen +
expected parameters), FIPS_CAST_SHAKE case exercising SHAKE-128
and SHAKE-256 with ACVTS vectors (vsId 2836391 tcId 1 for
SHAKE-128, vsId 2836392 tcId 1 for SHAKE-256), DEGRADE_STATE
handler, CastIdToStr entry, optest case_1015. All 8 SHAKE
wrappers in fips.c (Shake128/256 Update/Final/Absorb/SqueezeBlocks)
now gate on FIPS_CAST_SHAKE and return SHAKE_KAT_FIPS_E on failure;
a block comment above the SHAKE wrapper section records the v6->v7
vendor-elected refactor rationale. PL-R36 tracked-changes
paragraph documents the framing and the updated CAST tally
(28 total: 26 baseline + 2 vendor-elected).
Verified:
make + fips-hash.sh + make; make check all pass (5 pass, 3 skip,
0 fail) with default configure, AND with the CI-representative
configure:
--enable-fips=ready --enable-opensslall --enable-opensslextra
--enable-crl --enable-harden --enable-asio --enable-certreq
--enable-certgen --enable-certext --enable-aesni
CFLAGS="-DHAVE_EX_DATA -DOPENSSL_COMPATIBLE_DEFAULTS
-DWOLFSSL_ALT_NAMES -DWC_RNG_SEED_CB -DWOLFSSL_CUSTOM_OID
-DWOLFSSL_FPKI -DASN_TEMPLATE_SKIP_ISCA_CHECK"
(9 pass, 3 skip, 0 fail).1 parent 13d5cd9 commit 9af5352
6 files changed
Lines changed: 93 additions & 7 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 | |
|---|---|---|---|
| |||
10959 | 10959 | | |
10960 | 10960 | | |
10961 | 10961 | | |
| 10962 | + | |
| 10963 | + | |
| 10964 | + | |
| 10965 | + | |
| 10966 | + | |
| 10967 | + | |
| 10968 | + | |
| 10969 | + | |
| 10970 | + | |
| 10971 | + | |
10962 | 10972 | | |
10963 | 10973 | | |
10964 | 10974 | | |
| |||
12662 | 12672 | | |
12663 | 12673 | | |
12664 | 12674 | | |
| 12675 | + | |
| 12676 | + | |
| 12677 | + | |
| 12678 | + | |
12665 | 12679 | | |
12666 | 12680 | | |
12667 | 12681 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
692 | 692 | | |
693 | 693 | | |
694 | 694 | | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
695 | 704 | | |
696 | 705 | | |
697 | 706 | | |
| |||
| 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 | + | |
| 326 | + | |
| 327 | + | |
325 | 328 | | |
326 | 329 | | |
327 | 330 | | |
| |||
| 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 | | |
| |||
80 | 95 | | |
81 | 96 | | |
82 | 97 | | |
83 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
84 | 101 | | |
85 | 102 | | |
86 | 103 | | |
| |||
0 commit comments