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:
@@ -116,10 +116,14 @@ fn control_the_safe_api_compiles_without_hazmat() {
|
||||
fn a33_a_non_crypto_rng_does_not_compile() {
|
||||
let calls = [
|
||||
("SecretKey::generate", "let _ = arcanum::xwing::SecretKey::generate(&mut Counter(0));"),
|
||||
// Builder, with the R2-01 fix: `PublicKey::encapsulate` is hazmat-only now, so it no longer
|
||||
// exists for a consumer (qa_r2_01 checks that). Its place is taken by the other release
|
||||
// function that takes an RNG, `exchange::respond`.
|
||||
(
|
||||
"PublicKey::encapsulate",
|
||||
"exchange::respond",
|
||||
"let k = arcanum::xwing::SecretKey::from_bytes(&[1; 32]).unwrap(); \
|
||||
let _ = k.public_key().encapsulate(&mut Counter(0));",
|
||||
let ct = arcanum::xwing::Ciphertext::from_bytes(&[0; 1120]).unwrap(); \
|
||||
let _ = arcanum::exchange::respond(&k, k.public_key(), &ct, b\"\", &mut Counter(0));",
|
||||
),
|
||||
(
|
||||
"exchange::initiate",
|
||||
|
||||
Reference in New Issue
Block a user