Skip to content

crypto: accept the "both" PKCS#8 form for ML-DSA/ML-KEM private keys - #35510

Closed
robobun wants to merge 10 commits into
mainfrom
farm/5bba1bc9/pqc-pkcs8-both-form
Closed

robobun wants to merge 10 commits into
mainfrom
farm/5bba1bc9/pqc-pkcs8-both-form

ci: retrigger

27ecef2
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 25, 2026 in 34m 5s

Code review found 1 potential issue

Found 1 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/jsc/bindings/ncrypto.cpp:2607-2620 ML-KEM both-form consistency check does not validate z half of seed

Annotations

Check warning on line 2620 in src/jsc/bindings/ncrypto.cpp

See this annotation in the file changed.

@claude claude / Claude Code Review

ML-KEM both-form consistency check does not validate z half of seed

For ML-KEM the 64-byte seed is `d||z` (FIPS 203): `d` alone determines `ek`, while `z` is stored verbatim as the last 32 bytes of the expanded `dk` — so comparing the seed-derived `ek` against `expanded[384*k..]` validates `d` but never `z`. A "both"-form key whose `seed[32..64]` differs from `expanded[len-32..len]` passes here and is accepted, whereas RFC 9935 §6 says the implementation MUST check `expandedKey == KeyGen_internal(d, z)` and Node/OpenSSL 3.5 (which regenerates and full-compares)