Doc #71365 [Com]: random_bytes(): missing Error causes; may return PRNG
| From: | public+php dot net at bastelstu dot be | Date: | Sun, 17 Jan 2016 16:01:14 +0000 |
| Subject: | Doc #71365 [Com]: random_bytes(): missing Error causes; may return PRNG | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-13117@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71365&edit=1
ID: 71365
Comment by: public+php dot net at bastelstu dot be
Reported by: salsi at icosaedro dot it
Summary: random_bytes(): missing Error causes; may return
PRNG
Status: Open
Type: Documentation Problem
Package: Documentation problem
PHP Version: 7.0.2
Block user comment: N
Private report: N
New Comment:
http://www.2uo.de/myths-about-urandom/
Previous Comments:
------------------------------------------------------------------------
[2016-01-14 05:37:45] salsi at icosaedro dot it
Description:
------------
---
From manual page: http://www.php.net/function.random-bytes
---
Examining the C source code, appears that the Error exception might be thrown also on failed reading
from the source of randomness, or no enough entropy is available (whenever an estimation of the
available entropy is available).
It might worth to mention also that if not enough entropy data is available, some implementations
(notably when reading from /dev/urandom as a last resort) may return values from a PRNG rather than
from a CSPRNG, so partially defeating the purpose of this function for CS applications.
The same holds for the companion random_int() function, which relies on the same base function as
random_bytes().
Programmers should be advised that abusing of the entropy source may then compromise security, and
those entropy sources should be used sparingly.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71365&edit=1