mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-05 21:17:53 +00:00
Merge branch '2.0'
* 2.0: Fixed another case Minor tweaks Fixed error More fixes PHPDoc fixes
This commit is contained in:
commit
3342eb6d09
@ -914,7 +914,7 @@ abstract class Base
|
||||
if ($this->continuousBuffer) {
|
||||
$this->encryptIV = $xor;
|
||||
if ($start = strlen($plaintext) % $block_size) {
|
||||
$buffer['xor'] = substr($key, $start) . $buffer['xor'];
|
||||
$buffer['xor'] = substr($key, $start) . $buffer['xor'];
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1204,7 +1204,7 @@ abstract class Base
|
||||
if ($this->continuousBuffer) {
|
||||
$this->decryptIV = $xor;
|
||||
if ($start = strlen($ciphertext) % $block_size) {
|
||||
$buffer['xor'] = substr($key, $start) . $buffer['xor'];
|
||||
$buffer['xor'] = substr($key, $start) . $buffer['xor'];
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1748,7 +1748,6 @@ abstract class Base
|
||||
if ($this->mode == self::MODE_CFB) {
|
||||
$this->ecb = mcrypt_module_open($this->cipher_name_mcrypt, '', MCRYPT_MODE_ECB, '');
|
||||
}
|
||||
|
||||
} // else should mcrypt_generic_deinit be called?
|
||||
|
||||
if ($this->mode == self::MODE_CFB) {
|
||||
|
@ -94,7 +94,7 @@ class Blowfish extends Base
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
var $sbox0 = array (
|
||||
var $sbox0 = array(
|
||||
0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99,
|
||||
0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e,
|
||||
0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee, 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013,
|
||||
@ -473,7 +473,7 @@ class Blowfish extends Base
|
||||
// We create max. 10 hi-optimized code for memory reason. Means: For each $key one ultra fast inline-crypt function.
|
||||
// (Currently, for Crypt_Blowfish, one generated $lambda_function cost on php5.5@32bit ~100kb unfreeable mem and ~180kb on php5.5@64bit)
|
||||
// After that, we'll still create very fast optimized code but not the hi-ultimative code, for each $mode one.
|
||||
$gen_hi_opt_code = (bool)( count($lambda_functions) < 10 );
|
||||
$gen_hi_opt_code = (bool)(count($lambda_functions) < 10);
|
||||
|
||||
// Generation of a unique hash for our generated code
|
||||
$code_hash = "Crypt_Blowfish, {$this->mode}";
|
||||
|
@ -538,7 +538,7 @@ class RC2 extends Base
|
||||
// for the mixing rounds, for better inline crypt performance [~20% faster].
|
||||
// But for memory reason we have to limit those ultra-optimized $lambda_functions to an amount of 10.
|
||||
// (Currently, for Crypt_RC2, one generated $lambda_function cost on php5.5@32bit ~60kb unfreeable mem and ~100kb on php5.5@64bit)
|
||||
$gen_hi_opt_code = (bool)( count($lambda_functions) < 10 );
|
||||
$gen_hi_opt_code = (bool)(count($lambda_functions) < 10);
|
||||
|
||||
// Generation of a uniqe hash for our generated code
|
||||
$code_hash = "Crypt_RC2, {$this->mode}";
|
||||
|
@ -1573,7 +1573,6 @@ class RSA
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$components = $this->_parseKey($key, $type);
|
||||
}
|
||||
@ -1788,7 +1787,6 @@ class RSA
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -679,7 +679,7 @@ class Rijndael extends Base
|
||||
{
|
||||
static $sbox;
|
||||
if (empty($sbox)) {
|
||||
list(,,,, $sbox) = $this->_getTables();
|
||||
list(, , , , $sbox) = $this->_getTables();
|
||||
}
|
||||
|
||||
return $sbox[$word & 0x000000FF] |
|
||||
@ -878,7 +878,7 @@ class Rijndael extends Base
|
||||
// We create max. 10 hi-optimized code for memory reason. Means: For each $key one ultra fast inline-crypt function.
|
||||
// (Currently, for Crypt_Rijndael/AES, one generated $lambda_function cost on php5.5@32bit ~80kb unfreeable mem and ~130kb on php5.5@64bit)
|
||||
// After that, we'll still create very fast optimized code but not the hi-ultimative code, for each $mode one.
|
||||
$gen_hi_opt_code = (bool)( count($lambda_functions) < 10 );
|
||||
$gen_hi_opt_code = (bool)(count($lambda_functions) < 10);
|
||||
|
||||
// Generation of a uniqe hash for our generated code
|
||||
$code_hash = "Crypt_Rijndael, {$this->mode}, {$this->Nr}, {$this->Nb}";
|
||||
|
@ -73,7 +73,7 @@ class Twofish extends Base
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $q0 = array (
|
||||
var $q0 = array(
|
||||
0xA9, 0x67, 0xB3, 0xE8, 0x04, 0xFD, 0xA3, 0x76,
|
||||
0x9A, 0x92, 0x80, 0x78, 0xE4, 0xDD, 0xD1, 0x38,
|
||||
0x0D, 0xC6, 0x35, 0x98, 0x18, 0xF7, 0xEC, 0x6C,
|
||||
@ -114,7 +114,7 @@ class Twofish extends Base
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $q1 = array (
|
||||
var $q1 = array(
|
||||
0x75, 0xF3, 0xC6, 0xF4, 0xDB, 0x7B, 0xFB, 0xC8,
|
||||
0x4A, 0xD3, 0xE6, 0x6B, 0x45, 0x7D, 0xE8, 0x4B,
|
||||
0xD6, 0x32, 0xD8, 0xFD, 0x37, 0x71, 0xF1, 0xE1,
|
||||
@ -155,7 +155,7 @@ class Twofish extends Base
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $m0 = array (
|
||||
var $m0 = array(
|
||||
0xBCBC3275, 0xECEC21F3, 0x202043C6, 0xB3B3C9F4, 0xDADA03DB, 0x02028B7B, 0xE2E22BFB, 0x9E9EFAC8,
|
||||
0xC9C9EC4A, 0xD4D409D3, 0x18186BE6, 0x1E1E9F6B, 0x98980E45, 0xB2B2387D, 0xA6A6D2E8, 0x2626B74B,
|
||||
0x3C3C57D6, 0x93938A32, 0x8282EED8, 0x525298FD, 0x7B7BD437, 0xBBBB3771, 0x5B5B97F1, 0x474783E1,
|
||||
@ -196,7 +196,7 @@ class Twofish extends Base
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $m1 = array (
|
||||
var $m1 = array(
|
||||
0xA9D93939, 0x67901717, 0xB3719C9C, 0xE8D2A6A6, 0x04050707, 0xFD985252, 0xA3658080, 0x76DFE4E4,
|
||||
0x9A084545, 0x92024B4B, 0x80A0E0E0, 0x78665A5A, 0xE4DDAFAF, 0xDDB06A6A, 0xD1BF6363, 0x38362A2A,
|
||||
0x0D54E6E6, 0xC6432020, 0x3562CCCC, 0x98BEF2F2, 0x181E1212, 0xF724EBEB, 0xECD7A1A1, 0x6C774141,
|
||||
@ -237,7 +237,7 @@ class Twofish extends Base
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $m2 = array (
|
||||
var $m2 = array(
|
||||
0xBC75BC32, 0xECF3EC21, 0x20C62043, 0xB3F4B3C9, 0xDADBDA03, 0x027B028B, 0xE2FBE22B, 0x9EC89EFA,
|
||||
0xC94AC9EC, 0xD4D3D409, 0x18E6186B, 0x1E6B1E9F, 0x9845980E, 0xB27DB238, 0xA6E8A6D2, 0x264B26B7,
|
||||
0x3CD63C57, 0x9332938A, 0x82D882EE, 0x52FD5298, 0x7B377BD4, 0xBB71BB37, 0x5BF15B97, 0x47E14783,
|
||||
@ -278,7 +278,7 @@ class Twofish extends Base
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $m3 = array (
|
||||
var $m3 = array(
|
||||
0xD939A9D9, 0x90176790, 0x719CB371, 0xD2A6E8D2, 0x05070405, 0x9852FD98, 0x6580A365, 0xDFE476DF,
|
||||
0x08459A08, 0x024B9202, 0xA0E080A0, 0x665A7866, 0xDDAFE4DD, 0xB06ADDB0, 0xBF63D1BF, 0x362A3836,
|
||||
0x54E60D54, 0x4320C643, 0x62CC3562, 0xBEF298BE, 0x1E12181E, 0x24EBF724, 0xD7A1ECD7, 0x77416C77,
|
||||
@ -421,9 +421,9 @@ class Twofish extends Base
|
||||
|
||||
switch (strlen($this->key)) {
|
||||
case 16:
|
||||
list ($s7, $s6, $s5, $s4) = $this->_mdsrem($le_longs[1], $le_longs[2]);
|
||||
list ($s3, $s2, $s1, $s0) = $this->_mdsrem($le_longs[3], $le_longs[4]);
|
||||
for ($i = 0, $j = 1; $i < 40; $i+= 2,$j+= 2) {
|
||||
list($s7, $s6, $s5, $s4) = $this->_mdsrem($le_longs[1], $le_longs[2]);
|
||||
list($s3, $s2, $s1, $s0) = $this->_mdsrem($le_longs[3], $le_longs[4]);
|
||||
for ($i = 0, $j = 1; $i < 40; $i+= 2, $j+= 2) {
|
||||
$A = $m0[$q0[$q0[$i] ^ $key[ 9]] ^ $key[1]] ^
|
||||
$m1[$q0[$q1[$i] ^ $key[10]] ^ $key[2]] ^
|
||||
$m2[$q1[$q0[$i] ^ $key[11]] ^ $key[3]] ^
|
||||
@ -444,9 +444,9 @@ class Twofish extends Base
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
list ($sb, $sa, $s9, $s8) = $this->_mdsrem($le_longs[1], $le_longs[2]);
|
||||
list ($s7, $s6, $s5, $s4) = $this->_mdsrem($le_longs[3], $le_longs[4]);
|
||||
list ($s3, $s2, $s1, $s0) = $this->_mdsrem($le_longs[5], $le_longs[6]);
|
||||
list($sb, $sa, $s9, $s8) = $this->_mdsrem($le_longs[1], $le_longs[2]);
|
||||
list($s7, $s6, $s5, $s4) = $this->_mdsrem($le_longs[3], $le_longs[4]);
|
||||
list($s3, $s2, $s1, $s0) = $this->_mdsrem($le_longs[5], $le_longs[6]);
|
||||
for ($i = 0, $j = 1; $i < 40; $i+= 2, $j+= 2) {
|
||||
$A = $m0[$q0[$q0[$q1[$i] ^ $key[17]] ^ $key[ 9]] ^ $key[1]] ^
|
||||
$m1[$q0[$q1[$q1[$i] ^ $key[18]] ^ $key[10]] ^ $key[2]] ^
|
||||
@ -468,10 +468,10 @@ class Twofish extends Base
|
||||
}
|
||||
break;
|
||||
default: // 32
|
||||
list ($sf, $se, $sd, $sc) = $this->_mdsrem($le_longs[1], $le_longs[2]);
|
||||
list ($sb, $sa, $s9, $s8) = $this->_mdsrem($le_longs[3], $le_longs[4]);
|
||||
list ($s7, $s6, $s5, $s4) = $this->_mdsrem($le_longs[5], $le_longs[6]);
|
||||
list ($s3, $s2, $s1, $s0) = $this->_mdsrem($le_longs[7], $le_longs[8]);
|
||||
list($sf, $se, $sd, $sc) = $this->_mdsrem($le_longs[1], $le_longs[2]);
|
||||
list($sb, $sa, $s9, $s8) = $this->_mdsrem($le_longs[3], $le_longs[4]);
|
||||
list($s7, $s6, $s5, $s4) = $this->_mdsrem($le_longs[5], $le_longs[6]);
|
||||
list($s3, $s2, $s1, $s0) = $this->_mdsrem($le_longs[7], $le_longs[8]);
|
||||
for ($i = 0, $j = 1; $i < 40; $i+= 2, $j+= 2) {
|
||||
$A = $m0[$q0[$q0[$q1[$q1[$i] ^ $key[25]] ^ $key[17]] ^ $key[ 9]] ^ $key[1]] ^
|
||||
$m1[$q0[$q1[$q1[$q0[$i] ^ $key[26]] ^ $key[18]] ^ $key[10]] ^ $key[2]] ^
|
||||
@ -672,7 +672,7 @@ class Twofish extends Base
|
||||
|
||||
// Max. 10 Ultra-Hi-optimized inline-crypt functions. After that, we'll (still) create very fast code, but not the ultimate fast one.
|
||||
// (Currently, for Crypt_Twofish, one generated $lambda_function cost on php5.5@32bit ~140kb unfreeable mem and ~240kb on php5.5@64bit)
|
||||
$gen_hi_opt_code = (bool)( count($lambda_functions) < 10 );
|
||||
$gen_hi_opt_code = (bool)(count($lambda_functions) < 10);
|
||||
|
||||
// Generation of a uniqe hash for our generated code
|
||||
$code_hash = "Crypt_Twofish, {$this->mode}";
|
||||
|
@ -3723,7 +3723,7 @@ class X509
|
||||
* @param string $path absolute path with / as component separator
|
||||
* @param bool $create optional
|
||||
* @access private
|
||||
* @return array item ref or false
|
||||
* @return array|false
|
||||
*/
|
||||
function &_subArray(&$root, $path, $create = false)
|
||||
{
|
||||
@ -3759,7 +3759,7 @@ class X509
|
||||
* @param string $path optional absolute path with / as component separator
|
||||
* @param bool $create optional
|
||||
* @access private
|
||||
* @return array ref or false
|
||||
* @return array|false
|
||||
*/
|
||||
function &_extensions(&$root, $path = null, $create = false)
|
||||
{
|
||||
@ -4335,7 +4335,7 @@ class X509
|
||||
* @param string $serial
|
||||
* @param bool $create optional
|
||||
* @access private
|
||||
* @return int or false
|
||||
* @return int|false
|
||||
*/
|
||||
function _revokedCertificate(&$rclist, $serial, $create = false)
|
||||
{
|
||||
@ -4585,7 +4585,7 @@ class X509
|
||||
* getOID('zzz') == 'zzz'
|
||||
*
|
||||
* @access public
|
||||
* @return String
|
||||
* @return string
|
||||
*/
|
||||
function getOID($name)
|
||||
{
|
||||
|
@ -423,13 +423,13 @@ class BigInteger
|
||||
$this->is_negative = false;
|
||||
break;
|
||||
case self::MODE_BCMATH:
|
||||
$x = ( strlen($x) & 1 ) ? '0' . $x : $x;
|
||||
$x = (strlen($x) & 1) ? '0' . $x : $x;
|
||||
$temp = new static(pack('H*', $x), 256);
|
||||
$this->value = $this->is_negative ? '-' . $temp->value : $temp->value;
|
||||
$this->is_negative = false;
|
||||
break;
|
||||
default:
|
||||
$x = ( strlen($x) & 1 ) ? '0' . $x : $x;
|
||||
$x = (strlen($x) & 1) ? '0' . $x : $x;
|
||||
$temp = new static(pack('H*', $x), 256);
|
||||
$this->value = $temp->value;
|
||||
}
|
||||
@ -556,7 +556,7 @@ class BigInteger
|
||||
}
|
||||
|
||||
$temp = gmp_strval(gmp_abs($this->value), 16);
|
||||
$temp = ( strlen($temp) & 1 ) ? '0' . $temp : $temp;
|
||||
$temp = (strlen($temp) & 1) ? '0' . $temp : $temp;
|
||||
$temp = pack('H*', $temp);
|
||||
|
||||
return $this->precision > 0 ?
|
||||
@ -794,7 +794,6 @@ class BigInteger
|
||||
$vars[] = 'precision';
|
||||
}
|
||||
return $vars;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1495,7 +1494,7 @@ class BigInteger
|
||||
);
|
||||
$y_window = array(
|
||||
$y_value[$y_max],
|
||||
( $y_max > 0 ) ? $y_value[$y_max - 1] : 0
|
||||
($y_max > 0) ? $y_value[$y_max - 1] : 0
|
||||
);
|
||||
|
||||
$q_index = $i - $y_max - 1;
|
||||
@ -1687,10 +1686,10 @@ class BigInteger
|
||||
}
|
||||
|
||||
if (MATH_BIGINTEGER_MODE == self::MODE_BCMATH) {
|
||||
$temp = new static();
|
||||
$temp->value = bcpowmod($this->value, $e->value, $n->value, 0);
|
||||
$temp = new static();
|
||||
$temp->value = bcpowmod($this->value, $e->value, $n->value, 0);
|
||||
|
||||
return $this->_normalize($temp);
|
||||
return $this->_normalize($temp);
|
||||
}
|
||||
|
||||
if (empty($e->value)) {
|
||||
@ -1741,7 +1740,7 @@ class BigInteger
|
||||
$mod2->value = array(1);
|
||||
$mod2->_lshift($j);
|
||||
|
||||
$part1 = ( $mod1->value != array(1) ) ? $this->_slidingWindow($e, $mod1, self::MONTGOMERY) : new static();
|
||||
$part1 = ($mod1->value != array(1)) ? $this->_slidingWindow($e, $mod1, self::MONTGOMERY) : new static();
|
||||
$part2 = $this->_slidingWindow($e, $mod2, self::POWEROF2);
|
||||
|
||||
$y1 = $mod2->modInverse($mod1);
|
||||
@ -1836,13 +1835,14 @@ class BigInteger
|
||||
}
|
||||
}
|
||||
|
||||
for ($k = 0; $k <= $j; ++$k) {// eg. the length of substr($e_bits, $i, $j+1)
|
||||
// eg. the length of substr($e_bits, $i, $j + 1)
|
||||
for ($k = 0; $k <= $j; ++$k) {
|
||||
$result = $this->_squareReduce($result, $n_value, $mode);
|
||||
}
|
||||
|
||||
$result = $this->_multiplyReduce($result, $powers[bindec(substr($e_bits, $i, $j + 1))], $n_value, $mode);
|
||||
|
||||
$i+=$j + 1;
|
||||
$i += $j + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2409,7 +2409,7 @@ class BigInteger
|
||||
* </code>
|
||||
*
|
||||
* @param \phpseclib\Math\BigInteger $n
|
||||
* @return mixed false, if no modular inverse exists, \phpseclib\Math\BigInteger, otherwise.
|
||||
* @return \phpseclib\Math\BigInteger|false
|
||||
* @access public
|
||||
* @internal See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=21 HAC 14.64} for more information.
|
||||
*/
|
||||
@ -2420,7 +2420,7 @@ class BigInteger
|
||||
$temp = new static();
|
||||
$temp->value = gmp_invert($this->value, $n->value);
|
||||
|
||||
return ( $temp->value === false ) ? false : $this->_normalize($temp);
|
||||
return ($temp->value === false) ? false : $this->_normalize($temp);
|
||||
}
|
||||
|
||||
static $zero, $one;
|
||||
@ -2680,13 +2680,13 @@ class BigInteger
|
||||
function _compare($x_value, $x_negative, $y_value, $y_negative)
|
||||
{
|
||||
if ($x_negative != $y_negative) {
|
||||
return ( !$x_negative && $y_negative ) ? 1 : -1;
|
||||
return (!$x_negative && $y_negative) ? 1 : -1;
|
||||
}
|
||||
|
||||
$result = $x_negative ? -1 : 1;
|
||||
|
||||
if (count($x_value) != count($y_value)) {
|
||||
return ( count($x_value) > count($y_value) ) ? $result : -$result;
|
||||
return (count($x_value) > count($y_value)) ? $result : -$result;
|
||||
}
|
||||
$size = max(count($x_value), count($y_value));
|
||||
|
||||
@ -2695,7 +2695,7 @@ class BigInteger
|
||||
|
||||
for ($i = count($x_value) - 1; $i >= 0; --$i) {
|
||||
if ($x_value[$i] != $y_value[$i]) {
|
||||
return ( $x_value[$i] > $y_value[$i] ) ? $result : -$result;
|
||||
return ($x_value[$i] > $y_value[$i]) ? $result : -$result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3153,13 +3153,13 @@ class BigInteger
|
||||
/**
|
||||
* Generate a random prime number.
|
||||
*
|
||||
* If there's not a prime within the given range, false will be returned. If more than $timeout seconds have elapsed,
|
||||
* give up and return false.
|
||||
* If there's not a prime within the given range, false will be returned.
|
||||
* If more than $timeout seconds have elapsed, give up and return false.
|
||||
*
|
||||
* @param \phpseclib\Math\BigInteger $arg1
|
||||
* @param \phpseclib\Math\BigInteger $arg2
|
||||
* @param int $timeout
|
||||
* @return mixed
|
||||
* @return Math_BigInteger|false
|
||||
* @access public
|
||||
* @internal See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap4.pdf#page=15 HAC 4.44}.
|
||||
*/
|
||||
|
@ -1365,7 +1365,7 @@ class SSH1
|
||||
* Returns a string if NET_SSH1_LOGGING == self::LOG_COMPLEX, an array if NET_SSH1_LOGGING == self::LOG_SIMPLE and false if !defined('NET_SSH1_LOGGING')
|
||||
*
|
||||
* @access public
|
||||
* @return string or Array
|
||||
* @return array|false|string
|
||||
*/
|
||||
function getLog()
|
||||
{
|
||||
|
@ -188,7 +188,7 @@ class SSH2
|
||||
* Server Identifier
|
||||
*
|
||||
* @see \phpseclib\Net\SSH2::getServerIdentification()
|
||||
* @var mixed false or Array
|
||||
* @var array|false
|
||||
* @access private
|
||||
*/
|
||||
var $server_identifier = false;
|
||||
@ -197,7 +197,7 @@ class SSH2
|
||||
* Key Exchange Algorithms
|
||||
*
|
||||
* @see \phpseclib\Net\SSH2::getKexAlgorithims()
|
||||
* @var mixed false or Array
|
||||
* @var array|false
|
||||
* @access private
|
||||
*/
|
||||
var $kex_algorithms = false;
|
||||
@ -233,7 +233,7 @@ class SSH2
|
||||
* Server Host Key Algorithms
|
||||
*
|
||||
* @see \phpseclib\Net\SSH2::getServerHostKeyAlgorithms()
|
||||
* @var mixed false or Array
|
||||
* @var array|false
|
||||
* @access private
|
||||
*/
|
||||
var $server_host_key_algorithms = false;
|
||||
@ -242,7 +242,7 @@ class SSH2
|
||||
* Encryption Algorithms: Client to Server
|
||||
*
|
||||
* @see \phpseclib\Net\SSH2::getEncryptionAlgorithmsClient2Server()
|
||||
* @var mixed false or Array
|
||||
* @var array|false
|
||||
* @access private
|
||||
*/
|
||||
var $encryption_algorithms_client_to_server = false;
|
||||
@ -251,7 +251,7 @@ class SSH2
|
||||
* Encryption Algorithms: Server to Client
|
||||
*
|
||||
* @see \phpseclib\Net\SSH2::getEncryptionAlgorithmsServer2Client()
|
||||
* @var mixed false or Array
|
||||
* @var array|false
|
||||
* @access private
|
||||
*/
|
||||
var $encryption_algorithms_server_to_client = false;
|
||||
@ -260,7 +260,7 @@ class SSH2
|
||||
* MAC Algorithms: Client to Server
|
||||
*
|
||||
* @see \phpseclib\Net\SSH2::getMACAlgorithmsClient2Server()
|
||||
* @var mixed false or Array
|
||||
* @var array|false
|
||||
* @access private
|
||||
*/
|
||||
var $mac_algorithms_client_to_server = false;
|
||||
@ -269,7 +269,7 @@ class SSH2
|
||||
* MAC Algorithms: Server to Client
|
||||
*
|
||||
* @see \phpseclib\Net\SSH2::getMACAlgorithmsServer2Client()
|
||||
* @var mixed false or Array
|
||||
* @var array|false
|
||||
* @access private
|
||||
*/
|
||||
var $mac_algorithms_server_to_client = false;
|
||||
@ -278,7 +278,7 @@ class SSH2
|
||||
* Compression Algorithms: Client to Server
|
||||
*
|
||||
* @see \phpseclib\Net\SSH2::getCompressionAlgorithmsClient2Server()
|
||||
* @var mixed false or Array
|
||||
* @var array|false
|
||||
* @access private
|
||||
*/
|
||||
var $compression_algorithms_client_to_server = false;
|
||||
@ -287,7 +287,7 @@ class SSH2
|
||||
* Compression Algorithms: Server to Client
|
||||
*
|
||||
* @see \phpseclib\Net\SSH2::getCompressionAlgorithmsServer2Client()
|
||||
* @var mixed false or Array
|
||||
* @var array|false
|
||||
* @access private
|
||||
*/
|
||||
var $compression_algorithms_server_to_client = false;
|
||||
@ -296,7 +296,7 @@ class SSH2
|
||||
* Languages: Server to Client
|
||||
*
|
||||
* @see \phpseclib\Net\SSH2::getLanguagesServer2Client()
|
||||
* @var mixed false or Array
|
||||
* @var array|false
|
||||
* @access private
|
||||
*/
|
||||
var $languages_server_to_client = false;
|
||||
@ -305,7 +305,7 @@ class SSH2
|
||||
* Languages: Client to Server
|
||||
*
|
||||
* @see \phpseclib\Net\SSH2::getLanguagesClient2Server()
|
||||
* @var mixed false or Array
|
||||
* @var array|false
|
||||
* @access private
|
||||
*/
|
||||
var $languages_client_to_server = false;
|
||||
@ -1764,7 +1764,7 @@ class SSH2
|
||||
* Maps an encryption algorithm name to the number of key bytes.
|
||||
*
|
||||
* @param string $algorithm Name of the encryption algorithm
|
||||
* @return mixed Number of bytes as an integer or null for unknown
|
||||
* @return int|null Number of bytes as an integer or null for unknown
|
||||
* @access private
|
||||
*/
|
||||
function _encryption_algorithm_to_key_size($algorithm)
|
||||
@ -3654,7 +3654,7 @@ class SSH2
|
||||
* Returns a string if NET_SSH2_LOGGING == self::LOG_COMPLEX, an array if NET_SSH2_LOGGING == self::LOG_SIMPLE and false if !defined('NET_SSH2_LOGGING')
|
||||
*
|
||||
* @access public
|
||||
* @return string or Array
|
||||
* @return array|false|string
|
||||
*/
|
||||
function getLog()
|
||||
{
|
||||
@ -4085,7 +4085,7 @@ class SSH2
|
||||
/**
|
||||
* Returns the exit status of an SSH command or false.
|
||||
*
|
||||
* @return int or false
|
||||
* @return false|int
|
||||
* @access public
|
||||
*/
|
||||
function getExitStatus()
|
||||
|
@ -171,8 +171,8 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testStatOnDir
|
||||
*/
|
||||
* @depends testStatOnDir
|
||||
*/
|
||||
public function testPutSizeGetFileCallback($sftp)
|
||||
{
|
||||
self::$buffer = self::$exampleData;
|
||||
|
@ -58,13 +58,15 @@ abstract class Unit_Crypt_AES_TestCase extends PhpseclibTestCase
|
||||
|
||||
$result = array();
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
foreach ($modes as $mode)
|
||||
foreach ($plaintexts as $plaintext)
|
||||
foreach ($ivs as $iv)
|
||||
foreach ($keys as $key)
|
||||
$result[] = array($mode, $plaintext, $iv, $key);
|
||||
// @codingStandardsIgnoreEnd
|
||||
foreach ($modes as $mode) {
|
||||
foreach ($plaintexts as $plaintext) {
|
||||
foreach ($ivs as $iv) {
|
||||
foreach ($keys as $key) {
|
||||
$result[] = array($mode, $plaintext, $iv, $key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
@ -124,10 +126,10 @@ abstract class Unit_Crypt_AES_TestCase extends PhpseclibTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Produces all combinations of test values.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
* Produces all combinations of test values.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function continuousBufferBatteryCombos()
|
||||
{
|
||||
$modes = array(
|
||||
@ -155,19 +157,20 @@ abstract class Unit_Crypt_AES_TestCase extends PhpseclibTestCase
|
||||
|
||||
$result = array();
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
foreach ($modes as $mode)
|
||||
foreach ($combos as $combo)
|
||||
foreach (array('encrypt', 'decrypt') as $op)
|
||||
$result[] = array($op, $mode, $combo);
|
||||
// @codingStandardsIgnoreEnd
|
||||
foreach ($modes as $mode) {
|
||||
foreach ($combos as $combo) {
|
||||
foreach (array('encrypt', 'decrypt') as $op) {
|
||||
$result[] = array($op, $mode, $combo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider continuousBufferBatteryCombos
|
||||
*/
|
||||
* @dataProvider continuousBufferBatteryCombos
|
||||
*/
|
||||
public function testContinuousBufferBattery($op, $mode, $test)
|
||||
{
|
||||
$iv = str_repeat('x', 16);
|
||||
@ -211,9 +214,10 @@ abstract class Unit_Crypt_AES_TestCase extends PhpseclibTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider continuousBufferBatteryCombos
|
||||
*/
|
||||
// pretty much the same as testContinuousBufferBattery with the caveat that continuous mode is not enabled
|
||||
* Pretty much the same as testContinuousBufferBattery with the caveat that continuous mode is not enabled.
|
||||
*
|
||||
* @dataProvider continuousBufferBatteryCombos
|
||||
*/
|
||||
public function testNonContinuousBufferBattery($op, $mode, $test)
|
||||
{
|
||||
if (count($test) == 1) {
|
||||
|
@ -56,18 +56,21 @@ class Unit_Crypt_BlowfishTest extends PhpseclibTestCase
|
||||
array(pack('H*', '0123456789ABCDEF'), pack('H*', '0000000000000000'), pack('H*', '245946885754369A')),
|
||||
array(pack('H*', 'FEDCBA9876543210'), pack('H*', 'FFFFFFFFFFFFFFFF'), pack('H*', '6B5C5A9C5D9E0A5A'))
|
||||
);
|
||||
|
||||
$result = array();
|
||||
// @codingStandardsIgnoreStart
|
||||
foreach ($engines as $engine => $engineName)
|
||||
foreach ($tests as $test)
|
||||
$result[] = array($engine, $engineName, $test[0], $test[1], $test[2]);
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
foreach ($engines as $engine => $engineName) {
|
||||
foreach ($tests as $test) {
|
||||
$result[] = array($engine, $engineName, $test[0], $test[1], $test[2]);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider engineVectors
|
||||
*/
|
||||
* @dataProvider engineVectors
|
||||
*/
|
||||
public function testVectors($engine, $engineName, $key, $plaintext, $expected)
|
||||
{
|
||||
$bf = new Blowfish();
|
||||
|
@ -30,12 +30,15 @@ class Unit_Crypt_RC2Test extends PhpseclibTestCase
|
||||
array('88bca90e90875a7f0f79c384627bafb2', 128, '0000000000000000', '2269552ab0f85ca6'),
|
||||
array('88bca90e90875a7f0f79c384627bafb216f80a6f85920584c42fceb0be255daf1e', 129, '0000000000000000', '5b78d3a43dfff1f1')
|
||||
);
|
||||
|
||||
$result = array();
|
||||
// @codingStandardsIgnoreStart
|
||||
foreach ($this->engines as $engine => $engineName)
|
||||
foreach ($tests as $test)
|
||||
$result[] = array($engine, $engineName, $test[0], $test[1], $test[2], $test[3]);
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
foreach ($this->engines as $engine => $engineName) {
|
||||
foreach ($tests as $test) {
|
||||
$result[] = array($engine, $engineName, $test[0], $test[1], $test[2], $test[3]);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -103,8 +106,8 @@ class Unit_Crypt_RC2Test extends PhpseclibTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider engineVectors
|
||||
*/
|
||||
* @dataProvider engineVectors
|
||||
*/
|
||||
public function testVectors($engine, $engineName, $key, $keyLen, $plaintext, $ciphertext)
|
||||
{
|
||||
$rc2 = new RC2();
|
||||
|
@ -181,19 +181,23 @@ class Unit_Crypt_RC4Test extends PhpseclibTestCase
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$result = array();
|
||||
// @codingStandardsIgnoreStart
|
||||
foreach ($engines as $engine => $engineName)
|
||||
foreach ($tests as $test)
|
||||
foreach ($test['output'] as $output)
|
||||
$result[] = array($engine, $engineName, $test['key'], $output['offset'], $output['result']);
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
foreach ($engines as $engine => $engineName) {
|
||||
foreach ($tests as $test) {
|
||||
foreach ($test['output'] as $output) {
|
||||
$result[] = array($engine, $engineName, $test['key'], $output['offset'], $output['result']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider engineVectors
|
||||
*/
|
||||
* @dataProvider engineVectors
|
||||
*/
|
||||
public function testVectors($engine, $engineName, $key, $offset, $expected)
|
||||
{
|
||||
$rc4 = new RC4();
|
||||
|
@ -87,18 +87,21 @@ class Unit_Crypt_TripleDESTest extends PhpseclibTestCase
|
||||
array(str_repeat("\x01", 24), pack('H*', '0000000000000002'), pack('H*', '06E7EA22CE92708F')),
|
||||
array(str_repeat("\x01", 24), pack('H*', '0000000000000001'), pack('H*', '166B40B44ABA4BD6'))
|
||||
);
|
||||
|
||||
$result = array();
|
||||
// @codingStandardsIgnoreStart
|
||||
foreach ($this->engines as $engine => $engineName)
|
||||
foreach ($tests as $test)
|
||||
$result[] = array($engine, $engineName, $test[0], $test[1], $test[2]);
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
foreach ($this->engines as $engine => $engineName) {
|
||||
foreach ($tests as $test) {
|
||||
$result[] = array($engine, $engineName, $test[0], $test[1], $test[2]);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider engineVectors
|
||||
*/
|
||||
* @dataProvider engineVectors
|
||||
*/
|
||||
public function testVectors($engine, $engineName, $key, $plaintext, $expected)
|
||||
{
|
||||
$des = new TripleDES();
|
||||
@ -135,18 +138,21 @@ class Unit_Crypt_TripleDESTest extends PhpseclibTestCase
|
||||
pack('H*', '84401f78fe6c10876d8ea23094ea5309'),
|
||||
pack('H*', '7b1f7c7e3b1c948ebd04a75ffba7d2f5'))
|
||||
);
|
||||
|
||||
$result = array();
|
||||
// @codingStandardsIgnoreStart
|
||||
foreach ($engines as $engine => $engineName)
|
||||
foreach ($tests as $test)
|
||||
$result[] = array($engine, $engineName, $test[0], $test[1], $test[2], $test[3]);
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
foreach ($engines as $engine => $engineName) {
|
||||
foreach ($tests as $test) {
|
||||
$result[] = array($engine, $engineName, $test[0], $test[1], $test[2], $test[3]);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider engineIVVectors
|
||||
*/
|
||||
* @dataProvider engineIVVectors
|
||||
*/
|
||||
public function testVectorsWithIV($engine, $engineName, $key, $iv, $plaintext, $expected)
|
||||
{
|
||||
$des = new TripleDES();
|
||||
|
@ -94,6 +94,5 @@ class Unit_File_X509_SPKACTest extends PhpseclibTestCase
|
||||
$x509->validateSignature(),
|
||||
'Failed asserting that the signature is invalid'
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ abstract class Unit_Math_BigInteger_TestCase extends PhpseclibTestCase
|
||||
|
||||
public function testToHex()
|
||||
{
|
||||
$this->assertSame('41', $this->getInstance('65')->toHex());
|
||||
$this->assertSame('41', $this->getInstance('65')->toHex());
|
||||
}
|
||||
|
||||
public function testToBits()
|
||||
|
Loading…
Reference in New Issue
Block a user