summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS5
-rw-r--r--ext/mcrypt/mcrypt.c272
-rw-r--r--ext/mcrypt/tests/bug46010.phpt13
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc.phpt8
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt26
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt26
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc_variation2.phpt60
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc_variation3.phpt2
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc_variation4.phpt2
-rw-r--r--ext/mcrypt/tests/mcrypt_cbc_variation5.phpt82
-rw-r--r--ext/mcrypt/tests/mcrypt_cfb.phpt7
-rw-r--r--ext/mcrypt/tests/mcrypt_decrypt.phpt13
-rw-r--r--ext/mcrypt/tests/mcrypt_decrypt_3des_cbc.phpt26
-rw-r--r--ext/mcrypt/tests/mcrypt_decrypt_3des_ecb.phpt22
-rw-r--r--ext/mcrypt/tests/mcrypt_decrypt_variation2.phpt60
-rw-r--r--ext/mcrypt/tests/mcrypt_decrypt_variation3.phpt2
-rw-r--r--ext/mcrypt/tests/mcrypt_decrypt_variation4.phpt30
-rw-r--r--ext/mcrypt/tests/mcrypt_decrypt_variation5.phpt82
-rw-r--r--ext/mcrypt/tests/mcrypt_ecb.phpt2
-rw-r--r--ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt20
-rw-r--r--ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt14
-rw-r--r--ext/mcrypt/tests/mcrypt_ecb_variation2.phpt60
-rw-r--r--ext/mcrypt/tests/mcrypt_ecb_variation3.phpt2
-rw-r--r--ext/mcrypt/tests/mcrypt_ecb_variation4.phpt2
-rw-r--r--ext/mcrypt/tests/mcrypt_ecb_variation5.phpt2
-rw-r--r--ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt24
-rw-r--r--ext/mcrypt/tests/mcrypt_encrypt_3des_ecb.phpt20
-rw-r--r--ext/mcrypt/tests/mcrypt_encrypt_variation2.phpt60
-rw-r--r--ext/mcrypt/tests/mcrypt_encrypt_variation3.phpt2
-rw-r--r--ext/mcrypt/tests/mcrypt_encrypt_variation4.phpt30
-rw-r--r--ext/mcrypt/tests/mcrypt_encrypt_variation5.phpt82
-rw-r--r--ext/mcrypt/tests/mcrypt_ofb.phpt2
-rw-r--r--ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt58
-rw-r--r--ext/mcrypt/tests/mcrypt_rijndael128_256BitKey.phpt28
34 files changed, 648 insertions, 498 deletions
diff --git a/NEWS b/NEWS
index b94553d919..446f99b058 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,11 @@ PHP NEWS
- Mail:
. Fixed bug #66535 (Don't add newline after X-PHP-Originating-Script) (Tjerk)
+- Mcrypt:
+ . No longer allow invalid key sizes, invalid IV sizes or missing required IV
+ in mcrypt_encrypt, mcrypt_decrypt and the deprecated mode functions.
+ (Nikita)
+
- MySQLi:
. Fixed bug #66762i (Segfault in mysqli_stmt::bind_result() when link closed)
(Remi)
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c
index 89ad83f6bf..70a458d976 100644
--- a/ext/mcrypt/mcrypt.c
+++ b/ext/mcrypt/mcrypt.c
@@ -40,6 +40,7 @@
#include "php_globals.h"
#include "ext/standard/info.h"
#include "ext/standard/php_rand.h"
+#include "ext/standard/php_smart_str.h"
#include "php_mcrypt_filter.h"
static int le_mcrypt;
@@ -309,48 +310,6 @@ zend_module_entry mcrypt_module_entry = {
ZEND_GET_MODULE(mcrypt)
#endif
-#define MCRYPT_ARGS2 \
- zval **cipher, **data, **key, **mode; \
- int td; \
- char *ndata; \
- size_t bsize; \
- size_t nr; \
- size_t nsize
-
-#define MCRYPT_ARGS \
- MCRYPT_ARGS2; \
- zval **iv
-
-#define MCRYPT_SIZE \
- bsize = mcrypt_get_block_size(Z_LVAL_PP(cipher)); \
- nr = (Z_STRLEN_PP(data) + bsize - 1) / bsize; \
- nsize = nr * bsize
-
-#define MCRYPT_CHECK_TD_CPY \
- if (td < 0) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_FAILED); \
- RETURN_FALSE; \
- } \
- ndata = ecalloc(nr, bsize); \
- memcpy(ndata, Z_STRVAL_PP(data), Z_STRLEN_PP(data))
-
-#define MCRYPT_CHECK_IV \
- convert_to_string_ex(iv); \
- if (Z_STRLEN_PP(iv) != bsize) { \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_IV_WRONG_SIZE); \
- RETURN_FALSE; \
- }
-
-#define MCRYPT_ACTION(x) \
- if (Z_LVAL_PP(mode) == 0) { \
- mcrypt_##x(td, ndata, nsize); \
- } else { \
- mdecrypt_##x(td, ndata, nsize); \
- } \
- end_mcrypt_##x(td)
-
-#define MCRYPT_IV_WRONG_SIZE "The IV parameter must be as long as the blocksize"
-
#define MCRYPT_ENCRYPT 0
#define MCRYPT_DECRYPT 1
@@ -658,7 +617,7 @@ PHP_FUNCTION(mcrypt_generic)
char *data;
int data_len;
php_mcrypt *pm;
- unsigned char* data_s;
+ char* data_s;
int block_size, data_size;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &mcryptind, &data, &data_len) == FAILURE) {
@@ -1165,14 +1124,120 @@ PHP_FUNCTION(mcrypt_get_cipher_name)
}
/* }}} */
-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 argc, int dencrypt, zval* return_value TSRMLS_DC) /* {{{ */
+static char *php_mcrypt_get_key_size_str(
+ int max_key_size, const int *key_sizes, int key_size_count) /* {{{ */
+{
+ if (key_size_count == 0) {
+ char *str;
+ spprintf(&str, 0, "Only keys of size 1 to %d supported", max_key_size);
+ return str;
+ } else if (key_size_count == 1) {
+ char *str;
+ spprintf(&str, 0, "Only keys of size %d supported", key_sizes[0]);
+ return str;
+ } else {
+ int i;
+ smart_str str = {0};
+ smart_str_appends(&str, "Only keys of sizes ");
+
+ for (i = 0; i < key_size_count; ++i) {
+ if (i == key_size_count - 1) {
+ smart_str_appends(&str, " or ");
+ } else if (i != 0) {
+ smart_str_appends(&str, ", ");
+ }
+
+ smart_str_append_long(&str, key_sizes[i]);
+ }
+
+ smart_str_appends(&str, " supported");
+ smart_str_0(&str);
+ return str.c;
+ }
+}
+/* }}} */
+
+static zend_bool php_mcrypt_is_valid_key_size(
+ int key_size, int max_key_size, int *key_sizes, int key_size_count) /* {{{ */
+{
+ int i;
+
+ if (key_size <= 0 || key_size > max_key_size) {
+ return 0;
+ }
+
+ if (key_size_count == 0) {
+ /* All key sizes are valid */
+ return 1;
+ }
+
+ for (i = 0; i < key_size_count; i++) {
+ if (key_sizes[i] == key_size) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+/* }}} */
+
+static int php_mcrypt_ensure_valid_key_size(MCRYPT td, int key_size TSRMLS_DC) /* {{{ */
+{
+ int key_size_count;
+ int max_key_size = mcrypt_enc_get_key_size(td);
+ int *key_sizes = mcrypt_enc_get_supported_key_sizes(td, &key_size_count);
+
+ zend_bool is_valid_key_size = php_mcrypt_is_valid_key_size(
+ key_size, max_key_size, key_sizes, key_size_count
+ );
+ if (!is_valid_key_size) {
+ char *key_size_str = php_mcrypt_get_key_size_str(
+ max_key_size, key_sizes, key_size_count
+ );
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,
+ "Key of size %d not supported by this algorithm. %s", key_size, key_size_str
+ );
+ efree(key_size_str);
+ }
+
+ if (key_sizes) {
+ mcrypt_free(key_sizes);
+ }
+
+ return is_valid_key_size ? SUCCESS : FAILURE;
+}
+/* }}} */
+
+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;
char *module_dir_string;
- int block_size, max_key_length, use_key_length, i, count, iv_size;
unsigned long int data_size;
- int *key_length_sizes;
- char *key_s = NULL, *iv_s;
char *data_s;
MCRYPT td;
@@ -1183,92 +1248,47 @@ static void php_mcrypt_do_crypt(char* cipher, const char *key, int key_len, cons
php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
RETURN_FALSE;
}
- /* Checking for key-length */
- max_key_length = mcrypt_enc_get_key_size(td);
- if (key_len > max_key_length) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Size of key is too large for this algorithm");
- }
- key_length_sizes = mcrypt_enc_get_supported_key_sizes(td, &count);
- if (count == 0 && key_length_sizes == NULL) { /* all lengths 1 - k_l_s = OK */
- use_key_length = key_len;
- key_s = emalloc(use_key_length);
- memset(key_s, 0, use_key_length);
- memcpy(key_s, key, use_key_length);
- } else if (count == 1) { /* only m_k_l = OK */
- key_s = emalloc(key_length_sizes[0]);
- memset(key_s, 0, key_length_sizes[0]);
- memcpy(key_s, key, MIN(key_len, key_length_sizes[0]));
- use_key_length = key_length_sizes[0];
- } else { /* dertermine smallest supported key > length of requested key */
- use_key_length = max_key_length; /* start with max key length */
- for (i = 0; i < count; i++) {
- if (key_length_sizes[i] >= key_len &&
- key_length_sizes[i] < use_key_length)
- {
- use_key_length = key_length_sizes[i];
- }
- }
- key_s = emalloc(use_key_length);
- memset(key_s, 0, use_key_length);
- memcpy(key_s, key, MIN(key_len, use_key_length));
+
+ if (php_mcrypt_ensure_valid_key_size(td, key_len TSRMLS_CC) == FAILURE) {
+ mcrypt_module_close(td);
+ RETURN_FALSE;
}
- mcrypt_free (key_length_sizes);
-
- /* Check IV */
- iv_s = NULL;
- iv_size = mcrypt_enc_get_iv_size (td);
-
- /* IV is required */
- if (mcrypt_enc_mode_has_iv(td) == 1) {
- if (argc == 5) {
- if (iv_size != iv_len) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_IV_WRONG_SIZE);
- } else {
- iv_s = emalloc(iv_size + 1);
- memcpy(iv_s, iv, iv_size);
- }
- } else if (argc == 4) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempt to use an empty IV, which is NOT recommend");
- iv_s = emalloc(iv_size + 1);
- memset(iv_s, 0, iv_size + 1);
- }
+
+ if (php_mcrypt_ensure_valid_iv(td, iv, iv_len TSRMLS_CC) == FAILURE) {
+ mcrypt_module_close(td);
+ RETURN_FALSE;
}
/* Check blocksize */
if (mcrypt_enc_is_block_mode(td) == 1) { /* It's a block algorithm */
- block_size = mcrypt_enc_get_block_size(td);
+ int block_size = mcrypt_enc_get_block_size(td);
data_size = (((data_len - 1) / block_size) + 1) * block_size;
- data_s = emalloc(data_size);
+ data_s = emalloc(data_size + 1);
memset(data_s, 0, data_size);
memcpy(data_s, data, data_len);
} else { /* It's not a block algorithm */
data_size = data_len;
- data_s = emalloc(data_size);
- memset(data_s, 0, data_size);
+ data_s = emalloc(data_size + 1);
memcpy(data_s, data, data_len);
}
- if (mcrypt_generic_init(td, key_s, use_key_length, iv_s) < 0) {
+ if (mcrypt_generic_init(td, (void *) key, key_len, (void *) iv) < 0) {
php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Mcrypt initialisation failed");
+ mcrypt_module_close(td);
RETURN_FALSE;
}
+
if (dencrypt == MCRYPT_ENCRYPT) {
mcrypt_generic(td, data_s, data_size);
} else {
mdecrypt_generic(td, data_s, data_size);
}
- RETVAL_STRINGL(data_s, data_size, 1);
+ data_s[data_size] = 0;
+ RETVAL_STRINGL(data_s, data_size, 0);
/* freeing vars */
mcrypt_generic_end(td);
- if (key_s != NULL) {
- efree (key_s);
- }
- if (iv_s != NULL) {
- efree (iv_s);
- }
- efree (data_s);
}
/* }}} */
@@ -1276,15 +1296,15 @@ static void php_mcrypt_do_crypt(char* cipher, const char *key, int key_len, cons
OFB crypt/decrypt data using key key with cipher cipher starting with iv */
PHP_FUNCTION(mcrypt_encrypt)
{
- zval **mode;
- char *cipher, *key, *data, *iv = NULL;
- int cipher_len, key_len, data_len, iv_len = 0;
+ char *cipher, *key, *data, *mode, *iv = NULL;
+ int cipher_len, key_len, data_len, mode_len, iv_len = 0;
- MCRYPT_GET_CRYPT_ARGS
-
- convert_to_string_ex(mode);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssss|s", &cipher, &cipher_len,
+ &key, &key_len, &data, &data_len, &mode, &mode_len, &iv, &iv_len) == FAILURE) {
+ return;
+ }
- php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, Z_STRVAL_PP(mode), iv, iv_len, ZEND_NUM_ARGS(), MCRYPT_ENCRYPT, return_value TSRMLS_CC);
+ php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, mode, iv, iv_len, MCRYPT_ENCRYPT, return_value TSRMLS_CC);
}
/* }}} */
@@ -1292,15 +1312,15 @@ PHP_FUNCTION(mcrypt_encrypt)
OFB crypt/decrypt data using key key with cipher cipher starting with iv */
PHP_FUNCTION(mcrypt_decrypt)
{
- zval **mode;
- char *cipher, *key, *data, *iv = NULL;
- int cipher_len, key_len, data_len, iv_len = 0;
+ char *cipher, *key, *data, *mode, *iv = NULL;
+ int cipher_len, key_len, data_len, mode_len, iv_len = 0;
- MCRYPT_GET_CRYPT_ARGS
-
- convert_to_string_ex(mode);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssss|s", &cipher, &cipher_len,
+ &key, &key_len, &data, &data_len, &mode, &mode_len, &iv, &iv_len) == FAILURE) {
+ return;
+ }
- php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, Z_STRVAL_PP(mode), iv, iv_len, ZEND_NUM_ARGS(), MCRYPT_DECRYPT, return_value TSRMLS_CC);
+ php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, mode, iv, iv_len, MCRYPT_DECRYPT, return_value TSRMLS_CC);
}
/* }}} */
@@ -1316,7 +1336,7 @@ PHP_FUNCTION(mcrypt_ecb)
convert_to_long_ex(mode);
- php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ecb", iv, iv_len, ZEND_NUM_ARGS(), Z_LVAL_PP(mode), return_value TSRMLS_CC);
+ php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ecb", iv, iv_len, Z_LVAL_PP(mode), return_value TSRMLS_CC);
}
/* }}} */
@@ -1332,7 +1352,7 @@ PHP_FUNCTION(mcrypt_cbc)
convert_to_long_ex(mode);
- php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cbc", iv, iv_len, ZEND_NUM_ARGS(), Z_LVAL_PP(mode), return_value TSRMLS_CC);
+ php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cbc", iv, iv_len, Z_LVAL_PP(mode), return_value TSRMLS_CC);
}
/* }}} */
@@ -1348,7 +1368,7 @@ PHP_FUNCTION(mcrypt_cfb)
convert_to_long_ex(mode);
- php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cfb", iv, iv_len, ZEND_NUM_ARGS(), Z_LVAL_PP(mode), return_value TSRMLS_CC);
+ php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "cfb", iv, iv_len, Z_LVAL_PP(mode), return_value TSRMLS_CC);
}
/* }}} */
@@ -1364,7 +1384,7 @@ PHP_FUNCTION(mcrypt_ofb)
convert_to_long_ex(mode);
- php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ofb", iv, iv_len, ZEND_NUM_ARGS(), Z_LVAL_PP(mode), return_value TSRMLS_CC);
+ php_mcrypt_do_crypt(cipher, key, key_len, data, data_len, "ofb", iv, iv_len, Z_LVAL_PP(mode), return_value TSRMLS_CC);
}
/* }}} */
diff --git a/ext/mcrypt/tests/bug46010.phpt b/ext/mcrypt/tests/bug46010.phpt
index ddb691e362..1f0fe40a3d 100644
--- a/ext/mcrypt/tests/bug46010.phpt
+++ b/ext/mcrypt/tests/bug46010.phpt
@@ -5,12 +5,13 @@ Bug #46010 (warnings incorrectly generated for iv in ecb mode)
--FILE--
<?php
-var_dump(bin2hex(mcrypt_encrypt(MCRYPT_TRIPLEDES, "key", "data", MCRYPT_MODE_ECB)));
-var_dump(bin2hex(mcrypt_encrypt(MCRYPT_TRIPLEDES, "key", "data", MCRYPT_MODE_ECB, "a")));
-var_dump(bin2hex(mcrypt_encrypt(MCRYPT_TRIPLEDES, "key", "data", MCRYPT_MODE_ECB, "12345678")));
+$key = "012345678901234567890123";
+var_dump(bin2hex(mcrypt_encrypt(MCRYPT_TRIPLEDES, $key, "data", MCRYPT_MODE_ECB)));
+var_dump(bin2hex(mcrypt_encrypt(MCRYPT_TRIPLEDES, $key, "data", MCRYPT_MODE_ECB, "a")));
+var_dump(bin2hex(mcrypt_encrypt(MCRYPT_TRIPLEDES, $key, "data", MCRYPT_MODE_ECB, "12345678")));
?>
--EXPECTF--
-string(16) "372eeb4a524b8d31"
-string(16) "372eeb4a524b8d31"
-string(16) "372eeb4a524b8d31"
+string(16) "f7a2ce11d4002294"
+string(16) "f7a2ce11d4002294"
+string(16) "f7a2ce11d4002294"
diff --git a/ext/mcrypt/tests/mcrypt_cbc.phpt b/ext/mcrypt/tests/mcrypt_cbc.phpt
index 27cc5b2224..c2e879370d 100644
--- a/ext/mcrypt/tests/mcrypt_cbc.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc.phpt
@@ -4,7 +4,7 @@ mcrypt_cbc
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
-$key = "FooBar";
+$key = "0123456789012345";
$secret = "PHP Testfest 2008";
$cipher = MCRYPT_RIJNDAEL_128;
@@ -15,8 +15,9 @@ $enc_data = mcrypt_cbc($cipher, $key, $secret, MCRYPT_ENCRYPT, $iv);
echo trim(mcrypt_cbc($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv)) . "\n";
// a warning must be issued if we don't use a IV on a AES cipher, that usually requires an IV
-mcrypt_cbc($cipher, $key, $enc_data, MCRYPT_DECRYPT);
+var_dump(mcrypt_cbc($cipher, $key, $enc_data, MCRYPT_DECRYPT));
+?>
--EXPECTF--
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
@@ -26,4 +27,5 @@ PHP Testfest 2008
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-Warning: mcrypt_cbc(): Attempt to use an empty IV, which is NOT recommend 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 67799a3fdd..e610f7cfa0 100644
--- a/ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt
@@ -21,7 +21,7 @@ $cipher = MCRYPT_TRIPLEDES;
$data = b"This is the secret message which must be encrypted";
$mode = MCRYPT_DECRYPT;
-// tripledes uses keys upto 192 bits (24 bytes)
+// tripledes uses keys with exactly 192 bits (24 bytes)
$keys = array(
b'12345678',
b'12345678901234567890',
@@ -54,7 +54,7 @@ for ($i = 0; $i < sizeof($keys); $i++) {
special_var_dump(mcrypt_cbc($cipher, $keys[$i], base64_decode($data1[$i]), $mode, $iv));
}
-$key = b'1234567890123456';
+$key = b'123456789012345678901234';
echo "\n--- testing different iv lengths\n";
for ($i = 0; $i < sizeof($ivs); $i++) {
echo "\niv length=".strlen($ivs[$i])."\n";
@@ -74,12 +74,16 @@ function special_var_dump($str) {
key length=8
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-string(32) "736563726574206d6573736167650000"
+
+Warning: mcrypt_cbc(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
key length=20
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-string(32) "736563726574206d6573736167650000"
+
+Warning: mcrypt_cbc(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
key length=24
@@ -90,8 +94,8 @@ key length=26
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-Warning: mcrypt_cbc(): Size of key is too large for this algorithm in %s on line %d
-string(32) "736563726574206d6573736167650000"
+Warning: mcrypt_cbc(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
--- testing different iv lengths
@@ -99,18 +103,18 @@ 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
-string(32) "736563726574206d6573736167650000"
+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
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-string(32) "736563726574206d6573736167650000"
+string(32) "659ec947f4dc3a3b9c50de744598d3c8"
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
-string(32) "736563726574206d6573736167650000"
+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 1af094c27b..c5606e71a0 100644
--- a/ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt
@@ -21,7 +21,7 @@ $cipher = MCRYPT_TRIPLEDES;
$data = b"This is the secret message which must be encrypted";
$mode = MCRYPT_ENCRYPT;
-// tripledes uses keys upto 192 bits (24 bytes)
+// tripledes uses keys with exactly 192 bits (24 bytes)
$keys = array(
b'12345678',
b'12345678901234567890',
@@ -41,7 +41,7 @@ foreach ($keys as $key) {
var_dump(bin2hex(mcrypt_cbc($cipher, $key, $data, $mode, $iv)));
}
-$key = b'1234567890123456';
+$key = b'123456789012345678901234';
echo "\n--- testing different iv lengths\n";
foreach ($ivs as $iv) {
echo "\niv length=".strlen($iv)."\n";
@@ -57,12 +57,16 @@ foreach ($ivs as $iv) {
key length=8
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-string(112) "082b437d039d09418e20dc9de1dafa7ed6da5c6335b78950968441da1faf40c1f886e04da8ca177b80b376811e138c1bf51cb48dae2e7939"
+
+Warning: mcrypt_cbc(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
key length=20
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-string(112) "0627351e0f8a082bf7981ae2c700a43fd3d44b270ac67b00fded1c5796eea935be0fef2a23da0b3f5e243929e62ac957bf0bf463aa90fc4f"
+
+Warning: mcrypt_cbc(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
key length=24
@@ -73,8 +77,8 @@ key length=26
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-Warning: mcrypt_cbc(): Size of key is too large for this algorithm in %s on line %d
-string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b62617eb2e44213c2d44462d388bc0b8f119384b12c84ac"
+Warning: mcrypt_cbc(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
--- testing different iv lengths
@@ -82,18 +86,18 @@ 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
-string(112) "440a6f54601969b127aad3c217ce7583c7f7b29989693130645569301db0020b29a34a3dcd104b2d0e3ba19d6cbd8a33d352b9c27cc34ef1"
+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
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-string(112) "bac347506bf092c5557c4363c301745d78f047028e2953e84fd66b30aeb6005812dadbe8baa871b83278341599b0c448ddaaa52b5a378ce5"
+string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b62617eb2e44213c2d44462d388bc0b8f119384b12c84ac"
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
-string(112) "440a6f54601969b127aad3c217ce7583c7f7b29989693130645569301db0020b29a34a3dcd104b2d0e3ba19d6cbd8a33d352b9c27cc34ef1"
+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_variation2.phpt b/ext/mcrypt/tests/mcrypt_cbc_variation2.phpt
index 3d2a061472..8efbf82f74 100644
--- a/ext/mcrypt/tests/mcrypt_cbc_variation2.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc_variation2.phpt
@@ -125,39 +125,48 @@ fclose($fp);
--int 0--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "bc27b3a4e33b531d5983fc7df693cd09"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--int 1--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "bc27b3a4e33b531d5983fc7df693cd09"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--int 12345--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "d109b7973383127002474ae731c4b3a8"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--int -12345--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "3e82a931cedb03a38b91a637ff8c9f9e"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float 10.5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "de71833586c1d7132a289960ebeeca7a"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float -10.5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "7d0489dd2e99ae910ecc015573f3dd16"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float 12.3456789000e10--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "978055b42c0506a8947e3c3c8d994baf"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float -12.3456789000e10--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "4aa84ba400c2b8ef467d4d98372b4f4e"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float .5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "e731dc5059b84e0c8774ac490f77d6e6"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--empty array--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
@@ -181,39 +190,48 @@ string(0) ""
--uppercase NULL--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "be722a5ffc361d721fbcab1eacc6acf5"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--lowercase null--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "be722a5ffc361d721fbcab1eacc6acf5"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--lowercase true--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "bc27b3a4e33b531d5983fc7df693cd09"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--lowercase false--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "be722a5ffc361d721fbcab1eacc6acf5"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--uppercase TRUE--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "bc27b3a4e33b531d5983fc7df693cd09"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--uppercase FALSE--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "be722a5ffc361d721fbcab1eacc6acf5"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--empty string DQ--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "be722a5ffc361d721fbcab1eacc6acf5"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--empty string SQ--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "be722a5ffc361d721fbcab1eacc6acf5"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--instance of classWithToString--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "19420fa26f561ee82ed84abbcd2d284b"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--instance of classWithoutToString--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
@@ -222,11 +240,13 @@ string(0) ""
--undefined var--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "be722a5ffc361d721fbcab1eacc6acf5"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--unset var--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
-string(32) "be722a5ffc361d721fbcab1eacc6acf5"
+Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--resource--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
diff --git a/ext/mcrypt/tests/mcrypt_cbc_variation3.phpt b/ext/mcrypt/tests/mcrypt_cbc_variation3.phpt
index 9a1464b112..f9098a4221 100644
--- a/ext/mcrypt/tests/mcrypt_cbc_variation3.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc_variation3.phpt
@@ -27,7 +27,7 @@ set_error_handler('test_error_handler');
// Initialise function arguments not being substituted (if any)
$cipher = MCRYPT_TRIPLEDES;
-$key = b'string_val';
+$key = b"string_val\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
$mode = MCRYPT_ENCRYPT;
$iv = b'01234567';
diff --git a/ext/mcrypt/tests/mcrypt_cbc_variation4.phpt b/ext/mcrypt/tests/mcrypt_cbc_variation4.phpt
index a3dd29ba41..a13e4ffb7c 100644
--- a/ext/mcrypt/tests/mcrypt_cbc_variation4.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc_variation4.phpt
@@ -27,7 +27,7 @@ set_error_handler('test_error_handler');
// Initialise function arguments not being substituted (if any)
$cipher = MCRYPT_TRIPLEDES;
-$key = b'string_val';
+$key = b"string_val\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
$data = b'string_val';
$iv = b'01234567';
diff --git a/ext/mcrypt/tests/mcrypt_cbc_variation5.phpt b/ext/mcrypt/tests/mcrypt_cbc_variation5.phpt
index 0c75c97934..884d90963e 100644
--- a/ext/mcrypt/tests/mcrypt_cbc_variation5.phpt
+++ b/ext/mcrypt/tests/mcrypt_cbc_variation5.phpt
@@ -27,7 +27,7 @@ set_error_handler('test_error_handler');
// Initialise function arguments not being substituted (if any)
$cipher = MCRYPT_TRIPLEDES;
-$key = b'string_val';
+$key = b"string_val\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
$data = b'string_val';
$mode = MCRYPT_ENCRYPT;
@@ -125,48 +125,48 @@ 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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
@@ -190,48 +190,48 @@ 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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
@@ -240,13 +240,13 @@ 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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+Error: 2 - mcrypt_cbc(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
+string(0) ""
--resource--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
diff --git a/ext/mcrypt/tests/mcrypt_cfb.phpt b/ext/mcrypt/tests/mcrypt_cfb.phpt
index 11120633a5..5b6842310b 100644
--- a/ext/mcrypt/tests/mcrypt_cfb.phpt
+++ b/ext/mcrypt/tests/mcrypt_cfb.phpt
@@ -4,7 +4,7 @@ mcrypt_cfb
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
-$key = "FooBar";
+$key = "0123456789012345";
$secret = "PHP Testfest 2008";
$cipher = MCRYPT_RIJNDAEL_128;
@@ -15,7 +15,7 @@ $enc_data = mcrypt_cfb($cipher, $key, $secret, MCRYPT_ENCRYPT, $iv);
echo trim(mcrypt_cfb($cipher, $key, $enc_data, MCRYPT_DECRYPT, $iv)) . "\n";
// a warning must be issued if we don't use a IV on a AES cipher, that usually requires an IV
-mcrypt_cfb($cipher, $key, $enc_data, MCRYPT_DECRYPT);
+var_dump(mcrypt_cfb($cipher, $key, $enc_data, MCRYPT_DECRYPT));
--EXPECTF--
@@ -26,4 +26,5 @@ PHP Testfest 2008
Deprecated: Function mcrypt_cfb() is deprecated in %s on line %d
-Warning: mcrypt_cfb(): Attempt to use an empty IV, which is NOT recommend 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 b4e628401e..f10757c45d 100644
--- a/ext/mcrypt/tests/mcrypt_decrypt.phpt
+++ b/ext/mcrypt/tests/mcrypt_decrypt.phpt
@@ -4,7 +4,7 @@ mcrypt_decrypt
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
-$key = "FooBar";
+$key = "0123456789012345";
$secret = "PHP Testfest 2008";
$mode = MCRYPT_MODE_CBC;
$cipher = MCRYPT_RIJNDAEL_128;
@@ -16,13 +16,14 @@ $enc_data = mcrypt_encrypt($cipher, $key, $secret, $mode, $iv);
echo trim(mcrypt_decrypt($cipher, $key, $enc_data, $mode, $iv)) . "\n";
// a warning must be issued if we don't use a IV on a AES cipher, that usually requires an IV
-mcrypt_decrypt($cipher, $key, $enc_data, MCRYPT_MODE_CBC);
+var_dump(mcrypt_decrypt($cipher, $key, $enc_data, MCRYPT_MODE_CBC));
-var_dump(strpos(mcrypt_decrypt(MCRYPT_BLOWFISH, "FooBar", $enc_data, MCRYPT_MODE_CBC, $iv), "Testfest") !== false);
+var_dump(mcrypt_decrypt(MCRYPT_BLOWFISH, "FooBar", $enc_data, MCRYPT_MODE_CBC, $iv));
--EXPECTF--
PHP Testfest 2008
-Warning: mcrypt_decrypt(): Attempt to use an empty IV, which is NOT recommend 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
-bool(false) \ No newline at end of file
+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 30d0c2bafa..60af213911 100644
--- a/ext/mcrypt/tests/mcrypt_decrypt_3des_cbc.phpt
+++ b/ext/mcrypt/tests/mcrypt_decrypt_3des_cbc.phpt
@@ -21,7 +21,7 @@ echo "*** Testing mcrypt_decrypt() : basic functionality ***\n";
$cipher = MCRYPT_3DES;
$mode = MCRYPT_MODE_CBC;
-// tripledes uses keys upto 192 bits (24 bytes)
+// tripledes uses keys with exactly 192 bits (24 bytes)
$keys = array(
b'12345678',
b'12345678901234567890',
@@ -53,7 +53,7 @@ for ($i = 0; $i < sizeof($keys); $i++) {
special_var_dump(mcrypt_decrypt($cipher, $keys[$i], base64_decode($data1[$i]), $mode, $iv));
}
-$key = b'1234567890123456';
+$key = b'123456789012345678901234';
echo "\n--- testing different iv lengths\n";
for ($i = 0; $i < sizeof($ivs); $i++) {
echo "\niv length=".strlen($ivs[$i])."\n";
@@ -71,31 +71,35 @@ function special_var_dump($str) {
--- testing different key lengths
key length=8
-string(32) "736563726574206d6573736167650000"
+
+Warning: mcrypt_decrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
key length=20
-string(32) "736563726574206d6573736167650000"
+
+Warning: mcrypt_decrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
key length=24
string(32) "736563726574206d6573736167650000"
key length=26
-Warning: mcrypt_decrypt(): Size of key is too large for this algorithm in %s on line %d
-string(32) "736563726574206d6573736167650000"
+Warning: mcrypt_decrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
--- testing different iv lengths
iv length=4
-Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in %s on line %d
-string(32) "736563726574206d6573736167650000"
+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
-string(32) "736563726574206d6573736167650000"
+string(32) "659ec947f4dc3a3b9c50de744598d3c8"
iv length=9
-Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in %s on line %d
-string(32) "736563726574206d6573736167650000"
+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_3des_ecb.phpt b/ext/mcrypt/tests/mcrypt_decrypt_3des_ecb.phpt
index 5f841c1b04..c54e6e5098 100644
--- a/ext/mcrypt/tests/mcrypt_decrypt_3des_ecb.phpt
+++ b/ext/mcrypt/tests/mcrypt_decrypt_3des_ecb.phpt
@@ -21,7 +21,7 @@ echo "*** Testing mcrypt_decrypt() : basic functionality ***\n";
$cipher = MCRYPT_3DES;
$mode = MCRYPT_MODE_ECB;
-// tripledes uses keys upto 192 bits (24 bytes)
+// tripledes uses keys with exactly 192 bits (24 bytes)
$keys = array(
b'12345678',
b'12345678901234567890',
@@ -52,7 +52,7 @@ for ($i = 0; $i < sizeof($keys); $i++) {
special_var_dump(mcrypt_decrypt($cipher, $keys[$i], base64_decode($data1[$i]), $mode));
}
-$key = b'1234567890123456';
+$key = b'123456789012345678901234';
echo "\n--- testing different iv lengths\n";
for ($i = 0; $i < sizeof($ivs); $i++) {
echo "\niv length=".strlen($ivs[$i])."\n";
@@ -70,27 +70,31 @@ function special_var_dump($str) {
--- testing different key lengths
key length=8
-string(32) "736563726574206d6573736167650000"
+
+Warning: mcrypt_decrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
key length=20
-string(32) "736563726574206d6573736167650000"
+
+Warning: mcrypt_decrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
key length=24
string(32) "736563726574206d6573736167650000"
key length=26
-Warning: mcrypt_decrypt(): Size of key is too large for this algorithm in %s on line %d
-string(32) "736563726574206d6573736167650000"
+Warning: mcrypt_decrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
--- testing different iv lengths
iv length=4
-string(32) "736563726574206d6573736167650000"
+string(32) "a9298896ed1b7335f8f10f7ff6d7a239"
iv length=8
-string(32) "736563726574206d6573736167650000"
+string(32) "a9298896ed1b7335f8f10f7ff6d7a239"
iv length=9
-string(32) "736563726574206d6573736167650000"
+string(32) "a9298896ed1b7335f8f10f7ff6d7a239"
===DONE===
diff --git a/ext/mcrypt/tests/mcrypt_decrypt_variation2.phpt b/ext/mcrypt/tests/mcrypt_decrypt_variation2.phpt
index 85adb9c99f..985029c8ba 100644
--- a/ext/mcrypt/tests/mcrypt_decrypt_variation2.phpt
+++ b/ext/mcrypt/tests/mcrypt_decrypt_variation2.phpt
@@ -124,31 +124,40 @@ fclose($fp);
*** Testing mcrypt_decrypt() : usage variation ***
--int 0--
-string(32) "43a1ae011df36064589d06bc922ecd97"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--int 1--
-string(32) "43a1ae011df36064589d06bc922ecd97"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--int 12345--
-string(32) "e5885552e16c44d4eb6164f477b40200"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--int -12345--
-string(32) "adf7873831a9035cda9f9dc3b7dc626b"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float 10.5--
-string(32) "08b0b9fac9c227437b7b5d0147e6153b"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float -10.5--
-string(32) "f470cc74d83471b42a3e28d4ec57799a"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float 12.3456789000e10--
-string(32) "36c618c00523fadc372b871eaa9c7b16"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float -12.3456789000e10--
-string(32) "a554a5bdb7a5ceb6ae6f20566ef02e49"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float .5--
-string(32) "bcb840ff76d3788a7911ed36f088a910"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--empty array--
Error: 2 - mcrypt_decrypt() expects parameter 2 to be string, array given, %s(%d)
@@ -167,41 +176,52 @@ Error: 2 - mcrypt_decrypt() expects parameter 2 to be string, array given, %s(%d
string(0) ""
--uppercase NULL--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--lowercase null--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--lowercase true--
-string(32) "43a1ae011df36064589d06bc922ecd97"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--lowercase false--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--uppercase TRUE--
-string(32) "43a1ae011df36064589d06bc922ecd97"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--uppercase FALSE--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--empty string DQ--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--empty string SQ--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--instance of classWithToString--
-string(32) "478f9d080563835cc3136610802f1433"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--instance of classWithoutToString--
Error: 2 - mcrypt_decrypt() expects parameter 2 to be string, object given, %s(%d)
string(0) ""
--undefined var--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--unset var--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--resource--
Error: 2 - mcrypt_decrypt() expects parameter 2 to be string, resource given, %s(%d)
diff --git a/ext/mcrypt/tests/mcrypt_decrypt_variation3.phpt b/ext/mcrypt/tests/mcrypt_decrypt_variation3.phpt
index 50da2605b2..a36f2c7a83 100644
--- a/ext/mcrypt/tests/mcrypt_decrypt_variation3.phpt
+++ b/ext/mcrypt/tests/mcrypt_decrypt_variation3.phpt
@@ -27,7 +27,7 @@ set_error_handler('test_error_handler');
// Initialise function arguments not being substituted (if any)
$cipher = MCRYPT_TRIPLEDES;
-$key = b'string_val';
+$key = b"string_val\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
$mode = MCRYPT_MODE_ECB;
$iv = b'01234567';
diff --git a/ext/mcrypt/tests/mcrypt_decrypt_variation4.phpt b/ext/mcrypt/tests/mcrypt_decrypt_variation4.phpt
index 12e44312d8..1bb994dcc7 100644
--- a/ext/mcrypt/tests/mcrypt_decrypt_variation4.phpt
+++ b/ext/mcrypt/tests/mcrypt_decrypt_variation4.phpt
@@ -160,24 +160,20 @@ Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
bool(false)
--empty array--
-Error: 8 - Array to string conversion, %s(%d)
-Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
-bool(false)
+Error: 2 - mcrypt_decrypt() expects parameter 4 to be string, array given, %s(%d)
+NULL
--int indexed array--
-Error: 8 - Array to string conversion, %s(%d)
-Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
-bool(false)
+Error: 2 - mcrypt_decrypt() expects parameter 4 to be string, array given, %s(%d)
+NULL
--associative array--
-Error: 8 - Array to string conversion, %s(%d)
-Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
-bool(false)
+Error: 2 - mcrypt_decrypt() expects parameter 4 to be string, array given, %s(%d)
+NULL
--nested arrays--
-Error: 8 - Array to string conversion, %s(%d)
-Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
-bool(false)
+Error: 2 - mcrypt_decrypt() expects parameter 4 to be string, array given, %s(%d)
+NULL
--uppercase NULL--
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
@@ -216,10 +212,8 @@ Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
bool(false)
--instance of classWithoutToString--
-Error: 4096 - Object of class classWithoutToString could not be converted to string, %s(%d)
-Error: 8 - Object of class classWithoutToString to string conversion, %s(%d)
-Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
-bool(false)
+Error: 2 - mcrypt_decrypt() expects parameter 4 to be string, object given, %s(%d)
+NULL
--undefined var--
Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
@@ -230,6 +224,6 @@ Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
bool(false)
--resource--
-Error: 2 - mcrypt_decrypt(): Module initialization failed, %s(%d)
-bool(false)
+Error: 2 - mcrypt_decrypt() expects parameter 4 to be string, resource given, %s(%d)
+NULL
===DONE===
diff --git a/ext/mcrypt/tests/mcrypt_decrypt_variation5.phpt b/ext/mcrypt/tests/mcrypt_decrypt_variation5.phpt
index f1541bdaea..0f5093ba88 100644
--- a/ext/mcrypt/tests/mcrypt_decrypt_variation5.phpt
+++ b/ext/mcrypt/tests/mcrypt_decrypt_variation5.phpt
@@ -27,7 +27,7 @@ set_error_handler('test_error_handler');
// Initialise function arguments not being substituted (if any)
$cipher = MCRYPT_TRIPLEDES;
-$key = b'string_val';
+$key = b"string_val\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
$data = b'string_val';
$mode = MCRYPT_MODE_CBC;
@@ -124,40 +124,40 @@ 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)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+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)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+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)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+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)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+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)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+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)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+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)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+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)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+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)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+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--
Error: 2 - mcrypt_decrypt() expects parameter 5 to be string, array given, %s(%d)
@@ -176,52 +176,52 @@ 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)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+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)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+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)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+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)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+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)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+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)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+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)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+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)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+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)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+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--
Error: 2 - mcrypt_decrypt() expects parameter 5 to be string, object given, %s(%d)
string(0) ""
--undefined var--
-Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+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)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+Error: 2 - mcrypt_decrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
+string(0) ""
--resource--
Error: 2 - mcrypt_decrypt() expects parameter 5 to be string, resource given, %s(%d)
diff --git a/ext/mcrypt/tests/mcrypt_ecb.phpt b/ext/mcrypt/tests/mcrypt_ecb.phpt
index b6d0a22786..7a4bc3aa6a 100644
--- a/ext/mcrypt/tests/mcrypt_ecb.phpt
+++ b/ext/mcrypt/tests/mcrypt_ecb.phpt
@@ -4,7 +4,7 @@ mcrypt_ecb
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
-$key = "FooBar";
+$key = "0123456789012345";
$secret = "PHP Testfest 2008";
$cipher = MCRYPT_RIJNDAEL_128;
diff --git a/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt b/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt
index 82f9608da8..e718107b9b 100644
--- a/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt
+++ b/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt
@@ -55,7 +55,7 @@ for ($i = 0; $i < sizeof($keys); $i++) {
special_var_dump(mcrypt_ecb($cipher, $keys[$i], base64_decode($data1[$i]), $mode, $iv));
}
-$key = b'1234567890123456';
+$key = b'123456789012345678901234';
echo "\n--- testing different iv lengths\n";
for ($i = 0; $i < sizeof($ivs); $i++) {
echo "\niv length=".strlen($ivs[$i])."\n";
@@ -73,27 +73,31 @@ function special_var_dump($str) {
--- testing different key lengths
key length=8
-string(32) "736563726574206d6573736167650000"
+
+Warning: mcrypt_ecb(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
key length=20
-string(32) "736563726574206d6573736167650000"
+
+Warning: mcrypt_ecb(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
key length=24
string(32) "736563726574206d6573736167650000"
key length=26
-Warning: mcrypt_ecb(): Size of key is too large for this algorithm in %s on line %d
-string(32) "736563726574206d6573736167650000"
+Warning: mcrypt_ecb(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
--- testing different iv lengths
iv length=4
-string(32) "736563726574206d6573736167650000"
+string(32) "a9298896ed1b7335f8f10f7ff6d7a239"
iv length=8
-string(32) "736563726574206d6573736167650000"
+string(32) "a9298896ed1b7335f8f10f7ff6d7a239"
iv length=9
-string(32) "736563726574206d6573736167650000"
+string(32) "a9298896ed1b7335f8f10f7ff6d7a239"
===DONE===
diff --git a/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt b/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt
index 50107b4b0f..7e29579779 100644
--- a/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt
+++ b/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt
@@ -44,7 +44,7 @@ foreach ($keys as $key) {
var_dump(bin2hex(mcrypt_ecb($cipher, $key, $data, $mode, $iv)));
}
-$key = b'1234567890123456';
+$key = b"1234567890123456\0\0\0\0\0\0\0\0";
echo "\n--- testing different iv lengths\n";
foreach ($ivs as $iv) {
echo "\niv length=".strlen($iv)."\n";
@@ -58,18 +58,22 @@ foreach ($ivs as $iv) {
--- testing different key lengths
key length=8
-string(112) "05c9c4cafb9937d950bdae60ee3abcb8d9f3e1f1fac8acaaa5b11d70b7ca02f3b76d447ab3dd85a4b5df5dedb4b4654595ccdf6da97fa93f"
+
+Warning: mcrypt_ecb(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
key length=20
-string(112) "0fc7045c4fb4dbcf44baf9ed15ab40331a42ff0632318a16b12ed5873f02e7945e4f63f408d6849534cbb7419c22c8854aaa85e0e05a28e6"
+
+Warning: mcrypt_ecb(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
key length=24
string(112) "923eedcb20e18e3efa466a6ca1b842b34e6ac46aa3690ef739d0d68a26eb64e1a6ad42e7d18312ae8a57ab927e1dc892e5ff56c061864f27"
key length=26
-Warning: mcrypt_ecb(): Size of key is too large for this algorithm in %s on line %d
-string(112) "923eedcb20e18e3efa466a6ca1b842b34e6ac46aa3690ef739d0d68a26eb64e1a6ad42e7d18312ae8a57ab927e1dc892e5ff56c061864f27"
+Warning: mcrypt_ecb(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
--- testing different iv lengths
diff --git a/ext/mcrypt/tests/mcrypt_ecb_variation2.phpt b/ext/mcrypt/tests/mcrypt_ecb_variation2.phpt
index ed57400e0f..246533b722 100644
--- a/ext/mcrypt/tests/mcrypt_ecb_variation2.phpt
+++ b/ext/mcrypt/tests/mcrypt_ecb_variation2.phpt
@@ -126,31 +126,40 @@ fclose($fp);
*** Testing mcrypt_ecb() : usage variation ***
--int 0--
-string(32) "e469e6b066f9600e1eefd8f53365f96c"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--int 1--
-string(32) "e469e6b066f9600e1eefd8f53365f96c"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--int 12345--
-string(32) "d74e5f51d1199bcfa61f80168e913007"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--int -12345--
-string(32) "17fe485ed735abb34c1dd4455af7b79c"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float 10.5--
-string(32) "cd735509aa4013a130e011686d66ae01"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float -10.5--
-string(32) "a57d99d6d5813039abf50fc50d631e47"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float 12.3456789000e10--
-string(32) "f17ede0bfdaa4408f545f7f4c8b040d2"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float -12.3456789000e10--
-string(32) "326f64e3b9bd5a6beb0a9b52a09a5a48"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float .5--
-string(32) "2aedf7661cd4d8c7593f44c58718e2b8"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--empty array--
Error: 2 - mcrypt_ecb() expects parameter 2 to be string, array given, %s(%d)
@@ -169,41 +178,52 @@ Error: 2 - mcrypt_ecb() expects parameter 2 to be string, array given, %s(%d)
string(0) ""
--uppercase NULL--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--lowercase null--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--lowercase true--
-string(32) "e469e6b066f9600e1eefd8f53365f96c"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--lowercase false--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--uppercase TRUE--
-string(32) "e469e6b066f9600e1eefd8f53365f96c"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--uppercase FALSE--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--empty string DQ--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--empty string SQ--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--instance of classWithToString--
-string(32) "1fd3514d8ced44d04d9dc7511fce33ef"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--instance of classWithoutToString--
Error: 2 - mcrypt_ecb() expects parameter 2 to be string, object given, %s(%d)
string(0) ""
--undefined var--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--unset var--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--resource--
Error: 2 - mcrypt_ecb() expects parameter 2 to be string, resource given, %s(%d)
diff --git a/ext/mcrypt/tests/mcrypt_ecb_variation3.phpt b/ext/mcrypt/tests/mcrypt_ecb_variation3.phpt
index 2999304563..171468f82f 100644
--- a/ext/mcrypt/tests/mcrypt_ecb_variation3.phpt
+++ b/ext/mcrypt/tests/mcrypt_ecb_variation3.phpt
@@ -29,7 +29,7 @@ set_error_handler('test_error_handler');
// Initialise function arguments not being substituted (if any)
$cipher = MCRYPT_TRIPLEDES;
-$key = b'string_val';
+$key = b"string_val\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
$mode = MCRYPT_ENCRYPT;
$iv = b'01234567';
diff --git a/ext/mcrypt/tests/mcrypt_ecb_variation4.phpt b/ext/mcrypt/tests/mcrypt_ecb_variation4.phpt
index e52040e295..b5c4f294eb 100644
--- a/ext/mcrypt/tests/mcrypt_ecb_variation4.phpt
+++ b/ext/mcrypt/tests/mcrypt_ecb_variation4.phpt
@@ -29,7 +29,7 @@ set_error_handler('test_error_handler');
// Initialise function arguments not being substituted (if any)
$cipher = MCRYPT_TRIPLEDES;
-$key = b'string_val';
+$key = b"string_val\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
$data = b'string_val';
$iv = b'01234567';
diff --git a/ext/mcrypt/tests/mcrypt_ecb_variation5.phpt b/ext/mcrypt/tests/mcrypt_ecb_variation5.phpt
index 3f4f7f5ddb..8771b9a78c 100644
--- a/ext/mcrypt/tests/mcrypt_ecb_variation5.phpt
+++ b/ext/mcrypt/tests/mcrypt_ecb_variation5.phpt
@@ -29,7 +29,7 @@ set_error_handler('test_error_handler');
// Initialise function arguments not being substituted (if any)
$cipher = MCRYPT_TRIPLEDES;
-$key = b'string_val';
+$key = b"string_val\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
$data = b'string_val';
$mode = MCRYPT_ENCRYPT;
diff --git a/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt b/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt
index f86bd3925c..51a64943b2 100644
--- a/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt
+++ b/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt
@@ -49,7 +49,7 @@ foreach ($keys as $key) {
var_dump(bin2hex(mcrypt_encrypt($cipher, $key, $data, $mode, $iv)));
}
-$key = b'1234567890123456';
+$key = b'123456789012345678901234';
echo "\n--- testing different iv lengths\n";
foreach ($ivs as $iv) {
echo "\niv length=".strlen($iv)."\n";
@@ -64,31 +64,35 @@ foreach ($ivs as $iv) {
--- testing different key lengths
key length=8
-string(112) "082b437d039d09418e20dc9de1dafa7ed6da5c6335b78950968441da1faf40c1f886e04da8ca177b80b376811e138c1bf51cb48dae2e7939"
+
+Warning: mcrypt_encrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
key length=20
-string(112) "0627351e0f8a082bf7981ae2c700a43fd3d44b270ac67b00fded1c5796eea935be0fef2a23da0b3f5e243929e62ac957bf0bf463aa90fc4f"
+
+Warning: mcrypt_encrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
key length=24
string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b62617eb2e44213c2d44462d388bc0b8f119384b12c84ac"
key length=26
-Warning: mcrypt_encrypt(): Size of key is too large for this algorithm in %s on line %d
-string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b62617eb2e44213c2d44462d388bc0b8f119384b12c84ac"
+Warning: mcrypt_encrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
--- testing different iv lengths
iv length=4
-Warning: mcrypt_encrypt(): The IV parameter must be as long as the blocksize in %s on line %d
-string(112) "440a6f54601969b127aad3c217ce7583c7f7b29989693130645569301db0020b29a34a3dcd104b2d0e3ba19d6cbd8a33d352b9c27cc34ef1"
+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
-string(112) "bac347506bf092c5557c4363c301745d78f047028e2953e84fd66b30aeb6005812dadbe8baa871b83278341599b0c448ddaaa52b5a378ce5"
+string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b62617eb2e44213c2d44462d388bc0b8f119384b12c84ac"
iv length=9
-Warning: mcrypt_encrypt(): The IV parameter must be as long as the blocksize in %s on line %d
-string(112) "440a6f54601969b127aad3c217ce7583c7f7b29989693130645569301db0020b29a34a3dcd104b2d0e3ba19d6cbd8a33d352b9c27cc34ef1"
+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_3des_ecb.phpt b/ext/mcrypt/tests/mcrypt_encrypt_3des_ecb.phpt
index 1b3188f8e5..941eb7935f 100644
--- a/ext/mcrypt/tests/mcrypt_encrypt_3des_ecb.phpt
+++ b/ext/mcrypt/tests/mcrypt_encrypt_3des_ecb.phpt
@@ -34,7 +34,7 @@ foreach ($keys as $key) {
var_dump(bin2hex(mcrypt_encrypt($cipher, $key, $data, $mode)));
}
-$key = b'12345678';
+$key = b'123456789012345678901234';
$ivs = array(
b'1234',
b'12345678',
@@ -56,27 +56,31 @@ foreach ($ivs as $iv) {
--- testing different key lengths
key length=8
-string(112) "05c9c4cafb9937d950bdae60ee3abcb8d9f3e1f1fac8acaaa5b11d70b7ca02f3b76d447ab3dd85a4b5df5dedb4b4654595ccdf6da97fa93f"
+
+Warning: mcrypt_encrypt(): Key of size 8 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
key length=20
-string(112) "0fc7045c4fb4dbcf44baf9ed15ab40331a42ff0632318a16b12ed5873f02e7945e4f63f408d6849534cbb7419c22c8854aaa85e0e05a28e6"
+
+Warning: mcrypt_encrypt(): Key of size 20 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
key length=24
string(112) "923eedcb20e18e3efa466a6ca1b842b34e6ac46aa3690ef739d0d68a26eb64e1a6ad42e7d18312ae8a57ab927e1dc892e5ff56c061864f27"
key length=26
-Warning: mcrypt_encrypt(): Size of key is too large for this algorithm in %s on line %d
-string(112) "923eedcb20e18e3efa466a6ca1b842b34e6ac46aa3690ef739d0d68a26eb64e1a6ad42e7d18312ae8a57ab927e1dc892e5ff56c061864f27"
+Warning: mcrypt_encrypt(): Key of size 26 not supported by this algorithm. Only keys of size 24 supported in %s on line %d
+string(0) ""
--- testing different iv lengths
iv length=4
-string(112) "05c9c4cafb9937d950bdae60ee3abcb8d9f3e1f1fac8acaaa5b11d70b7ca02f3b76d447ab3dd85a4b5df5dedb4b4654595ccdf6da97fa93f"
+string(112) "923eedcb20e18e3efa466a6ca1b842b34e6ac46aa3690ef739d0d68a26eb64e1a6ad42e7d18312ae8a57ab927e1dc892e5ff56c061864f27"
iv length=8
-string(112) "05c9c4cafb9937d950bdae60ee3abcb8d9f3e1f1fac8acaaa5b11d70b7ca02f3b76d447ab3dd85a4b5df5dedb4b4654595ccdf6da97fa93f"
+string(112) "923eedcb20e18e3efa466a6ca1b842b34e6ac46aa3690ef739d0d68a26eb64e1a6ad42e7d18312ae8a57ab927e1dc892e5ff56c061864f27"
iv length=9
-string(112) "05c9c4cafb9937d950bdae60ee3abcb8d9f3e1f1fac8acaaa5b11d70b7ca02f3b76d447ab3dd85a4b5df5dedb4b4654595ccdf6da97fa93f"
+string(112) "923eedcb20e18e3efa466a6ca1b842b34e6ac46aa3690ef739d0d68a26eb64e1a6ad42e7d18312ae8a57ab927e1dc892e5ff56c061864f27"
===DONE===
diff --git a/ext/mcrypt/tests/mcrypt_encrypt_variation2.phpt b/ext/mcrypt/tests/mcrypt_encrypt_variation2.phpt
index 0f4fd0fe87..b1bf7f74bd 100644
--- a/ext/mcrypt/tests/mcrypt_encrypt_variation2.phpt
+++ b/ext/mcrypt/tests/mcrypt_encrypt_variation2.phpt
@@ -124,31 +124,40 @@ fclose($fp);
*** Testing mcrypt_encrypt() : usage variation ***
--int 0--
-string(32) "e469e6b066f9600e1eefd8f53365f96c"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--int 1--
-string(32) "e469e6b066f9600e1eefd8f53365f96c"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--int 12345--
-string(32) "d74e5f51d1199bcfa61f80168e913007"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--int -12345--
-string(32) "17fe485ed735abb34c1dd4455af7b79c"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float 10.5--
-string(32) "cd735509aa4013a130e011686d66ae01"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float -10.5--
-string(32) "a57d99d6d5813039abf50fc50d631e47"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float 12.3456789000e10--
-string(32) "f17ede0bfdaa4408f545f7f4c8b040d2"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float -12.3456789000e10--
-string(32) "326f64e3b9bd5a6beb0a9b52a09a5a48"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--float .5--
-string(32) "2aedf7661cd4d8c7593f44c58718e2b8"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--empty array--
Error: 2 - mcrypt_encrypt() expects parameter 2 to be string, array given, %s(%d)
@@ -167,41 +176,52 @@ Error: 2 - mcrypt_encrypt() expects parameter 2 to be string, array given, %s(%d
string(0) ""
--uppercase NULL--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--lowercase null--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--lowercase true--
-string(32) "e469e6b066f9600e1eefd8f53365f96c"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--lowercase false--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--uppercase TRUE--
-string(32) "e469e6b066f9600e1eefd8f53365f96c"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--uppercase FALSE--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--empty string DQ--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--empty string SQ--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--instance of classWithToString--
-string(32) "1fd3514d8ced44d04d9dc7511fce33ef"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--instance of classWithoutToString--
Error: 2 - mcrypt_encrypt() expects parameter 2 to be string, object given, %s(%d)
string(0) ""
--undefined var--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--unset var--
-string(32) "bfa2cb7240c8d2f6abeb34960c04f6d3"
+Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
+string(0) ""
--resource--
Error: 2 - mcrypt_encrypt() expects parameter 2 to be string, resource given, %s(%d)
diff --git a/ext/mcrypt/tests/mcrypt_encrypt_variation3.phpt b/ext/mcrypt/tests/mcrypt_encrypt_variation3.phpt
index c472540640..9fb8e7c550 100644
--- a/ext/mcrypt/tests/mcrypt_encrypt_variation3.phpt
+++ b/ext/mcrypt/tests/mcrypt_encrypt_variation3.phpt
@@ -27,7 +27,7 @@ set_error_handler('test_error_handler');
// Initialise function arguments not being substituted (if any)
$cipher = MCRYPT_TRIPLEDES;
-$key = b'string_val';
+$key = b"string_val\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
$mode = MCRYPT_MODE_ECB;
$iv = b'01234567';
diff --git a/ext/mcrypt/tests/mcrypt_encrypt_variation4.phpt b/ext/mcrypt/tests/mcrypt_encrypt_variation4.phpt
index 4c8cef1db3..a041ab437e 100644
--- a/ext/mcrypt/tests/mcrypt_encrypt_variation4.phpt
+++ b/ext/mcrypt/tests/mcrypt_encrypt_variation4.phpt
@@ -160,24 +160,20 @@ Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
bool(false)
--empty array--
-Error: 8 - Array to string conversion, %s(%d)
-Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
-bool(false)
+Error: 2 - mcrypt_encrypt() expects parameter 4 to be string, array given, %s(%d)
+NULL
--int indexed array--
-Error: 8 - Array to string conversion, %s(%d)
-Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
-bool(false)
+Error: 2 - mcrypt_encrypt() expects parameter 4 to be string, array given, %s(%d)
+NULL
--associative array--
-Error: 8 - Array to string conversion, %s(%d)
-Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
-bool(false)
+Error: 2 - mcrypt_encrypt() expects parameter 4 to be string, array given, %s(%d)
+NULL
--nested arrays--
-Error: 8 - Array to string conversion, %s(%d)
-Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
-bool(false)
+Error: 2 - mcrypt_encrypt() expects parameter 4 to be string, array given, %s(%d)
+NULL
--uppercase NULL--
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
@@ -216,10 +212,8 @@ Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
bool(false)
--instance of classWithoutToString--
-Error: 4096 - Object of class classWithoutToString could not be converted to string, %s(%d)
-Error: 8 - Object of class classWithoutToString to string conversion, %s(%d)
-Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
-bool(false)
+Error: 2 - mcrypt_encrypt() expects parameter 4 to be string, object given, %s(%d)
+NULL
--undefined var--
Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
@@ -230,6 +224,6 @@ Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
bool(false)
--resource--
-Error: 2 - mcrypt_encrypt(): Module initialization failed, %s(%d)
-bool(false)
+Error: 2 - mcrypt_encrypt() expects parameter 4 to be string, resource given, %s(%d)
+NULL
===DONE===
diff --git a/ext/mcrypt/tests/mcrypt_encrypt_variation5.phpt b/ext/mcrypt/tests/mcrypt_encrypt_variation5.phpt
index ecadb7651c..fdba526840 100644
--- a/ext/mcrypt/tests/mcrypt_encrypt_variation5.phpt
+++ b/ext/mcrypt/tests/mcrypt_encrypt_variation5.phpt
@@ -27,7 +27,7 @@ set_error_handler('test_error_handler');
// Initialise function arguments not being substituted (if any)
$cipher = MCRYPT_TRIPLEDES;
-$key = b'string_val';
+$key = b"string_val\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
$data = b'string_val';
//in php, it incorrectly reports problems with iv in ECB mode.
$mode = MCRYPT_MODE_CBC;
@@ -125,40 +125,40 @@ 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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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--
Error: 2 - mcrypt_encrypt() expects parameter 5 to be string, array given, %s(%d)
@@ -177,52 +177,52 @@ 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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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--
Error: 2 - mcrypt_encrypt() expects parameter 5 to be string, object given, %s(%d)
string(0) ""
--undefined var--
-Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+Error: 2 - mcrypt_encrypt(): Received initialization vector of size %d, but size 8 is required for this encryption mode, %s(%d)
+string(0) ""
--resource--
Error: 2 - mcrypt_encrypt() expects parameter 5 to be string, resource given, %s(%d)
diff --git a/ext/mcrypt/tests/mcrypt_ofb.phpt b/ext/mcrypt/tests/mcrypt_ofb.phpt
index 9420353060..5580575a48 100644
--- a/ext/mcrypt/tests/mcrypt_ofb.phpt
+++ b/ext/mcrypt/tests/mcrypt_ofb.phpt
@@ -4,7 +4,7 @@ mcrypt_ofb
<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
--FILE--
<?php
-$key = "FooBar";
+$key = "0123456789012345";
$secret = "PHP Testfest 2008";
$cipher = MCRYPT_RIJNDAEL_128;
diff --git a/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt b/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt
index e450a69047..621f7b1dbd 100644
--- a/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt
+++ b/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test mcrypt_encrypt() function : TripleDES functionality
+Test mcrypt_encrypt() function : AES functionality
--SKIPIF--
<?php
if (!extension_loaded("mcrypt")) {
@@ -75,22 +75,34 @@ foreach ($ivs as $iv) {
--- testing different key lengths
key length=0
-string(128) "4fbf24aaa789f5194260ade1acd9499402c1845cc517e8fe43cfb5b90a0df294db33ecd1a836c47d6bf6d8600512ba415e17008a1e1991f81056258d82099397"
+
+Warning: mcrypt_encrypt(): Key of size 0 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
+string(0) ""
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
+
+Warning: mcrypt_cbc(): Key of size 0 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
+string(0) ""
key length=0
-string(128) "4fbf24aaa789f5194260ade1acd9499402c1845cc517e8fe43cfb5b90a0df294db33ecd1a836c47d6bf6d8600512ba415e17008a1e1991f81056258d82099397"
+
+Warning: mcrypt_encrypt(): Key of size 0 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
+string(0) ""
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
+
+Warning: mcrypt_cbc(): Key of size 0 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
+string(0) ""
key length=8
-string(128) "d6a3042b278fa5816dc6f46152acbe5fd7d1813c3808c27cd969d8e10a64d0238724edfda0322f4512308f22d142df0e92bed861c2b732f7650e234df59183dc"
+
+Warning: mcrypt_encrypt(): Key of size 8 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
+string(0) ""
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
-string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
+
+Warning: mcrypt_cbc(): Key of size 8 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
+string(0) ""
key length=16
string(128) "dc8f957ec530acf10cd95ba7da7b6405380fe19a2941e9a8de54680512f18491bc374e5464885ae6c2ae2aa7a6cdd2fbe12a06bbc4bd59dbbfaa15f09044f101"
@@ -104,31 +116,31 @@ 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
-string(128) "c082b3fabaae4c8c410eb8dba64bae10e48d79b5241fb8f24462cad43bd0b35ad2746b00817e9dcbc636b44df0ec60b46a57e7a310a308a0947724e3817a13b4"
+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
-string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
+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
-string(128) "c082b3fabaae4c8c410eb8dba64bae10e48d79b5241fb8f24462cad43bd0b35ad2746b00817e9dcbc636b44df0ec60b46a57e7a310a308a0947724e3817a13b4"
+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
-string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
+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
-string(128) "c082b3fabaae4c8c410eb8dba64bae10e48d79b5241fb8f24462cad43bd0b35ad2746b00817e9dcbc636b44df0ec60b46a57e7a310a308a0947724e3817a13b4"
+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
-string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
+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
@@ -140,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
-string(128) "c082b3fabaae4c8c410eb8dba64bae10e48d79b5241fb8f24462cad43bd0b35ad2746b00817e9dcbc636b44df0ec60b46a57e7a310a308a0947724e3817a13b4"
+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
-string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
+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===
diff --git a/ext/mcrypt/tests/mcrypt_rijndael128_256BitKey.phpt b/ext/mcrypt/tests/mcrypt_rijndael128_256BitKey.phpt
index f69d369294..672e1ee1b7 100644
--- a/ext/mcrypt/tests/mcrypt_rijndael128_256BitKey.phpt
+++ b/ext/mcrypt/tests/mcrypt_rijndael128_256BitKey.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test mcrypt_encrypt() function : TripleDES functionality
+Test mcrypt_encrypt() function : AES functionality
--SKIPIF--
<?php
if (!extension_loaded("mcrypt")) {
@@ -62,16 +62,24 @@ foreach ($keys as $key) {
--- testing different key lengths
key length=20
-string(128) "6369830bfc89a39c9981c9a40e349e3bbc8599c28d7ffbd7a330a67690dac6dfb76a55814e95c83cced68eb1544cdd8406d272c249bd0a60fa5b605d4aefbaa0"
-string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
+
+Warning: mcrypt_encrypt(): Key of size 20 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
+string(0) ""
+
+Warning: mcrypt_decrypt(): Key of size 20 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
+string(0) ""
key length=24
string(128) "8ecdf1ed5742aff16ef34c819c8d22c707c54f4d9ffc18e5f6ab79fe68c25705351e2c001a0b9f29e5def67570ca9da644efb69a8bb97940cb4bec094dae8bb5"
string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
key length=30
-string(128) "f7731f0c0ab22270b2f516c7837256ed731ba6658ca8f78cda2ab1588e204f990843719ae88474f6572711674fcda9f40d99155e4cc4f5a31aa461ad36a7871d"
-string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
+
+Warning: mcrypt_encrypt(): Key of size 30 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
+string(0) ""
+
+Warning: mcrypt_decrypt(): Key of size 30 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
+string(0) ""
key length=32
string(128) "f23bc103bfd0859a8318acee6d96e5f43dff68f3cdeae817a1e77c33492e32bdb82c5f660fcd1a2bfda70d9de4d5d8028ce179a9e2f7f9ee7dd61c7b4b409e95"
@@ -79,9 +87,9 @@ string(128) "546869732069732074686520736563726574206d657373616765207768696368206
key length=40
-Warning: mcrypt_encrypt(): Size of key is too large for this algorithm in %s on line %d
-string(128) "f23bc103bfd0859a8318acee6d96e5f43dff68f3cdeae817a1e77c33492e32bdb82c5f660fcd1a2bfda70d9de4d5d8028ce179a9e2f7f9ee7dd61c7b4b409e95"
+Warning: mcrypt_encrypt(): Key of size 40 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
+string(0) ""
-Warning: mcrypt_decrypt(): Size of key is too large for this algorithm in %s on line %d
-string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
-===DONE=== \ No newline at end of file
+Warning: mcrypt_decrypt(): Key of size 40 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in %s on line %d
+string(0) ""
+===DONE===