Doc #71365 [NEW]: random_bytes(): missing Error causes; may return PRNG
| From: | salsi at icosaedro dot it | Date: | Thu, 14 Jan 2016 05:37:51 +0000 |
| Subject: | Doc #71365 [NEW]: random_bytes(): missing Error causes; may return PRNG | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-13099@lists.php.net to get a copy of this message | ||
From: salsi at icosaedro dot it
Operating system:
PHP version: 7.0.2
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:random_bytes(): missing Error causes; may return PRNG
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 bug report at https://bugs.php.net/bug.php?id=71365&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71365&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71365&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71365&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71365&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71365&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71365&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71365&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71365&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71365&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71365&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71365&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71365&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71365&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71365&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71365&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71365&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71365&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71365&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71365&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71365&r=mysqlcfg