Commit e48be7b
Clear ML-DSA key generation outputs on failure
Zeroize the pk and sk output buffers on the keypair_internal error
paths, so a caller that ignores the return value cannot mistake a
partially written or PCT-failed key pair for a valid one. Clear with
mld_zeroize so scrubbing of secret key material is not optimized out.
Fold the keypair_internal error paths into a single cleanup.
Per API-CONVENTIONS.md, an output buffer must be left either unchanged
or fully zeroized on error. keypair_internal may have partially written
its outputs before failing, so it zeroizes them; the randomized
mld_sign_keypair wrapper needs no zeroization of its own, as it leaves
the outputs untouched when randomness or allocation fails before
keypair_internal runs.
Co-authored-by: Joe Doyle <joseph.doyle@trailofbits.com>
Co-authored-by: Codex <codex@openai.com>
Signed-off-by: Matthias J. Kannwischer <matthias@zerorisc.com>1 parent f10e8f1 commit e48be7b
1 file changed
Lines changed: 11 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
394 | 401 | | |
395 | 402 | | |
396 | | - | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
397 | 406 | | |
398 | 407 | | |
399 | | - | |
400 | | - | |
401 | | - | |
| 408 | + | |
402 | 409 | | |
403 | 410 | | |
404 | 411 | | |
| |||
0 commit comments