diff options
author | Nikita Popov <nikic@php.net> | 2015-10-03 10:13:06 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2015-10-03 10:13:44 +0200 |
commit | e892e2e25339c2f582dbb3f1b7e3660e9bf1ecee (patch) | |
tree | e95a8ee3b636e48da51129ff449360b1a1d6c86d | |
parent | b2988714aa08d933a33dd0e0101f5f0c9d08369b (diff) | |
parent | fe1933aae2185624bd51b1fd46b8d959f88daf4a (diff) | |
download | php-git-e892e2e25339c2f582dbb3f1b7e3660e9bf1ecee.tar.gz |
Merge branch 'PHP-5.6' into PHP-7.0
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | ext/mcrypt/mcrypt.c | 4 | ||||
-rw-r--r-- | ext/mcrypt/tests/bug70625.phpt | 17 |
3 files changed, 25 insertions, 0 deletions
@@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 15 Oct 2015, PHP 7.0.0 RC 5 +- Mcrypt: + . Fixed bug #70625 (mcrypt_encrypt() won't return data when no IV was + specified under RC4). (Nikita) + - Phpdbg . Fixed bug #70614 (incorrect exit code in -rr mode with Exceptions). (Bob) diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c index a9098ed283..bc65378911 100644 --- a/ext/mcrypt/mcrypt.c +++ b/ext/mcrypt/mcrypt.c @@ -1218,6 +1218,10 @@ static int php_mcrypt_ensure_valid_iv(MCRYPT td, const char *iv, int iv_size) /* { if (mcrypt_enc_mode_has_iv(td) == 1) { int expected_iv_size = mcrypt_enc_get_iv_size(td); + if (expected_iv_size == 0) { + /* Algorithm does not use IV, even though mode supports it */ + return SUCCESS; + } if (!iv) { php_error_docref(NULL, E_WARNING, diff --git a/ext/mcrypt/tests/bug70625.phpt b/ext/mcrypt/tests/bug70625.phpt new file mode 100644 index 0000000000..e9c0de0be3 --- /dev/null +++ b/ext/mcrypt/tests/bug70625.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #70625: mcrypt_encrypt() : won't return data when no IV was specified under RC4 +--SKIPIF-- +<?php if (!extension_loaded("mcrypt")) print "skip"; ?> +--FILE-- +<?php + +$key = 'secretkey'; +$ciphertext = mcrypt_encrypt(MCRYPT_ARCFOUR, $key, 'payload', MCRYPT_MODE_STREAM); +var_dump(bin2hex($ciphertext)); +$plaintext = mcrypt_decrypt(MCRYPT_ARCFOUR, $key, $ciphertext, MCRYPT_MODE_STREAM); +var_dump($plaintext); + +?> +--EXPECT-- +string(14) "d5c9a57023d0f1" +string(7) "payload" |