Category
stdlib · php-src-strict · libsodium AEAD
Problem
PHP exposes XChaCha20-Poly1305 IETF AEAD helpers via sodium_crypto_aead_xchacha20poly1305_ietf_encrypt() / _decrypt(). Zend registers them in ext/sodium; this compiler ships partial sodium coverage but these symbols are not registered — function_exists() is false on bin/vm.php.
Related stream helpers (sodium_crypto_stream_xchacha20_xor, sodium_crypto_kx_*) are also absent; this issue scopes the AEAD pair first.
php-src reference
Repro (failure today)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php test/repro/maintainer_gap_sodium_xchacha20_aead.php
php -r "var_export(function_exists(\"sodium_crypto_aead_xchacha20poly1305_ietf_encrypt\"));"
'
| Runtime |
Result |
| Zend PHP 8.2+ (sodium ext) |
true; encrypt/decrypt round-trip |
bin/vm.php |
false; repro exits 1 (…_encrypt not registered) |
Scope (this repo)
| Component |
Path |
Notes |
| VM builtin |
ext/sodium/ PHP wrappers + module registration |
Delegate to libsodium via existing thin ABI |
| Length guards |
reject short key/nonce with ValueError matching Zend |
Use SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_* constants |
| JIT/AOT |
VM-only v1 acceptable |
Capability matrix note |
Implement in ext/sodium/ + shared crypto helpers; do not add C-only duplicates.
Done when
function_exists('sodium_crypto_aead_xchacha20poly1305_ietf_encrypt') and _decrypt true on VM
- Repro round-trip green on
bin/vm.php
- Tampered ciphertext / wrong nonce raises
SodiumException like Zend
- Compliance:
test/compliance/cases/stdlib/sodium_xchacha20_aead.phpt green on VM
Strictness: php-src-strict
Category
stdlib· php-src-strict · libsodium AEADProblem
PHP exposes XChaCha20-Poly1305 IETF AEAD helpers via
sodium_crypto_aead_xchacha20poly1305_ietf_encrypt()/_decrypt(). Zend registers them inext/sodium; this compiler ships partial sodium coverage but these symbols are not registered —function_exists()is false onbin/vm.php.Related stream helpers (
sodium_crypto_stream_xchacha20_xor,sodium_crypto_kx_*) are also absent; this issue scopes the AEAD pair first.php-src reference
ext/sodium/libsodium.c—PHP_FUNCTION(sodium_crypto_aead_xchacha20poly1305_ietf_encrypt)/_decryptext/sodium/libsodium.stub.phpRepro (failure today)
true; encrypt/decrypt round-tripbin/vm.phpfalse; repro exits 1 (…_encrypt not registered)Scope (this repo)
ext/sodium/PHP wrappers + module registrationSODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_*constantsImplement in
ext/sodium/+ shared crypto helpers; do not add C-only duplicates.Done when
function_exists('sodium_crypto_aead_xchacha20poly1305_ietf_encrypt')and_decrypttrue on VMbin/vm.phpSodiumExceptionlike Zendtest/compliance/cases/stdlib/sodium_xchacha20_aead.phptgreen on VMStrictness: php-src-strict