Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Make mcrypt input handling stricter #610

Closed
wants to merge 6 commits into from

3 participants

@nikic
Owner

No longer allow invalid IV size, invalid key size or missing IV on modes that require an IV.

nikic added some commits
@nikic nikic Abort on invalid IV size
Previously, if the size of the IV did not match the block size
mcrypt would throw a warning and fall back to a NUL IV. This
behavior is both dangerous and makes no practical sense.

mcrypt_encrypt etc. will now return false if the IV has an incorrect
size.
27d75b8
@nikic nikic Abort on missing IV if the enc_mode requires it
Previously the code fell back on using a NUL IV if no IV was
passed and the encryption mode required it. This is dangerous and
makes no sense from a practical point of view (as you could just
as well use ECB then).
5480b64
@nikic nikic Abort on invalid key size
Previously an incorrectly sized key was either silently padded
with NUL bytes or truncated. Especially the silent nature of this
behavior makes it extremely easy to use weak encryption. A common
mistake - which has also been extensively made in our tests - is
to use a password instead of a key.

Incorrectly sized keys will now be rejected.
88d0053
@nikic nikic Clean up do_crypt code
Avoid unnecessary alloc/copy/free cycles and clean up structure in
general. Add a few extra checks for the key length.
9539d1c
ext/mcrypt/mcrypt.c
@@ -1165,14 +1165,43 @@ static PHP_MSHUTDOWN_FUNCTION(mcrypt) /* {{{ */
}
/* }}} */
-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 zend_bool php_mcrypt_is_valid_key_size(MCRYPT td, int key_len) /* {{{ */
+{
+ if (key_len <= 0) {
+ return 0;
+ }
+
+ if (key_len > mcrypt_enc_get_key_size(td)) {
+ return 0;
+ }
+
+ {
+ int count, i;
+ int *key_sizes = mcrypt_enc_get_supported_key_sizes(td, &count);
@derickr Owner
derickr added a note

Seems a bit pointless to start a new scope here. Just put the definitions at the start?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
ext/mcrypt/mcrypt.c
((19 lines not shown))
- 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_is_valid_key_size(td, key_len)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Key of length %d not supported by this algorithm", key_len);
@derickr Owner
derickr added a note

It should say which ones are supported though.

@nikic Owner
nikic added a note

I've added the supported key sizes to the error message, thanks for the suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@derickr derickr commented on the diff
ext/mcrypt/mcrypt.c
((6 lines not shown))
- 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 */
@derickr Owner
derickr added a note

determine (extra r)

@nikic Owner
nikic added a note

That's in a deleted piece of code ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@php-pulls
Collaborator

Comment on behalf of nikic at php.net:

Merged.

@php-pulls php-pulls closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 1, 2014
  1. @nikic

    Abort on invalid IV size

    nikic authored
    Previously, if the size of the IV did not match the block size
    mcrypt would throw a warning and fall back to a NUL IV. This
    behavior is both dangerous and makes no practical sense.
    
    mcrypt_encrypt etc. will now return false if the IV has an incorrect
    size.
  2. @nikic

    Abort on missing IV if the enc_mode requires it

    nikic authored
    Previously the code fell back on using a NUL IV if no IV was
    passed and the encryption mode required it. This is dangerous and
    makes no sense from a practical point of view (as you could just
    as well use ECB then).
  3. @nikic

    Abort on invalid key size

    nikic authored
    Previously an incorrectly sized key was either silently padded
    with NUL bytes or truncated. Especially the silent nature of this
    behavior makes it extremely easy to use weak encryption. A common
    mistake - which has also been extensively made in our tests - is
    to use a password instead of a key.
    
    Incorrectly sized keys will now be rejected.
  4. @nikic

    Clean up do_crypt code

    nikic authored
    Avoid unnecessary alloc/copy/free cycles and clean up structure in
    general. Add a few extra checks for the key length.
Commits on Mar 2, 2014
  1. @nikic
  2. @nikic
This page is out of date. Refresh to see the latest.
Showing with 511 additions and 326 deletions.
  1. +115 −67 ext/mcrypt/mcrypt.c
  2. +7 −6 ext/mcrypt/tests/bug46010.phpt
  3. +5 −3 ext/mcrypt/tests/mcrypt_cbc.phpt
  4. +13 −9 ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt
  5. +13 −9 ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt
  6. +40 −20 ext/mcrypt/tests/mcrypt_cbc_variation2.phpt
  7. +1 −1  ext/mcrypt/tests/mcrypt_cbc_variation3.phpt
  8. +1 −1  ext/mcrypt/tests/mcrypt_cbc_variation4.phpt
  9. +21 −21 ext/mcrypt/tests/mcrypt_cbc_variation5.phpt
  10. +4 −3 ext/mcrypt/tests/mcrypt_cfb.phpt
  11. +6 −5 ext/mcrypt/tests/mcrypt_decrypt.phpt
  12. +13 −9 ext/mcrypt/tests/mcrypt_decrypt_3des_cbc.phpt
  13. +13 −9 ext/mcrypt/tests/mcrypt_decrypt_3des_ecb.phpt
  14. +40 −20 ext/mcrypt/tests/mcrypt_decrypt_variation2.phpt
  15. +1 −1  ext/mcrypt/tests/mcrypt_decrypt_variation3.phpt
  16. +21 −21 ext/mcrypt/tests/mcrypt_decrypt_variation5.phpt
  17. +1 −1  ext/mcrypt/tests/mcrypt_ecb.phpt
  18. +12 −8 ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt
  19. +9 −5 ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt
  20. +40 −20 ext/mcrypt/tests/mcrypt_ecb_variation2.phpt
  21. +1 −1  ext/mcrypt/tests/mcrypt_ecb_variation3.phpt
  22. +1 −1  ext/mcrypt/tests/mcrypt_ecb_variation4.phpt
  23. +1 −1  ext/mcrypt/tests/mcrypt_ecb_variation5.phpt
  24. +12 −8 ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt
  25. +12 −8 ext/mcrypt/tests/mcrypt_encrypt_3des_ecb.phpt
  26. +40 −20 ext/mcrypt/tests/mcrypt_encrypt_variation2.phpt
  27. +1 −1  ext/mcrypt/tests/mcrypt_encrypt_variation3.phpt
  28. +21 −21 ext/mcrypt/tests/mcrypt_encrypt_variation5.phpt
  29. +1 −1  ext/mcrypt/tests/mcrypt_ofb.phpt
  30. +27 −15 ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt
  31. +18 −10 ext/mcrypt/tests/mcrypt_rijndael128_256BitKey.phpt
View
182 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;
@@ -658,7 +659,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 +1166,95 @@ 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 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 +1265,58 @@ 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 */
@derickr Owner
derickr added a note

determine (extra r)

@nikic Owner
nikic added a note

That's in a deleted piece of code ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
- 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 (!iv) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Encryption mode requires an initialization vector");
+ mcrypt_module_close(td);
+ RETURN_FALSE;
+ }
+
+ if (iv_len != mcrypt_enc_get_iv_size(td)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, MCRYPT_IV_WRONG_SIZE);
+ mcrypt_module_close(td);
+ RETURN_FALSE;
}
}
/* 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);
}
/* }}} */
@@ -1284,7 +1332,7 @@ PHP_FUNCTION(mcrypt_encrypt)
convert_to_string_ex(mode);
- 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, Z_STRVAL_PP(mode), iv, iv_len, MCRYPT_ENCRYPT, return_value TSRMLS_CC);
}
/* }}} */
@@ -1300,7 +1348,7 @@ PHP_FUNCTION(mcrypt_decrypt)
convert_to_string_ex(mode);
- 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, Z_STRVAL_PP(mode), iv, iv_len, MCRYPT_DECRYPT, return_value TSRMLS_CC);
}
/* }}} */
@@ -1316,7 +1364,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 +1380,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 +1396,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 +1412,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);
}
/* }}} */
View
13 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"
View
8 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 in %s on line %d
+bool(false)
View
22 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
@@ -100,17 +104,17 @@ 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"
+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"
+string(0) ""
===DONE===
View
22 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
@@ -83,17 +87,17 @@ 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"
+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"
+string(0) ""
===DONE===
View
60 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)
View
2  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';
View
2  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';
View
42 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;
@@ -126,47 +126,47 @@ fclose($fp);
--int 0--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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"
+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"
+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"
+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"
+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"
+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"
+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"
+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"
+string(0) ""
--empty array--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
@@ -191,47 +191,47 @@ string(0) ""
--uppercase NULL--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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"
+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"
+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"
+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"
+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"
+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"
+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"
+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"
+string(0) ""
--instance of classWithoutToString--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
@@ -241,12 +241,12 @@ string(0) ""
--undefined var--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+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"
+string(0) ""
--resource--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
View
7 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 in %s on line %d
+bool(false)
View
11 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 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)
+bool(false)
View
22 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"
+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"
+string(0) ""
===DONE===
View
22 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===
View
60 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)
View
2  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';
View
42 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;
@@ -125,39 +125,39 @@ fclose($fp);
--int 0--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--int 1--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--int 12345--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--int -12345--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--float 10.5--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--float -10.5--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--float 12.3456789000e10--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--float -12.3456789000e10--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--float .5--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--empty array--
Error: 2 - mcrypt_decrypt() expects parameter 5 to be string, array given, %s(%d)
@@ -177,39 +177,39 @@ string(0) ""
--uppercase NULL--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--lowercase null--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--lowercase true--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--lowercase false--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--uppercase TRUE--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--uppercase FALSE--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--empty string DQ--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--empty string SQ--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--instance of classWithToString--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--instance of classWithoutToString--
Error: 2 - mcrypt_decrypt() expects parameter 5 to be string, object given, %s(%d)
@@ -217,11 +217,11 @@ string(0) ""
--undefined var--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--unset var--
Error: 2 - mcrypt_decrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "a80c6cef6b42c875e2372a0339dc22b0"
+string(0) ""
--resource--
Error: 2 - mcrypt_decrypt() expects parameter 5 to be string, resource given, %s(%d)
View
2  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;
View
20 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===
View
14 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
View
60 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)
View
2  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';
View
2  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';
View
2  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;
View
20 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"
+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"
+string(0) ""
===DONE===
View
20 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===
View
60 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)
View
2  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';
View
42 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;
@@ -126,39 +126,39 @@ fclose($fp);
--int 0--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--int 1--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--int 12345--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--int -12345--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--float 10.5--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--float -10.5--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--float 12.3456789000e10--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--float -12.3456789000e10--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--float .5--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--empty array--
Error: 2 - mcrypt_encrypt() expects parameter 5 to be string, array given, %s(%d)
@@ -178,39 +178,39 @@ string(0) ""
--uppercase NULL--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--lowercase null--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--lowercase true--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--lowercase false--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--uppercase TRUE--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--uppercase FALSE--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--empty string DQ--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--empty string SQ--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--instance of classWithToString--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--instance of classWithoutToString--
Error: 2 - mcrypt_encrypt() expects parameter 5 to be string, object given, %s(%d)
@@ -218,11 +218,11 @@ string(0) ""
--undefined var--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--unset var--
Error: 2 - mcrypt_encrypt(): The IV parameter must be as long as the blocksize, %s(%d)
-string(32) "6438db90653c4d3080c3ceab43618c05"
+string(0) ""
--resource--
Error: 2 - mcrypt_encrypt() expects parameter 5 to be string, resource given, %s(%d)
View
2  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;
View
42 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"
@@ -105,30 +117,30 @@ iv length=0
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Warning: mcrypt_cbc(): The IV parameter must be as long as the blocksize in %s on line %d
-string(128) "c082b3fabaae4c8c410eb8dba64bae10e48d79b5241fb8f24462cad43bd0b35ad2746b00817e9dcbc636b44df0ec60b46a57e7a310a308a0947724e3817a13b4"
+string(0) ""
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in %s on line %d
-string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
+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"
+string(0) ""
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in %s on line %d
-string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
+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"
+string(0) ""
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in %s on line %d
-string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
+string(0) ""
iv length=16
@@ -141,8 +153,8 @@ 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"
+string(0) ""
Warning: mcrypt_decrypt(): The IV parameter must be as long as the blocksize in %s on line %d
-string(128) "546869732069732074686520736563726574206d657373616765207768696368206d75737420626520656e637279707465640000000000000000000000000000"
+string(0) ""
===DONE===
View
28 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===
+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===
Something went wrong with that request. Please try again.