diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:02 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:02 -0400 |
commit | 1de335ad3f395ca6861085393ba366a9e3fb4a0d (patch) | |
tree | f1fdd326034e05177596851be6a7127615d81498 /includes/utils/MWCryptRand.php | |
parent | 9c75fa8ff6d4d38ef552c00fef5969fb154765e8 (diff) | |
parent | f6d65e533c62f6deb21342d4901ece24497b433e (diff) |
Merge commit 'f6d65'
# Conflicts:
# skins/ArchLinux/ArchLinux.php
Diffstat (limited to 'includes/utils/MWCryptRand.php')
-rw-r--r-- | includes/utils/MWCryptRand.php | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/includes/utils/MWCryptRand.php b/includes/utils/MWCryptRand.php index b602f78e..e6c0e784 100644 --- a/includes/utils/MWCryptRand.php +++ b/includes/utils/MWCryptRand.php @@ -294,7 +294,6 @@ class MWCryptRand { * @see self::generate() */ public function realGenerate( $bytes, $forceStrong = false ) { - wfProfileIn( __METHOD__ ); wfDebug( __METHOD__ . ": Generating cryptographic random bytes for " . wfGetAllCallers( 5 ) . "\n" ); @@ -314,7 +313,6 @@ class MWCryptRand { // entropy so this is also preferable to just trying to read urandom because it may work // on Windows systems as well. if ( function_exists( 'mcrypt_create_iv' ) ) { - wfProfileIn( __METHOD__ . '-mcrypt' ); $rem = $bytes - strlen( $buffer ); $iv = mcrypt_create_iv( $rem, MCRYPT_DEV_URANDOM ); if ( $iv === false ) { @@ -324,7 +322,6 @@ class MWCryptRand { wfDebug( __METHOD__ . ": mcrypt_create_iv generated " . strlen( $iv ) . " bytes of randomness.\n" ); } - wfProfileOut( __METHOD__ . '-mcrypt' ); } } @@ -337,7 +334,6 @@ class MWCryptRand { if ( function_exists( 'openssl_random_pseudo_bytes' ) && ( !wfIsWindows() || version_compare( PHP_VERSION, '5.3.4', '>=' ) ) ) { - wfProfileIn( __METHOD__ . '-openssl' ); $rem = $bytes - strlen( $buffer ); $openssl_bytes = openssl_random_pseudo_bytes( $rem, $openssl_strong ); if ( $openssl_bytes === false ) { @@ -353,7 +349,6 @@ class MWCryptRand { // using it use it's say on whether the randomness is strong $this->strong = !!$openssl_strong; } - wfProfileOut( __METHOD__ . '-openssl' ); } } @@ -361,7 +356,6 @@ class MWCryptRand { if ( strlen( $buffer ) < $bytes && ( function_exists( 'stream_set_read_buffer' ) || $forceStrong ) ) { - wfProfileIn( __METHOD__ . '-fopen-urandom' ); $rem = $bytes - strlen( $buffer ); if ( !function_exists( 'stream_set_read_buffer' ) && $forceStrong ) { wfDebug( __METHOD__ . ": Was forced to read from /dev/urandom " . @@ -400,7 +394,6 @@ class MWCryptRand { } else { wfDebug( __METHOD__ . ": /dev/urandom could not be opened.\n" ); } - wfProfileOut( __METHOD__ . '-fopen-urandom' ); } // If we cannot use or generate enough data from a secure source @@ -414,12 +407,10 @@ class MWCryptRand { ": Falling back to using a pseudo random state to generate randomness.\n" ); } while ( strlen( $buffer ) < $bytes ) { - wfProfileIn( __METHOD__ . '-fallback' ); $buffer .= $this->hmac( $this->randomState(), mt_rand() ); // This code is never really cryptographically strong, if we use it // at all, then set strong to false. $this->strong = false; - wfProfileOut( __METHOD__ . '-fallback' ); } // Once the buffer has been filled up with enough random data to fulfill @@ -431,8 +422,6 @@ class MWCryptRand { wfDebug( __METHOD__ . ": " . strlen( $buffer ) . " bytes of randomness leftover in the buffer.\n" ); - wfProfileOut( __METHOD__ ); - return $generated; } |