fix: QA second review R2-01 to R2-05

R2-01: PublicKey::encapsulate, SecretKey::decapsulate and SharedSecret::as_bytes
are hazmat-only; release consumers reach keys only through exchange and seal.
R2-02: PublicKey::from_bytes refuses a non-canonical X25519 half (bit 255 set,
or a value of at least 2^255 - 19). Honest keys and the draft vectors pass.
R2-03: schedule::expand takes one static label and one fixed-width field, so
its info is injective by signature. v1 bytes unchanged (golden vectors pass).
R2-04: generate, initiate, respond and seal say the RNG must be the OS RNG.
R2-05: Initiation is ZeroizeOnDrop; seal's buffer stays Zeroizing until the
plaintext in it is encrypted, so the MessageTooLong path wipes it.
QA's A-33 case for PublicKey::encapsulate moves to exchange::respond, and its
A-08 test pins the new expand signature to the v1 encoding.
This commit is contained in:
2026-11-25 08:37:11 +01:00
parent f3e17f3d5c
commit 6780abc0c2
8 changed files with 152 additions and 31 deletions
+1
View File
@@ -54,6 +54,7 @@ fn a28_secret_types_are_zeroize_on_drop() {
assert_zeroize_on_drop::<SharedSecret>();
assert_zeroize_on_drop::<Session>();
assert_zeroize_on_drop::<WireGuardPsk>();
assert_zeroize_on_drop::<exchange::Initiation<'static>>(); // R2-05, added by the builder with the fix
}
/// QA A-28: `Debug` of every secret type is redacted (the PSK and Session case is already in