Print supported key sizes in error message

This commit is contained in:
Nikita Popov 2014-03-02 23:23:12 +01:00
parent 32333abe3e
commit e4876ecbfb
15 changed files with 190 additions and 138 deletions

View File

@ -40,6 +40,7 @@
#include "php_globals.h" #include "php_globals.h"
#include "ext/standard/info.h" #include "ext/standard/info.h"
#include "ext/standard/php_rand.h" #include "ext/standard/php_rand.h"
#include "ext/standard/php_smart_str.h"
#include "php_mcrypt_filter.h" #include "php_mcrypt_filter.h"
static int le_mcrypt; static int le_mcrypt;
@ -1165,35 +1166,87 @@ PHP_FUNCTION(mcrypt_get_cipher_name)
} }
/* }}} */ /* }}} */
static zend_bool php_mcrypt_is_valid_key_size(MCRYPT td, int key_len) /* {{{ */ static char *php_mcrypt_get_key_size_str(
int max_key_size, const int *key_sizes, int key_size_count) /* {{{ */
{ {
if (key_len <= 0) { 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; return 0;
} }
if (key_len > mcrypt_enc_get_key_size(td)) { if (key_size_count == 0) {
return 0; /* All key sizes are valid */
return 1;
} }
{ for (i = 0; i < key_size_count; i++) {
int count, i; if (key_sizes[i] == key_size) {
int *key_sizes = mcrypt_enc_get_supported_key_sizes(td, &count);
if (!key_sizes) {
/* All key sizes are valid */
return 1; return 1;
} }
for (i = 0; i < count; i++) {
if (key_sizes[i] == key_len) {
mcrypt_free(key_sizes);
return 1;
}
}
mcrypt_free(key_sizes);
return 0;
} }
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;
} }
/* }}} */ /* }}} */
@ -1214,8 +1267,7 @@ static void php_mcrypt_do_crypt(char* cipher, const char *key, int key_len, cons
} }
/* Checking for key-length */ /* Checking for key-length */
if (!php_mcrypt_is_valid_key_size(td, key_len)) { if (php_mcrypt_ensure_valid_key_size(td, key_len TSRMLS_CC) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Key of length %d not supported by this algorithm", key_len);
RETURN_FALSE; RETURN_FALSE;
} }

View File

@ -75,14 +75,14 @@ key length=8
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Warning: mcrypt_cbc(): Key of length 8 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=20 key length=20
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Warning: mcrypt_cbc(): Key of length 20 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=24 key length=24
@ -94,7 +94,7 @@ key length=26
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Warning: mcrypt_cbc(): Key of length 26 not supported by this algorithm in %s on line %d 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) "" string(0) ""
--- testing different iv lengths --- testing different iv lengths

View File

@ -58,14 +58,14 @@ key length=8
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Warning: mcrypt_cbc(): Key of length 8 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=20 key length=20
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Warning: mcrypt_cbc(): Key of length 20 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=24 key length=24
@ -77,7 +77,7 @@ key length=26
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Warning: mcrypt_cbc(): Key of length 26 not supported by this algorithm in %s on line %d 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) "" string(0) ""
--- testing different iv lengths --- testing different iv lengths

View File

