summaryrefslogtreecommitdiff
path: root/ext/mcrypt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mcrypt')
-rw-r--r--ext/mcrypt/mcrypt.c6
-rw-r--r--ext/mcrypt/tests/bug55169.phpt43
2 files changed, 46 insertions, 3 deletions
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c
index b0e27a86a..7e8ef0df9 100644
--- a/ext/mcrypt/mcrypt.c
+++ b/ext/mcrypt/mcrypt.c
@@ -16,7 +16,7 @@
| Derick Rethans <derick@derickrethans.nl> |
+----------------------------------------------------------------------+
*/
-/* $Id: mcrypt.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: mcrypt.c 313665 2011-07-25 11:42:53Z felipe $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -280,7 +280,7 @@ const zend_function_entry mcrypt_functions[] = { /* {{{ */
PHP_FE(mcrypt_module_get_supported_key_sizes, arginfo_mcrypt_module_get_supported_key_sizes)
PHP_FE(mcrypt_module_close, arginfo_mcrypt_module_close)
- {NULL, NULL, NULL}
+ PHP_FE_END
};
/* }}} */
@@ -1394,7 +1394,7 @@ PHP_FUNCTION(mcrypt_create_iv)
BYTE *iv_b = (BYTE *) iv;
if (php_win32_get_random_bytes(iv_b, (size_t) size) == FAILURE){
efree(iv);
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not gather sufficient random data");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not gather sufficient random data");
RETURN_FALSE;
}
n = size;
diff --git a/ext/mcrypt/tests/bug55169.phpt b/ext/mcrypt/tests/bug55169.phpt
new file mode 100644
index 000000000..7bddd5087
--- /dev/null
+++ b/ext/mcrypt/tests/bug55169.phpt
@@ -0,0 +1,43 @@
+--TEST--
+mcrypt_create_iv
+https://bugs.php.net/bug.php?id=55169
+--CREDIT--
+Ryan Biesemeyer <ryan@yaauie.com>
+--FILE--
+<?php
+for( $i=1; $i<=64; $i = $i*2 ){
+ echo 'Input: '. $i . PHP_EOL;
+ $random = mcrypt_create_iv( $i, MCRYPT_DEV_URANDOM );
+ echo ' Length: ' . strlen( $random ) . PHP_EOL;
+ echo ' Hex: '. bin2hex( $random ) . PHP_EOL;
+ echo PHP_EOL;
+}
+?>
+--EXPECTF--
+Input: 1
+ Length: 1
+ Hex: %x
+
+Input: 2
+ Length: 2
+ Hex: %x
+
+Input: 4
+ Length: 4
+ Hex: %x
+
+Input: 8
+ Length: 8
+ Hex: %x
+
+Input: 16
+ Length: 16
+ Hex: %x
+
+Input: 32
+ Length: 32
+ Hex: %x
+
+Input: 64
+ Length: 64
+ Hex: %x