Commit 7c0c87a
committed
SecurityReview FND 40.2 + 36.1 + 6.4 + 10.1 + 15.1 + 26.7 + 11.3: integrity, PCT, zeroize, CMAC/SHAKE/AES-KW CASTs, DH PCT + configurable DRBG_SHA512_SEED_LEN
Seven 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
both the 32-byte (v5.3 / v6.x) and 64-byte (v7+) digests.
FND 36.1 (SLH-DSA PCT per FIPS 140-3 IG 10.3.B)
wolfcrypt/src/wc_slhdsa.c wc_SlhDsaKey_MakeKey: after key generation
performs a sign+verify pairwise consistency test on a fixed prehashed
message, returning SLH_DSA_PCT_E on failure. Companion fips.c
DEGRADE_STATE entry is in the kh-fork-fips commit.
FND 6.4 (AES-GCM zeroization on the assembly fast path)
wolfcrypt/src/aes.c AES_GCM_decrypt_C: zero the partial block before
the early return when the auth-tag check fails, not after.
FND 10.1 (AES-CMAC dedicated CAST: companion error code)
wolfssl/wolfcrypt/error-crypt.h: add CMAC_KAT_FIPS_E = -1020 with a
comment citing the IG 10.3.A authenticated-mode allowance and the
vendor-elected enhancement rationale.
wolfcrypt/src/error.c: description string for CMAC_KAT_FIPS_E.
FND 15.1 (SHAKE dedicated CAST: companion error code)
wolfssl/wolfcrypt/error-crypt.h: add SHAKE_KAT_FIPS_E = -1021 with
the IG 10.3.B comment.
wolfcrypt/src/error.c: description string for SHAKE_KAT_FIPS_E.
FND 26.7 (DH KeyGen PCT per SP 800-56A r3 sec 5.6.2.1.4)
wolfcrypt/src/dh.c wc_DhGenerateKeyPair: under HAVE_FIPS, after the
underlying make-key returns the function regenerates the public key
from the private key via the math primitives and ConstantCompare's
it against the supplied public, returning DH_PCT_E on mismatch.
wolfssl/wolfcrypt/error-crypt.h: add DH_PCT_E = -1022 with comment
citing SP 800-56A r3 sec 5.6.2.1.4 / FIPS 140-3 IG 10.3.B.
wolfcrypt/src/error.c: description string for DH_PCT_E.
FND 11.3 (AES-KW dedicated CAST per SP 800-38F sec 6.2 / RFC 3394)
wolfssl/wolfcrypt/fips_test.h: add FIPS_CAST_AES_KW = 28 and bump
FIPS_CAST_COUNT to 29.
wolfssl/wolfcrypt/error-crypt.h: add AES_KW_KAT_FIPS_E = -1023 with
comment citing SP 800-38F sec 6.2 / RFC 3394 (vendor-elected
enhancement). WC_SPAN2_LAST_E / WC_LAST_E updated.
wolfcrypt/src/error.c: description string for AES_KW_KAT_FIPS_E.
Companion changes (kh-fork-fips):
- fips_test.c: AesKw_KnownAnswerTest helper; new DoCAST case
FIPS_CAST_AES_KW with RFC 3394 sec 4.6 (AES-256 KEK / 256-bit
plaintext) vector exercising the full SP 800-38F sec 6.2 wrap
composition (6n=24 iteration counter, semiblock concatenation,
0xA6A6A6A6A6A6A6A6 IV check).
- fips.c: wc_AesKeyWrap_fips/_ex_fips/_UnWrap_fips/_UnWrap_ex_fips
refactored to gate on FIPS_CAST_AES_KW; CastIdToStr entry;
DEGRADE_STATE on AES_KW_KAT_FIPS_E (only the KW CAST is degraded
- underlying AES CASTs remain independent); explicit AES-KW entry
in wc_RunAllCast_fips alongside AES-CBC/GCM/ECB.
AES-KWP (SP 800-38F sec 6.3 internal padding) is intentionally out
of scope - the module does not implement padding for any AES mode
and requires inputs to be 8-byte aligned at the boundary. This is
a voluntary enhancement exceeding the IG 10.3.A minimum.
Companion paperwork updates (tracked changes) live in
Final_Submission_Paperwork/PL-R34-...-Security-Policy.docx and
PL-R36-...-Compliance-Summary.docx (CAST count 28 -> 29, AES-KW
coverage paragraph, no-padding policy clarification).
DRBG_SHA512_SEED_LEN configurability (carried forward from the prior
Part3 commit): wolfssl/wolfcrypt/random.h exposes the seed-length
constant as a configurable macro for OE-specific entropy claims.
Verified:
POST passes, make check passes (5 pass, 3 skip, 0 fail) with the
default --enable-fips=v7 configure, AND with the CI-representative
configure (9 pass, 3 skip, 0 fail).1 parent 1c9555c commit 7c0c87a
8 files changed
Lines changed: 138 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 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
695 | 710 | | |
696 | 711 | | |
697 | 712 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6681 | 6681 | | |
6682 | 6682 | | |
6683 | 6683 | | |
| 6684 | + | |
| 6685 | + | |
| 6686 | + | |
| 6687 | + | |
| 6688 | + | |
| 6689 | + | |
| 6690 | + | |
| 6691 | + | |
| 6692 | + | |
| 6693 | + | |
| 6694 | + | |
| 6695 | + | |
| 6696 | + | |
| 6697 | + | |
| 6698 | + | |
| 6699 | + | |
| 6700 | + | |
| 6701 | + | |
| 6702 | + | |
| 6703 | + | |
| 6704 | + | |
| 6705 | + | |
| 6706 | + | |
| 6707 | + | |
| 6708 | + | |
| 6709 | + | |
| 6710 | + | |
| 6711 | + | |
| 6712 | + | |
| 6713 | + | |
| 6714 | + | |
| 6715 | + | |
| 6716 | + | |
| 6717 | + | |
| 6718 | + | |
| 6719 | + | |
| 6720 | + | |
| 6721 | + | |
| 6722 | + | |
6684 | 6723 | | |
6685 | 6724 | | |
6686 | 6725 | | |
| |||
| 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 | + | |
| 339 | + | |
| 340 | + | |
333 | 341 | | |
334 | 342 | | |
335 | 343 | | |
| |||
| 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 | + | |
| 101 | + | |
84 | 102 | | |
85 | 103 | | |
86 | 104 | | |
| |||
| 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