Page MenuHomePhabricator

mcrypt_rand_iv() not reliable with MCRYPT_DEV_URANDOM on Windows
Closed, ResolvedPublic

Description

Upstream bug is https://bugs.php.net/bug.php?id=52523 but I experienced this today with PHP 5.3.5 on a host where phpinfo reports the system is "Windows NT A1-WHW-B69 6.0 build 6002 (Windows Server 2008 Web Server Edition Service Pack 2) i586"

Webserver died with a fatal error during installation:

PHP Fatal error:  mcrypt_create_iv() [<a
href='function.mcrypt-create-iv'>function.mcrypt-create-iv</a>]:
Could not gather sufficient random data in
E:\...\Web\includes\CryptRand.php on line 309

As far as I could tell, There was no way to work around this or even see if the error would pop up in the code, so I had to hack CryptRand.php so that MCRYPT_RAND was used instead of MCRYPT_DEV_URANDOM.

Only then could installation complete.


Version: 1.20.x
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=35894

Details

Reference
bz44142

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:27 AM
bzimport set Reference to bz44142.
bzimport added a subscriber: Unknown Object (MLST).
  • Bug 55364 has been marked as a duplicate of this bug. ***
  • This bug has been marked as a duplicate of bug 35894 ***

(In reply to comment #0)

As far as I could tell, There was no way to work around this or even see if
the
error would pop up in the code, so I had to hack CryptRand.php so that
MCRYPT_RAND was used instead of MCRYPT_DEV_URANDOM.

Only then could installation complete.

This is not a good way to work around this issue, I've explained in detail here:
https://bugzilla.wikimedia.org/show_bug.cgi?id=55364#c4