use MCRYPT_DEV_URANDOM to generate key+iv

This commit is contained in:
Roland Gruber 2005-11-18 10:41:08 +00:00
parent 9fc8b5a146
commit 84e2fe49f2
1 changed files with 2 additions and 4 deletions

View File

@ -88,14 +88,12 @@ function display_LoginPage($config_object) {
// generate 256 bit key and initialization vector for user/passwd-encryption
// check if we can use /dev/random otherwise use /dev/urandom or rand()
if(function_exists('mcrypt_create_iv')) {
$key = @mcrypt_create_iv(32, MCRYPT_DEV_RANDOM);
if (! $key) $key = @mcrypt_create_iv(32, MCRYPT_DEV_URANDOM);
$key = @mcrypt_create_iv(32, MCRYPT_DEV_URANDOM);
if (! $key) {
srand((double)microtime()*1234567);
$key = mcrypt_create_iv(32, MCRYPT_RAND);
}
$iv = @mcrypt_create_iv(32, MCRYPT_DEV_RANDOM);
if (! $iv) $iv = @mcrypt_create_iv(32, MCRYPT_DEV_URANDOM);
$iv = @mcrypt_create_iv(32, MCRYPT_DEV_URANDOM);
if (! $iv) {
srand((double)microtime()*1234567);
$iv = mcrypt_create_iv(32, MCRYPT_RAND);