Issue 3142: mcrypt is no more (as well as phpseclib)

This commit is contained in:
Michael 2017-04-01 08:28:42 +00:00
parent d301a363b0
commit f6d7ee2781
36 changed files with 85 additions and 16555 deletions

View file

@ -342,9 +342,9 @@ final class Crypto
*/
private static function SecureRandom($octets)
{
self::EnsureFunctionExists("mcrypt_create_iv");
$random = mcrypt_create_iv($octets, MCRYPT_DEV_URANDOM);
if ($random === FALSE) {
self::EnsureFunctionExists("openssl_random_pseudo_bytes");
$random = openssl_random_pseudo_bytes($octets, $crypto_strong);
if ($crypto_strong === FALSE) {
throw new CannotPerformOperationException();
} else {
return $random;