use MCRYPT_DEV_URANDOM to generate key+iv
This commit is contained in:
parent
9fc8b5a146
commit
84e2fe49f2
|
@ -88,14 +88,12 @@ function display_LoginPage($config_object) {
|
||||||
// generate 256 bit key and initialization vector for user/passwd-encryption
|
// generate 256 bit key and initialization vector for user/passwd-encryption
|
||||||
// check if we can use /dev/random otherwise use /dev/urandom or rand()
|
// check if we can use /dev/random otherwise use /dev/urandom or rand()
|
||||||
if(function_exists('mcrypt_create_iv')) {
|
if(function_exists('mcrypt_create_iv')) {
|
||||||
$key = @mcrypt_create_iv(32, MCRYPT_DEV_RANDOM);
|
$key = @mcrypt_create_iv(32, MCRYPT_DEV_URANDOM);
|
||||||
if (! $key) $key = @mcrypt_create_iv(32, MCRYPT_DEV_URANDOM);
|
|
||||||
if (! $key) {
|
if (! $key) {
|
||||||
srand((double)microtime()*1234567);
|
srand((double)microtime()*1234567);
|
||||||
$key = mcrypt_create_iv(32, MCRYPT_RAND);
|
$key = mcrypt_create_iv(32, MCRYPT_RAND);
|
||||||
}
|
}
|
||||||
$iv = @mcrypt_create_iv(32, MCRYPT_DEV_RANDOM);
|
$iv = @mcrypt_create_iv(32, MCRYPT_DEV_URANDOM);
|
||||||
if (! $iv) $iv = @mcrypt_create_iv(32, MCRYPT_DEV_URANDOM);
|
|
||||||
if (! $iv) {
|
if (! $iv) {
|
||||||
srand((double)microtime()*1234567);
|
srand((double)microtime()*1234567);
|
||||||
$iv = mcrypt_create_iv(32, MCRYPT_RAND);
|
$iv = mcrypt_create_iv(32, MCRYPT_RAND);
|
||||||
|
|
Loading…
Reference in New Issue