svn: /phpdoc/en/trunk/ language-snippets.ent reference/math/functions/mt-rand.xml reference/math/functions/rand.xml
| From: | Adam Harvey | Date: | Thu, 06 Dec 2012 05:41:36 +0000 |
| Subject: | svn: /phpdoc/en/trunk/ language-snippets.ent reference/math/functions/mt-rand.xml reference/math/functions/rand.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-10840@lists.php.net to get a copy of this message | ||
aharvey Thu, 06 Dec 2012 05:41:36 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=328689
Log:
Add cautions about rand() and mt_rand() being cryptographically insecure.
Further reading (and the blog that prompted this):
https://spideroak.com/blog/20121205114003-exploit-information-leaks-in-random-numbers-from-python-ruby-and-php
This may at least partially fix bug #62966, but since that's still private and
I only know about it via a separate bug in the bug tracker, I can't be sure.
Bug: https://bugs.php.net/62966 (error getting bug
information)
Changed paths:
U phpdoc/en/trunk/language-snippets.ent
U phpdoc/en/trunk/reference/math/functions/mt-rand.xml
U phpdoc/en/trunk/reference/math/functions/rand.xml
Modified: phpdoc/en/trunk/language-snippets.ent
===================================================================
--- phpdoc/en/trunk/language-snippets.ent 2012-12-05 22:51:33 UTC (rev 328688)
+++ phpdoc/en/trunk/language-snippets.ent 2012-12-06 05:41:36 UTC (rev 328689)
@@ -7,6 +7,9 @@
<!ENTITY installation.enabled.disable 'This extension is enabled by default. It may be
disabled by using the following option at compile time: '>
+<!-- Cautions -->
+<!ENTITY caution.cryptographically-insecure '<caution xmlns="http://docbook.org/ns/docbook"><para>This
function does not generate cryptographically secure values, and should not be used for cryptographic
purposes. If you need a cryptographically secure value, consider using
<function>openssl_random_pseudo_bytes</function>
instead.</para></caution>'>
+
<!-- Notes -->
<!ENTITY note.regex.deprecated '<note xmlns="http://docbook.org/ns/docbook"><para>As
of PHP 5.3.0, the
Modified: phpdoc/en/trunk/reference/math/functions/mt-rand.xml
===================================================================
--- phpdoc/en/trunk/reference/math/functions/mt-rand.xml 2012-12-05 22:51:33 UTC (rev 328688)
+++ phpdoc/en/trunk/reference/math/functions/mt-rand.xml 2012-12-06 05:41:36 UTC (rev 328689)
@@ -119,6 +119,7 @@
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
+ &caution.cryptographically-insecure;
<caution>
<para>
The distribution of <function>mt_rand</function> return values is biased
@@ -133,6 +134,7 @@
<simplelist>
<member><function>mt_srand</function></member>
<member><function>mt_getrandmax</function></member>
+ <member><function>openssl_random_pseudo_bytes</function></member>
<member><function>rand</function></member>
</simplelist>
</para>
Modified: phpdoc/en/trunk/reference/math/functions/rand.xml
===================================================================
--- phpdoc/en/trunk/reference/math/functions/rand.xml 2012-12-05 22:51:33 UTC (rev 328688)
+++ phpdoc/en/trunk/reference/math/functions/rand.xml 2012-12-06 05:41:36 UTC (rev 328689)
@@ -108,6 +108,10 @@
</example>
</para>
</refsect1>
+ <refsect1 role="notes">
+ &reftitle.notes;
+ &caution.cryptographically-insecure;
+ </refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
@@ -115,6 +119,7 @@
<member><function>srand</function></member>
<member><function>getrandmax</function></member>
<member><function>mt_rand</function></member>
+ <member><function>openssl_random_pseudo_bytes</function></member>
</simplelist>
</para>
</refsect1>