Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/phpseclib/phpseclib
Browse files Browse the repository at this point in the history
  • Loading branch information
terrafrost committed Nov 10, 2014
2 parents 76c1c66 + e540752 commit c6e88ca
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions phpseclib/Net/SSH2.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
define('NET_SSH2_MASK_LOGIN_REQ', 0x00000004);
define('NET_SSH2_MASK_LOGIN', 0x00000008);
define('NET_SSH2_MASK_SHELL', 0x00000010);
define('NET_SSH2_MASK_WINDOW_ADJUST', 0X00000020);
define('NET_SSH2_MASK_WINDOW_ADJUST', 0x00000020);
/**#@-*/

/**#@+
Expand Down Expand Up @@ -3769,8 +3769,9 @@ function getServerPublicHostKey()
$e = new Math_BigInteger($this->_string_shift($server_public_host_key, $temp['length']), -256);

$temp = unpack('Nlength', $this->_string_shift($server_public_host_key, 4));
$n = new Math_BigInteger($this->_string_shift($server_public_host_key, $temp['length']), -256);
$nLength = $temp['length'];
$rawN = $this->_string_shift($server_public_host_key, $temp['length']);
$n = new Math_BigInteger($rawN, -256);
$nLength = strlen(ltrim($rawN, "\0"));

/*
$temp = unpack('Nlength', $this->_string_shift($signature, 4));
Expand Down Expand Up @@ -3807,7 +3808,7 @@ function getServerPublicHostKey()
$s = $s->toBytes();

$h = pack('N4H*', 0x00302130, 0x0906052B, 0x0E03021A, 0x05000414, sha1($this->exchange_hash));
$h = chr(0x01) . str_repeat(chr(0xFF), $nLength - 3 - strlen($h)) . $h;
$h = chr(0x01) . str_repeat(chr(0xFF), $nLength - 2 - strlen($h)) . $h;

if ($s != $h) {
user_error('Bad server signature');
Expand Down

0 comments on commit c6e88ca

Please sign in to comment.