Revert "Coding convention applied - part 1"

This commit is contained in:
Hypolite Petovan 2017-03-21 12:02:59 -04:00 committed by GitHub
parent 9c2c483996
commit 7b352f3f74
181 changed files with 3507 additions and 4338 deletions

View file

@ -12,7 +12,7 @@ function rsa_sign($data,$key,$alg = 'sha256') {
openssl_sign($data,$sig,$key,(($alg == 'sha1') ? OPENSSL_ALGO_SHA1 : $alg));
}
else {
if (strlen($key) < 1024 || extension_loaded('gmp')) {
if(strlen($key) < 1024 || extension_loaded('gmp')) {
require_once('library/phpsec/Crypt/RSA.php');
$rsa = new CRYPT_RSA();
$rsa->signatureMode = CRYPT_RSA_SIGNATURE_PKCS1;
@ -34,7 +34,7 @@ function rsa_verify($data,$sig,$key,$alg = 'sha256') {
$verify = openssl_verify($data,$sig,$key,(($alg == 'sha1') ? OPENSSL_ALGO_SHA1 : $alg));
}
else {
if (strlen($key) <= 300 || extension_loaded('gmp')) {
if(strlen($key) <= 300 || extension_loaded('gmp')) {
require_once('library/phpsec/Crypt/RSA.php');
$rsa = new CRYPT_RSA();
$rsa->signatureMode = CRYPT_RSA_SIGNATURE_PKCS1;
@ -186,12 +186,12 @@ function salmon_key($pubkey) {
if (! function_exists('aes_decrypt')) {
if(! function_exists('aes_decrypt')) {
// DEPRECATED IN 3.4.1
function aes_decrypt($val,$ky)
{
$key="\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
for ($a=0;$a<strlen($ky);$a++)
for($a=0;$a<strlen($ky);$a++)
$key[$a%16]=chr(ord($key[$a%16]) ^ ord($ky[$a]));
$mode = MCRYPT_MODE_ECB;
$enc = MCRYPT_RIJNDAEL_128;
@ -200,12 +200,12 @@ function aes_decrypt($val,$ky)
}}
if (! function_exists('aes_encrypt')) {
if(! function_exists('aes_encrypt')) {
// DEPRECATED IN 3.4.1
function aes_encrypt($val,$ky)
{
$key="\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
for ($a=0;$a<strlen($ky);$a++)
for($a=0;$a<strlen($ky);$a++)
$key[$a%16]=chr(ord($key[$a%16]) ^ ord($ky[$a]));
$mode=MCRYPT_MODE_ECB;
$enc=MCRYPT_RIJNDAEL_128;
@ -237,12 +237,12 @@ function new_keypair($bits) {
);
$conf = get_config('system','openssl_conf_file');
if ($conf)
if($conf)
$openssl_options['config'] = $conf;
$result = openssl_pkey_new($openssl_options);
if (empty($result)) {
if(empty($result)) {
logger('new_keypair: failed');
return false;
}