Skip to content

Commit 8f6cb8d

Browse files
authored
ml-kem: fix Wycheproof (#224)
After merging #207 we need to handle errors from invalid hashes
1 parent d8943df commit 8f6cb8d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ml-kem/tests/wycheproof.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,12 @@ macro_rules! mlkem_decaps_test {
235235
};
236236

237237
#[allow(deprecated)]
238-
let dk = DecapsulationKey::from_expanded(&test_dk).expect("should be valid");
238+
let dk_result = DecapsulationKey::from_expanded(&test_dk);
239+
if dk_result.is_err() {
240+
assert_eq!(test.result, ExpectedResult::Invalid);
241+
continue;
242+
}
243+
let dk = dk_result.unwrap();
239244

240245
let test_c: EncodedCiphertext = match decode_optional_hex(&test.c, "c") {
241246
Some(dk) => dk,

0 commit comments

Comments
 (0)