$ docker run --rm --name validator-libsodium-usage-php83-r13-aead-xchacha20poly1305-roundtrip-2732 -t --mount type=bind,src=/tmp/validator-status-libsodium-usage-php83-r13-aead-xchacha20poly1305-roundtrip,dst=/validator/status validator-libsodium-shared bash -lc 'set -euo pipefail /validator/tests/_shared/install_override_debs.sh exec /validator/tests/_shared/run_library_tests.sh "$@"' validator-testcase libsodium usage-php83-r13-aead-xchacha20poly1305-roundtrip -- bash -c 'PS4=$1; shift; set -x; source "$@"' validator-xtrace '__VALIDATOR_XTRACE__ ' /validator/tests/libsodium/tests/cases/usage/usage-php83-r13-aead-xchacha20poly1305-roundtrip.sh no override packages found; continuing with apt originals $key = str_repeat("\x44", SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES); $nonce = str_repeat("\x55", SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES); $plain = "php r13 xchacha20poly1305 payload"; $ad = "r13-aad"; $ct = sodium_crypto_aead_xchacha20poly1305_ietf_encrypt($plain, $ad, $nonce, $key); if ($ct === $plain) { fwrite(STDERR, "ct == plain\n"); exit(1); } $pt = sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($ct, $ad, $nonce, $key); if ($pt !== $plain) { fwrite(STDERR, "round-trip mismatch\n"); exit(1); } // Wrong AAD must fail (returns false). $bad = sodium_crypto_aead_xchacha20poly1305_ietf_decrypt($ct, "wrong-ad", $nonce, $key); if ($bad !== false) { fwrite(STDERR, "wrong AAD accepted\n"); exit(1); } echo "ok\n"; ' ok