Bug #52523 [NEW]: mcrypt_create_iv not reliable on win: "Could not gather sufficient random data"

From: Date: Tue, 03 Aug 2010 11:37:47 +0000
Subject: Bug #52523 [NEW]: mcrypt_create_iv not reliable on win: "Could not gather sufficient random data"
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-153051@lists.php.net to get a copy of this message
From:             
Operating system: Windows XP
PHP version:      5.3.3
Package:          mcrypt related
Bug Type:         Bug
Bug description:mcrypt_create_iv not reliable on win: "Could not gather sufficient random
data"

Description:
------------
mcrypt_create_iv (or likely rather the underlying function
php_win32_get_random_bytes) is not reliable on Windows with
MCRYPT_DEV_RANDOM/MCRYPT_DEV_URANDOM.

Since 5.3.0 MCRYPT_DEV_RANDOM and MCRYPT_DEV_URANDOM became available on
Windows platforms. (http://php.net/mcrypt_create_iv)

MCRYPT_RAND will still works, as with PHP prior to 5.3.0.

Test script:
---------------
The following code should loop forever, but does not do so on Windows (XP
and Windows 7):

  php -r "$i=0; while( mcrypt_create_iv(16) !== false ) {echo
($i++).'.';};"


Expected result:
----------------
Infinite loop.

Actual result:
--------------
0.1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.
Fatal error: mcrypt_create_iv(): Could not gather sufficient random data in
Command line code on line 1


-- 
Edit bug report at http://bugs.php.net/bug.php?id=52523&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=52523&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=52523&r=trysnapshot53
Try a snapshot (trunk):              http://bugs.php.net/fix.php?id=52523&r=trysnapshottrunk
Fixed in SVN:                        http://bugs.php.net/fix.php?id=52523&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52523&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=52523&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=52523&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=52523&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=52523&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=52523&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=52523&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=52523&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=52523&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=52523&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52523&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52523&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=52523&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=52523&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=52523&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=52523&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=52523&r=mysqlcfg



Thread (13 messages)

« previous php.bugs (#153051) next »