Skip to content

mlkem: add re-encryption comparison vectors to the seed-key files - #274

Merged
cpu merged 1 commit into
C2SP:mainfrom
007bsd:mlkem-reenc-seed-vectors
Sep 2, 2026
Merged

cpu merged 1 commit into
C2SP:mainfrom
007bsd:mlkem-reenc-seed-vectors

Conversation

@007bsd

@007bsd 007bsd commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Adds message-preserving ML-KEM re-encryption test vectors to the seed-key files
(mlkem_{512,768,1024}_test.json): each fails to decapsulate on a correct
implementation but returns the real shared secret on one that skips part of the
ciphertext comparison.

#254 added this kind of vector only to the semi-expanded decaps files; the
seed-key files have none (their existing reject vectors change the message, so
they cannot isolate a single-region skip). This adds one MLKEMTest group per
parameter set (7/8/9 tests), one single-byte modification per structural region:
byte 0, each c1 block boundary, and c2 start / interior / N-32 / last.

Motivated by the incomplete-comparison class behind CVE-2026-10097 and
CVE-2026-6330 (public, fixed); submitted post-fix per CONTRIBUTING. Generator and
cross-checks (OpenSSL, wolfSSL, Go crypto/mlkem):
https://github.com/007bsd/mlkem-implicit-rejection

One MLKEMTest group per parameter set: single-byte, message-preserving
ciphertext modifications that a conforming decapsulation implicitly rejects.
More: https://github.com/007bsd/mlkem-implicit-rejection

@cpu cpu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This looks great.

Did you have any feedback about the process & vectorgen? Was it relatively painless? 🤞

@007bsd

007bsd commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks! This looks great.

Did you have any feedback about the process & vectorgen? Was it relatively painless? 🤞

Thanks! Along with the CVEs above, these also cover the RustSec advisory I filed (#3151) -- same implicit-rejection class.

The process was smooth. My only real question was whether these belonged with the decap vectors or in their own group. We went with a separate group, and vectorgen was easy to work with from there.

@cpu

cpu commented Sep 2, 2026

Copy link
Copy Markdown
Member

I'm going to merge this but if anyone shows up with feedback after the fact we can iterate further.

Thanks for the contribution!

@cpu
cpu merged commit 3fa63dd into C2SP:main Sep 2, 2026
4 checks passed
007bsd added a commit to 007bsd/mlkem-cmov-key-recovery that referenced this pull request Sep 18, 2026
…vectors

A conforming decapsulation must reject the tampered ciphertexts in the merged
C2SP/wycheproof#274 re-encryption comparison vectors (ML-KEM-512/768/1024). The
skipped-cmov fault accepts every ciphertext, so it fails them outright. Link the
canonical suite and the generator repo 007bsd/mlkem-implicit-rejection so a reader
can check their own build.
007bsd added a commit to 007bsd/ml-kem-key-recovery that referenced this pull request Sep 18, 2026
…vectors

The merged C2SP/wycheproof#274 re-encryption comparison vectors (ML-KEM-512/768/
1024) are tampered ciphertexts a conforming decapsulation must reject; an
incomplete FO comparison fails them. Link the canonical suite and the generator
repo 007bsd/mlkem-implicit-rejection so a reader can check their own build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants