diff options
author | Robrecht Plaisier <php@mcq8.be> | 2015-08-14 19:16:09 +0000 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2017-01-10 23:42:44 +0100 |
commit | d9cd2876d97d79029a980e7c89aa441fd46a4bf2 (patch) | |
tree | 26582494a2b83efbdd58be1819b1fa5e3c4326a1 | |
parent | 13edec75a32f8de674a9e0d5b295f9b872212343 (diff) | |
download | php-git-d9cd2876d97d79029a980e7c89aa441fd46a4bf2.tar.gz |
Fixed bug #67707 IV not needed for ECB encryption mode, but it returns a warning
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | ext/mcrypt/mcrypt.c | 4 | ||||
-rw-r--r-- | ext/mcrypt/tests/bug67707.phpt | 10 |
3 files changed, 17 insertions, 1 deletions
@@ -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 b3f681654b..c589b40fab 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 0000000000..9ba13ab0ac --- /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-- |