[php-src] PR #25363: Fix argument number in sodium_crypto_stream_xchacha20_xor_ic() key length error
| From: | lacatoire | Date: | Tue, 10 Nov 2026 09:33:50 +0000 |
| Subject: | [php-src] PR #25363: Fix argument number in sodium_crypto_stream_xchacha20_xor_ic() key length error | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40498@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25363
Author: lacatoire
The key length check reported argument 3 ($counter) instead of argument 4 ($key). The guard was
copied from sodium_crypto_stream_xchacha20_xor(), where the key is argument 3.
<?php
$nonce = random_bytes(SODIUM_CRYPTO_STREAM_XCHACHA20_NONCEBYTES);
try {
sodium_crypto_stream_xchacha20_xor_ic('message', $nonce, 0, 'short
key');
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
Before:
Argument #3 ($counter) must be SODIUM_CRYPTO_STREAM_XCHACHA20_KEYBYTES bytes
long
After: Argument #4 ($key) must be SODIUM_CRYPTO_STREAM_XCHACHA20_KEYBYTES bytes long