Skip to content

Stdlib: sodium_crypto_stream()/stream_xor()/stream_keygen() missing — ChaCha20 stream API (ext/sodium/libsodium.c) #15464

Closed

Description

@PurHur

Category

stdlib · php-src-strict

Problem

Beyond secretbox (#13078) and the XChaCha20 slices (#15461, #15429), Zend exposes the original ChaCha20 stream API (sodium_crypto_stream, sodium_crypto_stream_xor, sodium_crypto_stream_keygen). None are registered on this compiler despite extension_loaded('sodium') === true.

Verified 2026-07-03 on master.

Function Zend VM
sodium_crypto_stream yes missing
sodium_crypto_stream_xor yes missing
sodium_crypto_stream_keygen yes missing

php-src reference

Repro

test/repro-maintainer/maintainer_gap_sodium_crypto_stream.php:

php bin/vm.php test/repro-maintainer/maintainer_gap_sodium_crypto_stream.php
# stderr: MISSING sodium_crypto_stream

Scope (PHP-in-PHP first)

Layer Path
VM ext/sodium/sodium_crypto_stream*.php + VmSodium (host sodium_* or FFI)
Module ext/sodium/Module.php
JIT/AOT shared JitSodium lowering when literals allow
Tests test/compliance/cases/stdlib/sodium_crypto_stream.phpt

Done when

  • Repro XOR round-trip matches Zend
  • sodium_crypto_stream($len, $nonce, $key) length/errors match Zend
  • Targeted compliance test green

Verification

php bin/vm.php test/repro-maintainer/maintainer_gap_sodium_crypto_stream.php

Activity

  1. added
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jul 3, 2026
  2. PurHur commented on Jul 3, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib Advanced — batch (issues #15464, #15461, #15429)

  3. PurHur commented on Jul 3, 2026

    @PurHur
    OwnerAuthor

    Merged via #15536.

    Verification (Docker):

    php bin/vm.php test/repro-maintainer/maintainer_gap_sodium_crypto_stream.php          # stream_ok (#15464)
    php bin/vm.php test/repro-maintainer/maintainer_gap_sodium_crypto_stream_xchacha20.php  # xchacha20_stream_ok (#15461)
    php bin/vm.php test/repro/maintainer_gap_sodium_xchacha20_aead.php                  # aead_ok (#15429)
    vendor/bin/phpunit --filter 'sodium_crypto_stream|sodium_xchacha20_aead'            # OK (6 tests)
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