summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2014-03-05 12:42:01 +0100
committerNikita Popov <nikic@php.net>2014-03-05 15:32:32 +0100
commite5738d3bc9aa2e8110e797ba987891708bc7e72e (patch)
treeec11e91db29e5eeee18a6652a48fcaa248730358
parentb9737aa08ea2228e23b3f9289189a14a7cfda800 (diff)
downloadphp-git-e5738d3bc9aa2e8110e797ba987891708bc7e72e.tar.gz
Provide expected IV length in IV error messages
-rw-r--r--ext/mcrypt/mcrypt.c42
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc.phpt2
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt4
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt4
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc_variation5.phpt40
-rw-r--r--ext/mcrypt/tests/mcrypt_cfb.phpt2
-rw-r--r--ext/mcrypt/tests/mcrypt_decrypt.phpt4
-rw-r--r--ext/mcrypt/tests/mcrypt_decrypt_3des_cbc.phpt4
-rw-r--r--ext/mcrypt/tests/mcrypt_decrypt_variation5.phpt40
-rw-r--r--ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt4
-rw-r--r--ext/mcrypt/tests/mcrypt_encrypt_variation5.phpt40
-rw-r--r--ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt16
12 files changed, 108 insertions, 94 deletions
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c
index a8dbc4203a..91be96ece9 100644
--- a/ext/mcrypt/mcrypt.c
+++ b/ext/mcrypt/mcrypt.c
@@ -1250,6 +1250,31 @@ static int php_mcrypt_ensure_valid_key_size(MCRYPT td, int key_size TSRMLS_DC) /
}
/* }}} */
+static int php_mcrypt_ensure_valid_iv(MCRYPT td, const char *iv, int iv_size TSRMLS_DC) /* {{{ */
+{
+ if (mcrypt_enc_mode_has_iv(td) == 1) {
+ int expected_iv_size = mcrypt_enc_get_iv_size(td);
+
+ if (!iv) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,
+ "Encryption mode requires an initialization vector of size %d", expected_iv_size
+ );
+ return FAILURE;
+ }
+
+ if (iv_size != expected_iv_size) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,
+ "Received initialization vector of size %d, but size %d is required "
+ "for this encryption mode", iv_size, expected_iv_size
+ );
+ return FAILURE;
+ }
+ }
+
+ return SUCCESS;
+}
+/* }}} */
+
static void php_mcrypt_do_crypt(char* cipher, const char *key, int key_len, const char *data, int data_len, char *mode, const char *iv, int iv_len, int dencrypt, zval* return_value TSRMLS_DC) /* {{{ */
{
char *cipher_dir_string;
@@ -1266,25 +1291,14 @@ static void php_mcrypt_do_crypt(char* cipher, const char *key, int key_len, cons
RETURN_FALSE;
}
- /* Checking for key-length */
if (php_mcrypt_ensure_valid_key_size(td, key_len TSRMLS_CC) == FAILURE) {
mcrypt_module_close(td);
RETURN_FALSE;
}
-
- /* IV is required */
- if (mcrypt_enc_mode_has_iv(td) == 1) {
- if (!iv) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Encryption mode requires an initialization vector");
- mcrypt_module_close(td);
- RETURN_FALSE;
- }
- if (iv_len != mcrypt_enc_get_iv_size(td)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_IV_WRONG_SIZE);
- mcrypt_module_close(td);
- RETURN_FALSE;
- }
+ if (php_mcrypt_ensure_valid_iv(td, iv, iv_len TSRMLS_CC) == FAILURE) {
+ mcrypt_module_close(td);
+ RETURN_FALSE;
}
/* Check blocksize */
diff --git a/ext/mcrypt/tests/mcrypt_cbc.phpt b/ext/mcrypt/tests/mcrypt_cbc.phpt
index cf723e3803..c2e879370d 100644
--- a/ext/mcrypt/tests/mcrypt_cbc.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc.phpt
@@ -27,5 +27,5 @@ PHP Testfest 2008
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-Warning: mcrypt_cbc(): Encryption mode requires an initialization vector in %s on line %d
+Warning: mcrypt_cbc(): Encryption mode requires an initialization vector of size 16 in %s on line %d
bool(false)
diff --git a/ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt b/ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt
index c3559231be..e610f7cfa0 100644
--- a/ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt
@@ -103,7 +103,7 @@ iv length=4
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
+Warning: mcrypt_cbc(): Received initialization vector of size 4, but size 8 is required for this encryption mode in %s on line %d
string(0) ""
iv length=8
@@ -115,6 +115,6 @@ iv length=9
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
+Warning: mcrypt_cbc(): Received initialization vector of size 9, but size 8 is required for this encryption mode in %s on line %d
string(0) ""
===DONE===
diff --git a/ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt b/ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt
index 978e263588..c5606e71a0 100644
--- a/ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt
@@ -86,7 +86,7 @@ iv length=4
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
+Warning: mcrypt_cbc(): Received initialization vector of size 4, but size 8 is required for this encryption mode in %s on line %d
string(0) ""
iv length=8
@@ -98,6 +98,6 @@ iv length=9
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
+Warning: mcrypt_cbc(): Received initialization vector of size 9, but size 8 is required for this encryption mode in %s on line %d
string(0) ""
===DONE===
diff --git a/ext/mcrypt/tests/mcrypt_cbc_variation5.phpt b/ext/mcrypt/tests/mcrypt_cbc_variation5.phpt
index 24d518d096..884d90963e 100644
--- a/ext/mcrypt/tests/mcrypt_cbc_variation5.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc_variation5.phpt
@@ -125,47 +125,47 @@ fclose($fp);
--int 0--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--int 1--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--int 12345--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--int -12345--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--float 10.5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--float -10.5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--float 12.3456789000e10--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--float -12.3456789000e10--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--float .5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--empty array--
@@ -190,47 +190,47 @@ string(0) ""
--uppercase NULL--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--lowercase null--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--lowercase true--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--lowercase false--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--uppercase TRUE--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--uppercase FALSE--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--empty string DQ--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--empty string SQ--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--instance of classWithToString--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--instance of classWithoutToString--
@@ -240,12 +240,12 @@ string(0) ""
--undefined var--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--unset var--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--resource--
diff --git a/ext/mcrypt/tests/mcrypt_cfb.phpt b/ext/mcrypt/tests/mcrypt_cfb.phpt
index a82ea46d11..5b6842310b 100644
--- a/ext/mcrypt/tests/mcrypt_cfb.phpt
+++ b/ext/mcrypt/tests/mcrypt_cfb.phpt
@@ -26,5 +26,5 @@ PHP Testfest 2008
Deprecated: Function mcrypt_cfb() is deprecated in %s on line %d
-Warning: mcrypt_cfb(): Encryption mode requires an initialization vector in %s on line %d
+Warning: mcrypt_cfb(): Encryption mode requires an initialization vector of size 16 in %s on line %d
bool(false)
diff --git a/ext/mcrypt/tests/mcrypt_decrypt.phpt b/ext/mcrypt/tests/mcrypt_decrypt.phpt
index f615889f9a..f10757c45d 100644
--- a/ext/mcrypt/tests/mcrypt_decrypt.phpt
+++ b/ext/mcrypt/tests/mcrypt_decrypt.phpt
@@ -22,8 +22,8 @@ var_dump(mcrypt_decrypt(MCRYPT_BLOWFISH, "FooBar", $enc_data, MCRYPT_MODE_CBC, $
--EXPECTF--
PHP Testfest 2008
-Warning: mcrypt_decrypt(): Encryption mode requires an initialization vector in %s on line %d
+Warning: mcrypt_decrypt(): Encryption mode requires an initialization vector of size 16 in %s on line %d
bool(false)
-Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in %s on line %d
+Warning: mcrypt_decrypt(): Received initialization vector of size 16, but size 8 is required for this encryption mode in %s on line %d
bool(false)
diff --git a/ext/mcrypt/tests/mcrypt_decrypt_3des_cbc.phpt b/ext/mcrypt/tests/mcrypt_decrypt_3des_cbc.phpt
index f044908034..60af213911 100644
--- a/ext/mcrypt/tests/mcrypt_decrypt_3des_cbc.phpt
+++ b/ext/mcrypt/tests/mcrypt_decrypt_3des_cbc.phpt
@@ -92,7 +92,7 @@ string(0) ""
iv length=4
-Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in %s on line %d
+Warning: mcrypt_decrypt(): Received initialization vector of size 4, but size 8 is required for this encryption mode in %s on line %d
string(0) ""
iv length=8
@@ -100,6 +100,6 @@ string(32) "659ec947f4dc3a3b9c50de744598d3c8"
iv length=9
-Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in %s on line %d
+Warning: mcrypt_decrypt(): Received initialization vector of size 9, but size 8 is required for this encryption mode in %s on line %d
string(0) ""
===DONE===
diff --git a/ext/mcrypt/tests/mcrypt_decrypt_variation5.phpt b/ext/mcrypt/tests/mcrypt_decrypt_variation5.phpt
index 60941fed33..0f5093ba88 100644
--- a/ext/mcrypt/tests/mcrypt_decrypt_variation5.phpt
+++ b/ext/mcrypt/tests/mcrypt_decrypt_variation5.phpt
@@ -124,39 +124,39 @@ fclose($fp);
*** Testing mcrypt_decrypt() : usage variation ***
--int 0--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--int 1--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--int 12345--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--int -12345--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--float 10.5--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--float -10.5--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--float 12.3456789000e10--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--float -12.3456789000e10--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--float .5--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--empty array--
@@ -176,39 +176,39 @@ Error: 2 - mcrypt_decrypt() expects parameter 5 to be string, array given, %s(%d
string(0) ""
--uppercase NULL--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--lowercase null--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--lowercase true--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--lowercase false--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--uppercase TRUE--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--uppercase FALSE--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--empty string DQ--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--empty string SQ--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--instance of classWithToString--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--instance of classWithoutToString--
@@ -216,11 +216,11 @@ Error: 2 - mcrypt_decrypt() expects parameter 5 to be string, object given, %s(%
string(0) ""
--undefined var--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--unset var--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--resource--
diff --git a/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt b/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt
index 8f635a7869..51a64943b2 100644
--- a/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt
+++ b/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt
@@ -85,7 +85,7 @@ string(0) ""
iv length=4
-Warning: mcrypt_encrypt(): The IV parameter must be as long as the blocksize in %s on line %d
+Warning: mcrypt_encrypt(): Received initialization vector of size 4, but size 8 is required for this encryption mode in %s on line %d
string(0) ""
iv length=8
@@ -93,6 +93,6 @@ string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b6
iv length=9
-Warning: mcrypt_encrypt(): The IV parameter must be as long as the blocksize in %s on line %d
+Warning: mcrypt_encrypt(): Received initialization vector of size 9, but size 8 is required for this encryption mode in %s on line %d
string(0) ""
===DONE===
diff --git a/ext/mcrypt/tests/mcrypt_encrypt_variation5.phpt b/ext/mcrypt/tests/mcrypt_encrypt_variation5.phpt
index 07c5e158cb..fdba526840 100644
--- a/ext/mcrypt/tests/mcrypt_encrypt_variation5.phpt
+++ b/ext/mcrypt/tests/mcrypt_encrypt_variation5.phpt
@@ -125,39 +125,39 @@ fclose($fp);
*** Testing mcrypt_encrypt() : usage variation ***
--int 0--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--int 1--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--int 12345--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--int -12345--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--float 10.5--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--float -10.5--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--float 12.3456789000e10--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--float -12.3456789000e10--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--float .5--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--empty array--
@@ -177,39 +177,39 @@ Error: 2 - mcrypt_encrypt() expects parameter 5 to be string, array given, %s(%d
string(0) ""
--uppercase NULL--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--lowercase null--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--lowercase true--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--lowercase false--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--uppercase TRUE--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--uppercase FALSE--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--empty string DQ--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--empty string SQ--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--instance of classWithToString--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--instance of classWithoutToString--
@@ -217,11 +217,11 @@ Error: 2 - mcrypt_encrypt() expects parameter 5 to be string, object given, %s(%
string(0) ""
--undefined var--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--unset var--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
string(0) ""
--resource--
diff --git a/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt b/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt
index decbff2e3a..621f7b1dbd 100644
--- a/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt
+++ b/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt
@@ -116,30 +116,30 @@ iv length=0
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
+Warning: mcrypt_cbc(): Received initialization vector of size 0, but size 16 is required for this encryption mode in %s on line %d
string(0) ""
-Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in %s on line %d
+Warning: mcrypt_decrypt(): Received initialization vector of size 0, but size 16 is required for this encryption mode in %s on line %d
string(0) ""
iv length=0
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
+Warning: mcrypt_cbc(): Received initialization vector of size 0, but size 16 is required for this encryption mode in %s on line %d
string(0) ""
-Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in %s on line %d
+Warning: mcrypt_decrypt(): Received initialization vector of size 0, but size 16 is required for this encryption mode in %s on line %d
string(0) ""
iv length=8
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
+Warning: mcrypt_cbc(): Received initialization vector of size 8, but size 16 is required for this encryption mode in %s on line %d
string(0) ""
-Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in %s on line %d
+Warning: mcrypt_decrypt(): Received initialization vector of size 8, but size 16 is required for this encryption mode in %s on line %d
string(0) ""
iv length=16
@@ -152,9 +152,9 @@ iv length=17
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
+Warning: mcrypt_cbc(): Received initialization vector of size 17, but size 16 is required for this encryption mode in %s on line %d
string(0) ""
-Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in %s on line %d
+Warning: mcrypt_decrypt(): Received initialization vector of size 17, but size 16 is required for this encryption mode in %s on line %d
string(0) ""
===DONE===