pajoye Mon, 09 Aug 2010 08:14:14 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=302024
Log: - #52523, fix logic (0 is perfectly valid as part of the data, bin data) Bug: http://bugs.php.net/52523 (Assigned) mcrypt_create_iv not reliable on win: "Could not gather sufficient random data" Changed paths: U php/php-src/branches/PHP_5_3/win32/winutil.c U php/php-src/trunk/win32/winutil.c Modified: php/php-src/branches/PHP_5_3/win32/winutil.c =================================================================== --- php/php-src/branches/PHP_5_3/win32/winutil.c 2010-08-09 07:32:21 UTC (rev 302023) +++ php/php-src/branches/PHP_5_3/win32/winutil.c 2010-08-09 08:14:14 UTC (rev 302024) @@ -70,13 +70,9 @@ ret = CryptGenRandom(hCryptProv, size, buf); CryptReleaseContext(hCryptProv, 0); if (ret) { - while (i < size && buf[i] != 0) { - i++; - } - if (i == size) { - return SUCCESS; - } + return SUCCESS; + } else { + return FAILURE; } - return FAILURE; } /* }}} */ Modified: php/php-src/trunk/win32/winutil.c =================================================================== --- php/php-src/trunk/win32/winutil.c 2010-08-09 07:32:21 UTC (rev 302023) +++ php/php-src/trunk/win32/winutil.c 2010-08-09 08:14:14 UTC (rev 302024) @@ -70,12 +70,7 @@ ret = CryptGenRandom(hCryptProv, size, buf); CryptReleaseContext(hCryptProv, 0); if (ret) { - while (i < size && buf[i] != 0) { - i++; - } - if (i == size) { - return SUCCESS; - } + return SUCCESS; } return FAILURE; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php