ext/sodium: Add crypto_kem (X-Wing) and crypto_kem_mlkem768 bindings - #23420
ext/sodium: Add crypto_kem (X-Wing) and crypto_kem_mlkem768 bindings#23420ZacharyDuBois wants to merge 7 commits into
Conversation
|
Tried sending an email to internals but seems like y'all don't support DMARC with |
While the subscribe step? If yes, you maybe want to ping @ derickr. |
Yep, sent an intro (I think on Thursday) and that went though but shortly after I got the forensic report and it showed both SPF and DKIM failed. Looking at the headers, looks like it hit a relay causing the failure. Running an outbound test reports my email is all good. |
Fwiw, it went through anyway: https://news-web.php.net/php.internals/132308 |
|
The changes look good to me. Thanks a lot for adding these functions! |
|
@jedisct1 no problem! I have a project I am working on that needed some post-quantum stuff added in (more so for playing around). Saw these were missing and didn't feel like hassling someone to add them when I am perfectly capable of it. This is my first PR for PHP so let me know if I am missing anything! More than happy to make any edits. From what I heard on the mailing list, 8.6 is on a feature freeze so sadly it sounds like this won't make it out for 8.6 :( |
d095f86 to
a38e6ed
Compare
|
Fixed the merge conflict with |
|
Probably best for @paragonie-scott / @paragonie-security to review this. :) |
He does maintain https://github.com/jedisct1/libsodium-php so his input would probably be useful too :) |
Expose the libsodium 1.0.22 generic KEM API (X-Wing, hybrid ML-KEM768+X25519). Guarded so older libsodium builds are unaffected.
Expose libsodium 1.0.22's ML-KEM768 (FIPS 203) KEM with the same shape as the generic crypto_kem API.
Not required for correctness (they are only expanded inside guarded generated code), but makes the libsodium 1.0.22 dependency explicit.
a38e6ed to
ef1f78b
Compare
|
@Girgias committed and rebased. |
|
All good - fixed in the most recent commit. I was following the pattern in the file. Didn't notice it used both patterns (newer ones probably using what you referenced). |
|
@NickSdot should be squared away in the tests now. Not sure about the windows build failure with the ODBC extension though. I am pretty sure thats unrelated. |
An invalid ML-KEM public key encoding and a small-order X25519 ciphertext component deterministically fail inside libsodium, exercising the memzero-on-error branches. ML-KEM768 decapsulation never fails (implicit rejection), so it has no such test. Also drop the cross-family length check, which duplicated existing coverage.
libsodium 1.0.22 introduced a KEM API: X-Wing (hybrid ML-KEM768+X25519, upstream's recommended KEM) and ML-KEM768 (FIPS 203). This exposes both:
sodium_crypto_kem_{keypair,seed_keypair,secretkey,publickey,enc,dec}sodium_crypto_kem_mlkem768_{keypair,seed_keypair,secretkey,publickey,enc,dec}+SODIUM_CRYPTO_KEM[_MLKEM768]_*BYTESconstants