[php-src] Issue #19994: ext-openssl is inconsistent in cipher algorithm accepted in functions vs the ones returned by openssl_get_cipher_methods

From: Date: Mon, 29 Sep 2025 15:58:47 +0000
Subject: [php-src] Issue #19994: ext-openssl is inconsistent in cipher algorithm accepted in functions vs the ones returned by openssl_get_cipher_methods
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-250936@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/19994 Author: stof ### Description The following code: ```php <?php $ciphers = openssl_get_cipher_methods(); foreach ($ciphers as $cipher) { echo $cipher.': '; echo openssl_cipher_iv_length($cipher); echo "\n"; } ``` Resulted in this output: ``` aes-128-cbc: 16 aes-128-cbc-cts: PHP Warning: openssl_cipher_iv_length(): Unknown cipher algorithm in /home/stof/src/Incenteev/Incenteev/build/tmp.php on line 15 PHP Stack trace: PHP 1. {main}() /home/stof/src/Incenteev/Incenteev/build/tmp.php:0 PHP 2. openssl_cipher_iv_length($cipher_algo = 'aes-128-cbc-cts') /home/stof/src/Incenteev/Incenteev/build/tmp.php:15 aes-128-cbc-hmac-sha1: 16 aes-128-cbc-hmac-sha256: 16 aes-128-ccm: 12 aes-128-cfb: 16 aes-128-cfb1: 16 aes-128-cfb8: 16 aes-128-ctr: 16 aes-128-ecb: 0 aes-128-gcm: 12 aes-128-ocb: 12 aes-128-ofb: 16 aes-128-siv: PHP Warning: openssl_cipher_iv_length(): Unknown cipher algorithm in /home/stof/src/Incenteev/Incenteev/build/tmp.php on line 15 PHP Stack trace: PHP 1. {main}() /home/stof/src/Incenteev/Incenteev/build/tmp.php:0 PHP 2. openssl_cipher_iv_length($cipher_algo = 'aes-128-siv') /home/stof/src/Incenteev/Incenteev/build/tmp.php:15 [REDACTED: more algorithms] ``` But I expected this output instead: no warnings about unknown algorithms, as I'm using the list of known algorithms as input. ### PHP Version ```plain PHP 8.3.25 (cli) (built: Aug 29 2025 12:01:53) (NTS) Copyright (c) The PHP Group Zend Engine v4.3.25, Copyright (c) Zend Technologies with Zend OPcache v8.3.25, Copyright (c), by Zend Technologies with Xdebug v3.4.5, Copyright (c) 2002-2025, by Derick Rethans with blackfire v1.92.44~linux-x64-non_zts83, https://blackfire.io, by Blackfire In case this is relevant, I'm using OpenSSL 3.0.13 ``` ### Operating System Ubuntu 24.04

« previous php.bugs (#250936) next »