Skip to content

ext/sodium: Accept an optional tweak for ipcrypt ND and NDX - #25246

Open
rafamolina1 wants to merge 1 commit into
php:masterfrom
rafamolina1:gh25242-sodium-ipcrypt
Open

rafamolina1 wants to merge 1 commit into
php:masterfrom
rafamolina1:gh25242-sodium-ipcrypt

Conversation

@rafamolina1

Copy link
Copy Markdown

Summary

  • sodium_crypto_ipcrypt_nd_encrypt() and sodium_crypto_ipcrypt_ndx_encrypt() take an optional $tweak. Omitting it still generates a random tweak, so existing calls keep working.
  • Known-answer tests cover the deterministic, ND, NDX, and prefix-preserving vectors from draft-denis-ipcrypt.

The ipcrypt functions themselves already landed in PHP 8.6 (GH-20960). This follows up on GH-25242 by making the non-deterministic modes reproducible.

Test plan

  • make test TESTS="ext/sodium/tests/crypto_ipcrypt.phpt ext/sodium/tests/crypto_ipcrypt_nd.phpt ext/sodium/tests/crypto_ipcrypt_pfx.phpt ext/sodium/tests/sodium_bin2ip.phpt" against libsodium 1.0.21

Callers can reproduce a ciphertext from the ipcrypt draft vectors.
Omitting the tweak still generates a random one.
@rafamolina1

Copy link
Copy Markdown
Author

Hello, team, waiting for a review on this, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant