mirror of
https://github.com/danog/phpseclib.git
synced 2024-12-04 02:28:06 +01:00
Merge remote-tracking branch 'rrran/Bugfixes'
This commit is contained in:
commit
610d3d6ea0
@ -45,7 +45,6 @@ abstract class Objects
|
||||
* @param Object $obj
|
||||
* @param string $var
|
||||
* @param mixed $val
|
||||
* @return mixed
|
||||
* @access public
|
||||
*/
|
||||
public static function setVar($obj, $var, $val)
|
||||
@ -53,7 +52,7 @@ abstract class Objects
|
||||
$reflection = new \ReflectionClass(get_class($obj));
|
||||
$prop = $reflection->getProperty($var);
|
||||
$prop->setAccessible(true);
|
||||
return $prop->setValue($obj, $val);
|
||||
$prop->setValue($obj, $val);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -18,7 +18,6 @@
|
||||
namespace phpseclib\Crypt\Common\Signature;
|
||||
|
||||
use phpseclib\Math\BigInteger;
|
||||
use phpseclib\Common\Functions\Strings;
|
||||
|
||||
/**
|
||||
* Raw Signature Handler
|
||||
@ -33,7 +32,7 @@ abstract class Raw
|
||||
* Loads a signature
|
||||
*
|
||||
* @access public
|
||||
* @param array $key
|
||||
* @param array $sig
|
||||
* @return array
|
||||
*/
|
||||
public static function load($sig)
|
||||
@ -47,8 +46,8 @@ abstract class Raw
|
||||
}
|
||||
|
||||
return [
|
||||
'r' => $key['r'],
|
||||
's' => $key['s']
|
||||
'r' => $sig['r'],
|
||||
's' => $sig['s']
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,8 @@ abstract class SSH2
|
||||
* Loads a signature
|
||||
*
|
||||
* @access public
|
||||
* @param array $key
|
||||
* @return array
|
||||
* @param array $sig
|
||||
* @return mixed
|
||||
*/
|
||||
public static function load($sig)
|
||||
{
|
||||
@ -67,9 +67,9 @@ abstract class SSH2
|
||||
*/
|
||||
public static function save(BigInteger $r, BigInteger $s)
|
||||
{
|
||||
if ($r->getLength() != 160 || $s->getLength != 160) {
|
||||
if ($r->getLength() != 160 || $s->getLength() != 160) {
|
||||
return false;
|
||||
}
|
||||
return Strings::pack('ss', $r, $s);
|
||||
return Strings::packSSH2('ss', $r, $s);
|
||||
}
|
||||
}
|
||||
|
@ -201,6 +201,15 @@ class RSA extends AsymmetricKey
|
||||
*/
|
||||
private $sLen;
|
||||
|
||||
|
||||
/**
|
||||
* Comment
|
||||
*
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
private $comment;
|
||||
|
||||
/**
|
||||
* Hash function for the Mask Generation Function
|
||||
*
|
||||
|
@ -258,6 +258,7 @@ class TripleDES extends DES
|
||||
switch (strlen($key)) {
|
||||
case 16:
|
||||
$key.= substr($key, 0, 8);
|
||||
break;
|
||||
case 24:
|
||||
break;
|
||||
default:
|
||||
@ -438,7 +439,6 @@ class TripleDES extends DES
|
||||
* @see \phpseclib\Crypt\Common\SymmetricKey::setPreferredEngine()
|
||||
* @param int $engine
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function setPreferredEngine($engine)
|
||||
{
|
||||
@ -448,6 +448,6 @@ class TripleDES extends DES
|
||||
$this->des[2]->setPreferredEngine($engine);
|
||||
}
|
||||
|
||||
return parent::setPreferredEngine($engine);
|
||||
parent::setPreferredEngine($engine);
|
||||
}
|
||||
}
|
||||
|
@ -402,7 +402,7 @@ class Twofish extends BlockCipher
|
||||
case 256:
|
||||
break;
|
||||
default:
|
||||
throw new \LengthException('Key of size ' . strlen($key) . ' not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported');
|
||||
throw new \LengthException('Key of size ' . $length . ' not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported');
|
||||
}
|
||||
|
||||
parent::setKeyLength($length);
|
||||
|
@ -547,7 +547,7 @@ class SSH1
|
||||
{
|
||||
$this->fsock = @fsockopen($this->host, $this->port, $errno, $errstr, $this->connectionTimeout);
|
||||
if (!$this->fsock) {
|
||||
throw new \RuntimeException(rtrim("Cannot connect to $host. Error $errno. $errstr"));
|
||||
throw new \RuntimeException(rtrim("Cannot connect to $this->host. Error $errno. $errstr"));
|
||||
}
|
||||
|
||||
$this->server_identification = $init_line = fgets($this->fsock, 255);
|
||||
@ -924,7 +924,7 @@ class SSH1
|
||||
* @throws \RuntimeException on connection error
|
||||
* @access public
|
||||
*/
|
||||
public function read($expect, $mode = self::READ__SIMPLE)
|
||||
public function read($expect, $mode = self::READ_SIMPLE)
|
||||
{
|
||||
if (!($this->bitmap & self::MASK_LOGIN)) {
|
||||
throw new \RuntimeException('Operation disallowed prior to login()');
|
||||
@ -936,7 +936,7 @@ class SSH1
|
||||
|
||||
$match = $expect;
|
||||
while (true) {
|
||||
if ($mode == self::READ__REGEX) {
|
||||
if ($mode == self::READ_REGEX) {
|
||||
preg_match($expect, $this->interactiveBuffer, $matches);
|
||||
$match = isset($matches[0]) ? $matches[0] : '';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user