Skip to content

Commit

Permalink
Silenced rest of mcrypt calls
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed May 22, 2017
1 parent 9c20782 commit ee5e224
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions framework/base/CSecurityManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,12 @@ public function decrypt($data,$key=null)
$key=$this->getEncryptionKey();
$this->validateEncryptionKey($key);
$module=$this->openCryptModule();
$ivSize=mcrypt_enc_get_iv_size($module);
$ivSize=@mcrypt_enc_get_iv_size($module);
$iv=$this->substr($data,0,$ivSize);
mcrypt_generic_init($module,$key,$iv);
$decrypted=mdecrypt_generic($module,$this->substr($data,$ivSize,$this->strlen($data)));
mcrypt_generic_deinit($module);
mcrypt_module_close($module);
@mcrypt_generic_init($module,$key,$iv);
$decrypted=@mdecrypt_generic($module,$this->substr($data,$ivSize,$this->strlen($data)));
@mcrypt_generic_deinit($module);
@mcrypt_module_close($module);
return rtrim($decrypted,"\0");
}

Expand Down Expand Up @@ -399,7 +399,7 @@ public function generateRandomBytes($length,$cryptographicallyStrong=true)
}

if(function_exists('mcrypt_create_iv') &&
($bytes=mcrypt_create_iv($length, MCRYPT_DEV_URANDOM))!==false &&
($bytes=@mcrypt_create_iv($length, MCRYPT_DEV_URANDOM))!==false &&
$this->strlen($bytes)>=$length)
{
return $this->substr($bytes,0,$length);
Expand Down Expand Up @@ -587,10 +587,10 @@ public function legacyDecrypt($data,$key=null,$cipher='des')
throw new CException(Yii::t('yii','CSecurityManager requires PHP mcrypt extension to be loaded in order to use data encryption feature.'));

$derivedKey=$this->substr($key,0,@mcrypt_enc_get_key_size($module));
$ivSize=mcrypt_enc_get_iv_size($module);
$ivSize=@mcrypt_enc_get_iv_size($module);
$iv=$this->substr($data,0,$ivSize);
@mcrypt_generic_init($module,$derivedKey,$iv);
$decrypted=mdecrypt_generic($module,$this->substr($data,$ivSize,$this->strlen($data)));
$decrypted=@mdecrypt_generic($module,$this->substr($data,$ivSize,$this->strlen($data)));
@mcrypt_generic_deinit($module);
@mcrypt_module_close($module);
return rtrim($decrypted,"\0");
Expand Down

0 comments on commit ee5e224

Please sign in to comment.