mirror of
https://github.com/danog/phpseclib.git
synced 2024-12-02 17:52:59 +01:00
Random: suppress E_DEPRECATED errors
This commit is contained in:
parent
9bccc01b97
commit
228b60cfe5
@ -70,7 +70,7 @@ if (!function_exists('crypt_random_string')) {
|
|||||||
if (CRYPT_RANDOM_IS_WINDOWS) {
|
if (CRYPT_RANDOM_IS_WINDOWS) {
|
||||||
// method 1. prior to PHP 5.3, mcrypt_create_iv() would call rand() on windows
|
// method 1. prior to PHP 5.3, mcrypt_create_iv() would call rand() on windows
|
||||||
if (extension_loaded('mcrypt') && version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
if (extension_loaded('mcrypt') && version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
||||||
return mcrypt_create_iv($length);
|
return @mcrypt_create_iv($length);
|
||||||
}
|
}
|
||||||
// method 2. openssl_random_pseudo_bytes was introduced in PHP 5.3.0 but prior to PHP 5.3.4 there was,
|
// method 2. openssl_random_pseudo_bytes was introduced in PHP 5.3.0 but prior to PHP 5.3.4 there was,
|
||||||
// to quote <http://php.net/ChangeLog-5.php#5.3.4>, "possible blocking behavior". as of 5.3.4
|
// to quote <http://php.net/ChangeLog-5.php#5.3.4>, "possible blocking behavior". as of 5.3.4
|
||||||
@ -109,7 +109,7 @@ if (!function_exists('crypt_random_string')) {
|
|||||||
// not doing. regardless, this'll only be called if this PHP script couldn't open /dev/urandom due to open_basedir
|
// not doing. regardless, this'll only be called if this PHP script couldn't open /dev/urandom due to open_basedir
|
||||||
// restrictions or some such
|
// restrictions or some such
|
||||||
if (extension_loaded('mcrypt')) {
|
if (extension_loaded('mcrypt')) {
|
||||||
return mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
|
return @mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// at this point we have no choice but to use a pure-PHP CSPRNG
|
// at this point we have no choice but to use a pure-PHP CSPRNG
|
||||||
|
Loading…
Reference in New Issue
Block a user