Repository navigation
Conversation
…tion test In mlkem_decaps_test!, the decapsulated shared secret was discarded (let _ss = dk.decapsulate(&test_c);) and ek was not compared against dk.encapsulation_key(). Update thirdparty/wycheproof from ad6ac186a990 to ee7b4f7e6119 (which adds K and ek to the semi-expanded decapsulation vectors), compare ek after importing dk, assert ExpectedResult::Valid on decapsulation, and compare the returned shared secret with K.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The semi-expanded decapsulation test (
mlkem_decaps_test!inml-kem/tests/wycheproof.rs) discards the decapsulated shared secret (let _ss = dk.decapsulate(&test_c);), so a decapsulation returning wrong bytes still passes. It also does not compareekagainstdk.encapsulation_key().The currently pinned
thirdparty/wycheproofrevision (ad6ac186a990) has noKorekvalues in the semi-expanded decapsulation test files (mlkem_{512,768,1024}_semi_expanded_decaps_test.json), so this updates thethirdparty/wycheproofsubmodule toee7b4f7e6119("Add ML-KEM re-encryption test vectors."), where all 9 valid rows across ML-KEM-512/768/1024 include expectedKand all 27 rows includeek.Changes
thirdparty/wycheproofsubmodule fromad6ac186a990toee7b4f7e6119.test.ekagainstdk.encapsulation_key().to_bytes()after importingdkinmlkem_decaps_test!.test.result == ExpectedResult::Validwhen decapsulation succeeds and compare the returned shared secretssagainst expectedK.Verification
Ran the
ml-kemCI test matrix locally onmaster(b26db85a) withRUSTFLAGS="-Dwarnings"(rustc 1.93.0):cargo test --no-default-features— all passedcargo test— all passedcargo test --all-features— all passed (36 unit tests, 3 accumulated, 1 debug, 1 ACVP encap-decap, 1 ACVP key-gen, 3 pkcs8, 12 wycheproof, 1 doctest)cargo fmt --checkandcargo clippy --all-targets --all-features -- -Dwarnings— clean(Checked open/closed issues and PRs in
RustCrypto/KEMsfor duplicates; none found. Note: unpublished private advisories cannot be searched.)