Reduce conditional for calling openssl_random_pseudo_bytes
authorReedy <reedy@wikimedia.org>
Wed, 10 Feb 2016 21:27:24 +0000 (21:27 +0000)
committerReedy <reedy@wikimedia.org>
Wed, 10 Feb 2016 21:27:24 +0000 (21:27 +0000)
We require a much higher PHP version now, so this isn't a problem
for windows or otherwise

Change-Id: I65511f00b50d12992d8883d5482867f5e0a850bc

includes/utils/MWCryptRand.php

index 10606c1..c5112ff 100644 (file)
@@ -250,14 +250,7 @@ class MWCryptRand {
                }
 
                if ( strlen( $buffer ) < $bytes ) {
-                       // If available make use of openssl's random_pseudo_bytes method to
-                       // attempt to generate randomness. However don't do this on Windows
-                       // with PHP < 5.3.4 due to a bug:
-                       // http://stackoverflow.com/questions/1940168/openssl-random-pseudo-bytes-is-slow-php
-                       // http://git.php.net/?p=php-src.git;a=commitdiff;h=cd62a70863c261b07f6dadedad9464f7e213cad5
-                       if ( function_exists( 'openssl_random_pseudo_bytes' )
-                               && ( !wfIsWindows() || version_compare( PHP_VERSION, '5.3.4', '>=' ) )
-                       ) {
+                       if ( function_exists( 'openssl_random_pseudo_bytes' ) ) {
                                $rem = $bytes - strlen( $buffer );
                                $openssl_bytes = openssl_random_pseudo_bytes( $rem, $openssl_strong );
                                if ( $openssl_bytes === false ) {