@ -125,47 +125,47 @@ fclose($fp);
--int 0-- --int 0--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--int 1-- --int 1--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--int 12345-- --int 12345--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--int -12345-- --int -12345--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float 10.5-- --float 10.5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float -10.5-- --float -10.5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float 12.3456789000e10-- --float 12.3456789000e10--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float -12.3456789000e10-- --float -12.3456789000e10--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float .5-- --float .5--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--empty array-- --empty array--
@ -190,47 +190,47 @@ string(0) ""
--uppercase NULL-- --uppercase NULL--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--lowercase null-- --lowercase null--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--lowercase true-- --lowercase true--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--lowercase false-- --lowercase false--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--uppercase TRUE-- --uppercase TRUE--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--uppercase FALSE-- --uppercase FALSE--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--empty string DQ-- --empty string DQ--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--empty string SQ-- --empty string SQ--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--instance of classWithToString-- --instance of classWithToString--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--instance of classWithoutToString-- --instance of classWithoutToString--
@ -240,12 +240,12 @@ string(0) ""
--undefined var-- --undefined var--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--unset var-- --unset var--
Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d) Error: 8192 - Function mcrypt_cbc() is deprecated, %s(%d)
Error: 2 - mcrypt_cbc(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_cbc(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--resource-- --resource--

View File

@ -72,12 +72,12 @@ function special_var_dump($str) {
key length=8 key length=8
Warning: mcrypt_decrypt(): Key of length 8 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=20 key length=20
Warning: mcrypt_decrypt(): Key of length 20 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=24 key length=24
@ -85,7 +85,7 @@ string(32) "736563726574206d6573736167650000"
key length=26 key length=26
Warning: mcrypt_decrypt(): Key of length 26 not supported by this algorithm in %s on line %d 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) "" string(0) ""
--- testing different iv lengths --- testing different iv lengths

View File

@ -71,12 +71,12 @@ function special_var_dump($str) {
key length=8 key length=8
Warning: mcrypt_decrypt(): Key of length 8 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=20 key length=20
Warning: mcrypt_decrypt(): Key of length 20 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=24 key length=24
@ -84,7 +84,7 @@ string(32) "736563726574206d6573736167650000"
key length=26 key length=26
Warning: mcrypt_decrypt(): Key of length 26 not supported by this algorithm in %s on line %d 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) "" string(0) ""
--- testing different iv lengths --- testing different iv lengths

View File

@ -124,39 +124,39 @@ fclose($fp);
*** Testing mcrypt_decrypt() : usage variation *** *** Testing mcrypt_decrypt() : usage variation ***
--int 0-- --int 0--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--int 1-- --int 1--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--int 12345-- --int 12345--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--int -12345-- --int -12345--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float 10.5-- --float 10.5--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float -10.5-- --float -10.5--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float 12.3456789000e10-- --float 12.3456789000e10--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float -12.3456789000e10-- --float -12.3456789000e10--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float .5-- --float .5--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--empty array-- --empty array--
@ -176,39 +176,39 @@ Error: 2 - mcrypt_decrypt() expects parameter 2 to be string, array given, %s(%d
string(0) "" string(0) ""
--uppercase NULL-- --uppercase NULL--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--lowercase null-- --lowercase null--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--lowercase true-- --lowercase true--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--lowercase false-- --lowercase false--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--uppercase TRUE-- --uppercase TRUE--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--uppercase FALSE-- --uppercase FALSE--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--empty string DQ-- --empty string DQ--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--empty string SQ-- --empty string SQ--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--instance of classWithToString-- --instance of classWithToString--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--instance of classWithoutToString-- --instance of classWithoutToString--
@ -216,11 +216,11 @@ Error: 2 - mcrypt_decrypt() expects parameter 2 to be string, object given, %s(%
string(0) "" string(0) ""
--undefined var-- --undefined var--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--unset var-- --unset var--
Error: 2 - mcrypt_decrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_decrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--resource-- --resource--

View File

@ -74,12 +74,12 @@ function special_var_dump($str) {
key length=8 key length=8
Warning: mcrypt_ecb(): Key of length 8 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=20 key length=20
Warning: mcrypt_ecb(): Key of length 20 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=24 key length=24
@ -87,7 +87,7 @@ string(32) "736563726574206d6573736167650000"
key length=26 key length=26
Warning: mcrypt_ecb(): Key of length 26 not supported by this algorithm in %s on line %d 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) "" string(0) ""
--- testing different iv lengths --- testing different iv lengths

View File

@ -59,12 +59,12 @@ foreach ($ivs as $iv) {
key length=8 key length=8
Warning: mcrypt_ecb(): Key of length 8 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=20 key length=20
Warning: mcrypt_ecb(): Key of length 20 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=24 key length=24
@ -72,7 +72,7 @@ string(112) "923eedcb20e18e3efa466a6ca1b842b34e6ac46aa3690ef739d0d68a26eb64e1a6a
key length=26 key length=26
Warning: mcrypt_ecb(): Key of length 26 not supported by this algorithm in %s on line %d 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) "" string(0) ""
--- testing different iv lengths --- testing different iv lengths

View File

@ -126,39 +126,39 @@ fclose($fp);
*** Testing mcrypt_ecb() : usage variation *** *** Testing mcrypt_ecb() : usage variation ***
--int 0-- --int 0--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--int 1-- --int 1--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--int 12345-- --int 12345--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--int -12345-- --int -12345--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float 10.5-- --float 10.5--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float -10.5-- --float -10.5--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float 12.3456789000e10-- --float 12.3456789000e10--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float -12.3456789000e10-- --float -12.3456789000e10--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float .5-- --float .5--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--empty array-- --empty array--
@ -178,39 +178,39 @@ Error: 2 - mcrypt_ecb() expects parameter 2 to be string, array given, %s(%d)
string(0) "" string(0) ""
--uppercase NULL-- --uppercase NULL--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--lowercase null-- --lowercase null--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--lowercase true-- --lowercase true--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--lowercase false-- --lowercase false--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--uppercase TRUE-- --uppercase TRUE--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--uppercase FALSE-- --uppercase FALSE--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--empty string DQ-- --empty string DQ--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--empty string SQ-- --empty string SQ--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--instance of classWithToString-- --instance of classWithToString--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--instance of classWithoutToString-- --instance of classWithoutToString--
@ -218,11 +218,11 @@ Error: 2 - mcrypt_ecb() expects parameter 2 to be string, object given, %s(%d)
string(0) "" string(0) ""
--undefined var-- --undefined var--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--unset var-- --unset var--
Error: 2 - mcrypt_ecb(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_ecb(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--resource-- --resource--

View File

@ -65,12 +65,12 @@ foreach ($ivs as $iv) {
key length=8 key length=8
Warning: mcrypt_encrypt(): Key of length 8 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=20 key length=20
Warning: mcrypt_encrypt(): Key of length 20 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=24 key length=24
@ -78,7 +78,7 @@ string(112) "b85e21072239d60c63a80e7c9ae493cb741a1cd407e52f451c5f43a0d103f55a7b6
key length=26 key length=26
Warning: mcrypt_encrypt(): Key of length 26 not supported by this algorithm in %s on line %d 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) "" string(0) ""
--- testing different iv lengths --- testing different iv lengths

View File

@ -57,12 +57,12 @@ foreach ($ivs as $iv) {
key length=8 key length=8
Warning: mcrypt_encrypt(): Key of length 8 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=20 key length=20
Warning: mcrypt_encrypt(): Key of length 20 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=24 key length=24
@ -70,7 +70,7 @@ string(112) "923eedcb20e18e3efa466a6ca1b842b34e6ac46aa3690ef739d0d68a26eb64e1a6a
key length=26 key length=26
Warning: mcrypt_encrypt(): Key of length 26 not supported by this algorithm in %s on line %d 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) "" string(0) ""
--- testing different iv lengths --- testing different iv lengths

View File

@ -124,39 +124,39 @@ fclose($fp);
*** Testing mcrypt_encrypt() : usage variation *** *** Testing mcrypt_encrypt() : usage variation ***
--int 0-- --int 0--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--int 1-- --int 1--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--int 12345-- --int 12345--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--int -12345-- --int -12345--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float 10.5-- --float 10.5--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float -10.5-- --float -10.5--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float 12.3456789000e10-- --float 12.3456789000e10--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float -12.3456789000e10-- --float -12.3456789000e10--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--float .5-- --float .5--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--empty array-- --empty array--
@ -176,39 +176,39 @@ Error: 2 - mcrypt_encrypt() expects parameter 2 to be string, array given, %s(%d
string(0) "" string(0) ""
--uppercase NULL-- --uppercase NULL--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--lowercase null-- --lowercase null--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--lowercase true-- --lowercase true--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--lowercase false-- --lowercase false--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--uppercase TRUE-- --uppercase TRUE--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--uppercase FALSE-- --uppercase FALSE--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--empty string DQ-- --empty string DQ--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--empty string SQ-- --empty string SQ--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--instance of classWithToString-- --instance of classWithToString--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--instance of classWithoutToString-- --instance of classWithoutToString--
@ -216,11 +216,11 @@ Error: 2 - mcrypt_encrypt() expects parameter 2 to be string, object given, %s(%
string(0) "" string(0) ""
--undefined var-- --undefined var--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--unset var-- --unset var--
Error: 2 - mcrypt_encrypt(): Key of length %d not supported by this algorithm, %s(%d) Error: 2 - mcrypt_encrypt(): Key of size %d not supported by this algorithm. Only keys of size 24 supported, %s(%d)
string(0) "" string(0) ""
--resource-- --resource--

View File

@ -76,32 +76,32 @@ foreach ($ivs as $iv) {
key length=0 key length=0
Warning: mcrypt_encrypt(): Key of length 0 not supported by this algorithm in %s on line %d 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) "" string(0) ""
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Warning: mcrypt_cbc(): Key of length 0 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=0 key length=0
Warning: mcrypt_encrypt(): Key of length 0 not supported by this algorithm in %s on line %d 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) "" string(0) ""
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Warning: mcrypt_cbc(): Key of length 0 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=8 key length=8
Warning: mcrypt_encrypt(): Key of length 8 not supported by this algorithm in %s on line %d 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) "" string(0) ""
Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d Deprecated: Function mcrypt_cbc() is deprecated in %s on line %d
Warning: mcrypt_cbc(): Key of length 8 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=16 key length=16

View File

@ -63,10 +63,10 @@ foreach ($keys as $key) {
key length=20 key length=20
Warning: mcrypt_encrypt(): Key of length 20 not supported by this algorithm in %s on line %d 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) "" string(0) ""
Warning: mcrypt_decrypt(): Key of length 20 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=24 key length=24
@ -75,10 +75,10 @@ string(128) "546869732069732074686520736563726574206d657373616765207768696368206
key length=30 key length=30
Warning: mcrypt_encrypt(): Key of length 30 not supported by this algorithm in %s on line %d 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) "" string(0) ""
Warning: mcrypt_decrypt(): Key of length 30 not supported by this algorithm in %s on line %d 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) "" string(0) ""
key length=32 key length=32
@ -87,9 +87,9 @@ string(128) "546869732069732074686520736563726574206d657373616765207768696368206
key length=40 key length=40
Warning: mcrypt_encrypt(): Key of length 40 not supported by this algorithm in %s on line %d 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) "" string(0) ""
Warning: mcrypt_decrypt(): Key of length 40 not supported by this algorithm in %s on line %d 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) "" string(0) ""
===DONE=== ===DONE===