Skip to content

Stdlib: sodium_crypto_aead_xchacha20poly1305_ietf_* missing — XChaCha20-Poly1305 AEAD (ext/sodium/libsodium.c) #15429

Description

@PurHur

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions