Commit a43af0f
committed
SecurityReview FND 40.2 + 36.1 + 6.4 + 10.1 + 15.1 + 26.7: integrity, PCT, zeroize, CMAC/SHAKE CASTs, DH PCT + configurable DRBG_SHA512_SEED_LEN
Six 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 = -1019.
- 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_1019.
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 = -1020.
- 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_1020. 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 = -1021.
- 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_1021. 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).
Colleague request (not a finding): make DRBG_SHA512_SEED_LEN overridable
at build time to mirror the existing DRBG_SEED_LEN pattern so a
downstream consumer can pre-define it.
- wolfssl/wolfcrypt/random.h: wrap #define DRBG_SHA512_SEED_LEN in
#ifndef/#endif and add the matching "/* Size of the DRBG seed
(SHA-512) */" header comment.
FND 26.7 (DH KeyGen now flags PCT failure as DH_PCT_E)
Per SP 800-56A r3 sec 5.6.2.1.4 the DH (FFC) public key derived
from a freshly-generated private key must equal the supplied public
key (method (b) PCT). wc_DhGenerateKeyPair_Sync (wolfcrypt/src/dh.c)
has invoked _ffc_pairwise_consistency_test under FIPS since v5.0,
but the math-layer error code that bubbled out of the test was not
recognized by the FIPS module's degrade-state handler -- FIPS 140-3
IG 10.3.B requires the module to enter the error state on PCT
failure.
- wolfssl/wolfcrypt/error-crypt.h: add DH_PCT_E = -1022; bump
WC_SPAN2_LAST_E and WC_LAST_E to -1022. Comment cites SP 800-56A
r3 sec 5.6.2.1.4 and FIPS 140-3 IG 10.3.B.
- wolfcrypt/src/error.c: description string for DH_PCT_E.
- wolfcrypt/src/dh.c wc_DhGeneratePublic + wc_DhGenerateKeyPair_Sync:
on _ffc_pairwise_consistency_test failure under HAVE_FIPS, remap
the math error to DH_PCT_E so the FIPS module recognizes it.
Inline comment at the remap sites cites SP 800-56A r3 sec
5.6.2.1.4 and FIPS 140-3 IG 10.3.B.
Companion fips changes add the DEGRADE_STATE(FIPS_CAST_DH_PRIMITIVE_Z)
handler for DH_PCT_E and the optest case_1022.
Paperwork (PL-R36 Compliance Summary): tracked-changes paragraph
inserted after the existing DH PCT description, noting the v7.0.0
enhancement (DH_PCT_E error code, degrade-state transition per
IG 10.3.B).
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 cf2db42 commit a43af0f
8 files changed
Lines changed: 132 additions & 12 deletions
File tree
- wolfcrypt/src
- wolfssl/wolfcrypt
| 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 | |
|---|---|---|---|
| |||
10962 | 10962 | | |
10963 | 10963 | | |
10964 | 10964 | | |
| 10965 | + | |
| 10966 | + | |
| 10967 | + | |
| 10968 | + | |
| 10969 | + | |
| 10970 | + | |
| 10971 | + | |
| 10972 | + | |
| 10973 | + | |
| 10974 | + | |
10965 | 10975 | | |
10966 | 10976 | | |
10967 | 10977 | | |
| |||
12665 | 12675 | | |
12666 | 12676 | | |
12667 | 12677 | | |
| 12678 | + | |
| 12679 | + | |
| 12680 | + | |
| 12681 | + | |
12668 | 12682 | | |
12669 | 12683 | | |
12670 | 12684 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1400 | 1400 | | |
1401 | 1401 | | |
1402 | 1402 | | |
1403 | | - | |
1404 | | - | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
1405 | 1417 | | |
1406 | 1418 | | |
1407 | 1419 | | |
| |||
1428 | 1440 | | |
1429 | 1441 | | |
1430 | 1442 | | |
1431 | | - | |
1432 | | - | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
1433 | 1457 | | |
1434 | 1458 | | |
1435 | 1459 | | |
| |||
| 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 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
695 | 707 | | |
696 | 708 | | |
697 | 709 | | |
| |||
| 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 | |
|---|---|---|---|
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
330 | | - | |
331 | | - | |
332 | | - | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
333 | 339 | | |
334 | 340 | | |
335 | 341 | | |
| |||
| 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 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
60 | 61 | | |
61 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| |||
0 commit comments