Skip to content

Stdlib: sodium_crypto_secretstream_xchacha20poly1305_* missing — secretstream API (ext/sodium/libsodium.c) #15462

Description

@PurHur

Category

stdlib · php-src-strict

Problem

Zend exposes libsodium secretstream (authenticated streaming encryption with rekey). This compiler has partial ext/sodium (#13078 secretbox only) but none of the sodium_crypto_secretstream_xchacha20poly1305_* helpers are registered.

Verified 2026-07-03 on master (php bin/vm.php).

Function Zend VM
sodium_crypto_secretstream_xchacha20poly1305_keygen yes missing
sodium_crypto_secretstream_xchacha20poly1305_init_push yes missing
sodium_crypto_secretstream_xchacha20poly1305_push yes missing
sodium_crypto_secretstream_xchacha20poly1305_init_pull yes missing
sodium_crypto_secretstream_xchacha20poly1305_pull yes missing
sodium_crypto_secretstream_xchacha20poly1305_rekey yes missing

Umbrella #3438; parallel slices: #15429 (AEAD), #15461 (stream xchacha20). This issue is secretstream.

php-src reference

Repro

test/repro-maintainer/maintainer_gap_sodium_crypto_secretstream.php:

php bin/vm.php test/repro-maintainer/maintainer_gap_sodium_crypto_secretstream.php
# stderr: MISSING sodium_crypto_secretstream_xchacha20poly1305_keygen

Scope (PHP-in-PHP first)

Layer Path
VM ext/sodium/sodium_crypto_secretstream_*.php + stateful push/pull in VmSodium (PHP object or VM resource for stream state)
Constants SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_* in ext/sodium/Module.php
JIT/AOT defer or mirror VM; document if VM-only initially
Tests test/compliance/cases/stdlib/sodium_crypto_secretstream.phpt

Done when

  • Repro push/pull round-trip prints ok
  • Tag constants (TAG_MESSAGE, TAG_FINAL, …) match Zend
  • Tampered ciphertext fails pull like Zend (SodiumException)
  • Targeted compliance test green

Verification

php bin/vm.php test/repro-maintainer/maintainer_gap_sodium_crypto_secretstream.php
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter sodium_crypto_secretstream'

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