Edit report at https://bugs.php.net/bug.php?id=55169&edit=1

 ID:                 55169
 Updated by:         ni...@php.net
 Reported by:        ni...@php.net
 Summary:            mcrypt_create_iv always fails to gather sufficient
                     random data
 Status:             Feedback
 Type:               Bug
 Package:            mcrypt related
 Operating System:   Windows 7
 PHP Version:        5.4SVN-2011-07-09 (snap)
 Block user comment: N
 Private report:     N

 New Comment:

I just tried snaps for 312169 and 312203. The former still worked, but the 
latter was already broken:

D:\htdocs\stack>C:\php312169\php.exe -f quick.php
string(1) "ð"

D:\htdocs\stack>C:\php312203\php.exe -f quick.php

Fatal error: mcrypt_create_iv(): Could not gather sufficient random data in D:\h
tdocs\stack\quick.php on line 3


Previous Comments:
------------------------------------------------------------------------
[2011-07-10 10:37:24] paj...@php.net

I apply a fix to all branches (5.3 was possibly affected as well). Please try a 
snapshot with the revision id equal or higher to the commit referred here.

------------------------------------------------------------------------
[2011-07-10 10:36:31] paj...@php.net

Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revision&revision=313110
Log: - fix bug #55169, mcrypt_create_iv always fails to gather sufficient 
random data

------------------------------------------------------------------------
[2011-07-09 16:26:20] ni...@php.net

Some further notes:

The code always fails, not just sometimes.
It fails regardless of the specified size.
It worked on PHP 5.3.1 (haven't tested later versions).

------------------------------------------------------------------------
[2011-07-09 16:23:21] ni...@php.net

Description:
------------
When using the 5.4 snaps calling mcrypt_create_iv with either MCRYPT_DEV_RANDOM 
or MCRYPT_DEV_URANDOM as source always fails to gather sufficient random data 
regardless of the specified size.

(Could be related: http://svn.php.net/viewvc?view=revision&revision=312201 )

Test script:
---------------
<?php var_dump(mcrypt_create_iv(1, MCRYPT_DEV_URANDOM));

Expected result:
----------------
string 'm' (length=1)
[or similar]

Actual result:
--------------
Fatal error: mcrypt_create_iv() [<a 
href='function.mcrypt-create-iv'>function.mcrypt-create-iv</a>]: Could not 
gather sufficient random data in D:\htdocs\stack\quick.php on line 3


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55169&edit=1

Reply via email to