Skip to content

Commit

Permalink
Merge pull request iNextrix#688 from sdwru/php74_fix
Browse files Browse the repository at this point in the history
fix for PHP v7.4
  • Loading branch information
devangn authored Jun 1, 2023
2 parents 3b02970 + 325f274 commit 955821b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion misc/password_change.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function decode_params($string) {
function password_encrypt($value){
global $private_key;
$ivSize = openssl_cipher_iv_length('BF-ECB');
$iv = openssl_random_pseudo_bytes($ivSize);
$iv = ($ivSize > 0) ? openssl_random_pseudo_bytes($ivSize) : false;

$encrypted = openssl_encrypt($value, 'BF-ECB', $private_key, OPENSSL_RAW_DATA, $iv);

Expand Down
2 changes: 1 addition & 1 deletion web_interface/astpp/application/libraries/astpp/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -2061,7 +2061,7 @@ function encode_params($string) {

function encode($value) {
$ivSize = openssl_cipher_iv_length('BF-ECB');
$iv = openssl_random_pseudo_bytes($ivSize);
$iv = ($ivSize > 0) ? openssl_random_pseudo_bytes($ivSize) : false;
$encrypted = openssl_encrypt($value, 'BF-ECB', $this->CI->config->item ( 'private_key' ), OPENSSL_RAW_DATA, $iv);
$encrypted = $this->encode_params($encrypted);
return $encrypted;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ function encode_params($string)
function encode($value)
{
$ivSize = openssl_cipher_iv_length('BF-ECB');
$iv = openssl_random_pseudo_bytes($ivSize);
$iv = ($ivSize > 0) ? openssl_random_pseudo_bytes($ivSize) : false;
$encrypted = openssl_encrypt($value, 'BF-ECB', $this->config->item('private_key'), OPENSSL_RAW_DATA, $iv);
$encrypted = $this->encode_params($encrypted);
return $encrypted;
Expand Down

0 comments on commit 955821b

Please sign in to comment.