summaryrefslogtreecommitdiff
path: root/includes/utils/MWCryptRand.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/utils/MWCryptRand.php')
-rw-r--r--includes/utils/MWCryptRand.php11
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;
}