From ed0f0e4a677dcd068c8d42df4699d1896905bb75 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Thu, 5 Apr 2007 01:48:56 +0000 Subject: Fixed bug #40999 (mcrypt_create_iv() not using random seed). --- ext/mcrypt/mcrypt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/mcrypt/mcrypt.c') diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c index c5c8c5f0fc..c83cdae03c 100644 --- a/ext/mcrypt/mcrypt.c +++ b/ext/mcrypt/mcrypt.c @@ -35,6 +35,7 @@ #include "php_ini.h" #include "php_globals.h" #include "ext/standard/info.h" +#include "ext/standard/php_rand.h" static int le_mcrypt; @@ -1274,10 +1275,9 @@ PHP_FUNCTION(mcrypt_create_iv) RETURN_FALSE; } } else { - unsigned int ctx; n = size; while (size) { - iv[--size] = 255.0 * php_rand_r(&ctx) / RAND_MAX; + iv[--size] = 255.0 * php_rand(TSRMLS_C) / RAND_MAX; } } RETURN_STRINGL(iv, n, 0); -- cgit v1.2.1