com php-src: Fixed bug #67707 IV not needed for ECB encryption mode, but it returns a warning: NEWS ext/mcrypt/mcrypt.c ext/mcrypt/tests/bug67707.phpt

From: Date: Tue, 10 Jan 2017 22:42:44 +0000
Subject: com php-src: Fixed bug #67707 IV not needed for ECB encryption mode, but it returns a warning: NEWS ext/mcrypt/mcrypt.c ext/mcrypt/tests/bug67707.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-96683@lists.php.net to get a copy of this message
Commit: d9cd2876d97d79029a980e7c89aa441fd46a4bf2 Author: Robrecht Plaisier <php@mcq8.be> Fri, 14 Aug 2015 19:16:09 +0000 Committer: Nikita Popov <nikic@php.net> Tue, 10 Jan 2017 23:42:44 +0100 Parents: 13edec75a32f8de674a9e0d5b295f9b872212343 Branches: PHP-7.0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d9cd2876d97d79029a980e7c89aa441fd46a4bf2 Log: Fixed bug #67707 IV not needed for ECB encryption mode, but it returns a warning Bugs: https://bugs.php.net/67707 Changed paths: M NEWS M ext/mcrypt/mcrypt.c A ext/mcrypt/tests/bug67707.phpt Diff: diff --git a/NEWS b/NEWS index d9be284..7e0d1ac 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,10 @@ PHP NEWS . Fixed bug #67583 (double fastcgi_end_request on max_children limit). (Dmitry Saprykin) +- MCrypt: + . Fixed bug #67707 (IV not needed for ECB encryption mode, but it returns a + warning). (Robrecht Plaisier) + - OpenSSL: . Fixed bug #71519 (add serial hex to return value array). (xrobau) diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c index b3f6816..c589b40 100644 --- a/ext/mcrypt/mcrypt.c +++ b/ext/mcrypt/mcrypt.c @@ -572,7 +572,9 @@ PHP_FUNCTION(mcrypt_generic_init) memcpy(key_s, key, key_len); if (iv_len != iv_size) { - php_error_docref(NULL, E_WARNING, "Iv size incorrect; supplied length: %zd, needed: %d", iv_len, iv_size); + if (mcrypt_enc_mode_has_iv(pm->td)) { + php_error_docref(NULL, E_WARNING, "Iv size incorrect; supplied length: %zd, needed: %d", iv_len, iv_size); + } if (iv_len > iv_size) { iv_len = iv_size; } diff --git a/ext/mcrypt/tests/bug67707.phpt b/ext/mcrypt/tests/bug67707.phpt new file mode 100644 index 0000000..9ba13ab --- /dev/null +++ b/ext/mcrypt/tests/bug67707.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #67707 IV not needed for ECB encryption mode, but it returns a warning +--SKIPIF-- +<?php if (!extension_loaded("mcrypt")) print "skip"; ?> +--FILE-- +<?php +$td = mcrypt_module_open('rijndael-256', '', 'ecb', ''); +mcrypt_generic_init($td, 'secret key', NULL); +?> +--EXPECTF--

« previous php.cvs (#96683) next »