Commit ac418ab
committed
slhdsa: round-3 review fixes
1. wc_SlhDsaKey_Free: make double-free / cryptocb-recursive-free safe.
- NULL out key->params at the end so a second Free is a no-op.
- Lift the cryptocb-free dispatch above the SW-cleanup gate and
re-check params!=NULL before the SHAKE/SHA2 teardown. The test
pattern in myCryptoDevCb (mirroring dilithium) recursively calls
wc_SlhDsaKey_Free from the device callback; the inner call now
does the SW cleanup once and zeroes params, the outer skips, and
wc_Shake256_Free no longer relies on idempotence to survive a
re-Free.
2. Drop the stale 'with-digest' doc-block above slhdsakey_signhash_external
left over from the round-2 helper extraction (the function takes a
raw msg + hashType, not a precomputed digest).
3. wc_SlhDsaKey_Init_id: document the BAD_FUNC_ARG return for
(id == NULL, len > 0).
4. wc_SlhDsaKey_Init_label: document the XSTRLEN-based length contract
and embedded-NUL truncation.
5. wc_SlhDsaKey_MakeKey cryptocb hook: comment the per-algorithm
meaning of pqc_sig_kg.size. ML-DSA uses NIST level, SLH-DSA uses
enum SlhDsaParam (a single security level maps to two parameter
sets, S vs F, that callers must distinguish). Devices keying off
WC_PQC_SIG_TYPE_SLHDSA must interpret size as enum SlhDsaParam.
6. slhdsa_id_label_test: zero the stack key up-front so rejection-path
tests don't read uninitialized fields if a future Init refactor
changes the moment of zeroization.1 parent 167a8bd commit ac418ab
2 files changed
Lines changed: 34 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6613 | 6613 | | |
6614 | 6614 | | |
6615 | 6615 | | |
6616 | | - | |
| 6616 | + | |
6617 | 6617 | | |
6618 | 6618 | | |
6619 | 6619 | | |
| |||
6647 | 6647 | | |
6648 | 6648 | | |
6649 | 6649 | | |
6650 | | - | |
| 6650 | + | |
| 6651 | + | |
| 6652 | + | |
6651 | 6653 | | |
6652 | 6654 | | |
6653 | 6655 | | |
| |||
6700 | 6702 | | |
6701 | 6703 | | |
6702 | 6704 | | |
6703 | | - | |
6704 | 6705 | | |
6705 | | - | |
6706 | | - | |
6707 | | - | |
6708 | | - | |
6709 | | - | |
6710 | | - | |
6711 | | - | |
| 6706 | + | |
| 6707 | + | |
| 6708 | + | |
| 6709 | + | |
| 6710 | + | |
| 6711 | + | |
| 6712 | + | |
| 6713 | + | |
| 6714 | + | |
| 6715 | + | |
6712 | 6716 | | |
| 6717 | + | |
| 6718 | + | |
6713 | 6719 | | |
6714 | 6720 | | |
6715 | 6721 | | |
| |||
6757 | 6763 | | |
6758 | 6764 | | |
6759 | 6765 | | |
| 6766 | + | |
| 6767 | + | |
| 6768 | + | |
| 6769 | + | |
| 6770 | + | |
| 6771 | + | |
6760 | 6772 | | |
6761 | 6773 | | |
6762 | 6774 | | |
| |||
6875 | 6887 | | |
6876 | 6888 | | |
6877 | 6889 | | |
| 6890 | + | |
| 6891 | + | |
| 6892 | + | |
| 6893 | + | |
| 6894 | + | |
| 6895 | + | |
| 6896 | + | |
6878 | 6897 | | |
6879 | 6898 | | |
6880 | 6899 | | |
| |||
7979 | 7998 | | |
7980 | 7999 | | |
7981 | 8000 | | |
7982 | | - | |
7983 | | - | |
7984 | | - | |
7985 | | - | |
7986 | | - | |
7987 | 8001 | | |
7988 | 8002 | | |
7989 | 8003 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54527 | 54527 | | |
54528 | 54528 | | |
54529 | 54529 | | |
| 54530 | + | |
| 54531 | + | |
| 54532 | + | |
| 54533 | + | |
| 54534 | + | |
54530 | 54535 | | |
54531 | 54536 | | |
54532 | 54537 | | |
| |||
0 commit comments