From 39a0b652b372dda6539cfef2e92d2313f02da59a Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 27 May 2018 10:29:56 -0500 Subject: [PATCH 1/2] SSH/Agent: add dummy setHash() method --- phpseclib/System/SSH/Agent.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/phpseclib/System/SSH/Agent.php b/phpseclib/System/SSH/Agent.php index 7388cb47..a5f605b6 100644 --- a/phpseclib/System/SSH/Agent.php +++ b/phpseclib/System/SSH/Agent.php @@ -202,6 +202,18 @@ class System_SSH_Agent_Identity { } + /** + * Set Hash + * + * ssh-agent doesn't support using hashes for RSA other than SHA1 + * + * @param string $hash + * @access public + */ + function setHash($hash) + { + } + /** * Create a signature * @@ -330,12 +342,14 @@ class System_SSH_Agent $packet = pack('NC', 1, SYSTEM_SSH_AGENTC_REQUEST_IDENTITIES); if (strlen($packet) != fputs($this->fsock, $packet)) { user_error('Connection closed while requesting identities'); + return array(); } $length = current(unpack('N', fread($this->fsock, 4))); $type = ord(fread($this->fsock, 1)); if ($type != SYSTEM_SSH_AGENT_IDENTITIES_ANSWER) { user_error('Unable to request identities'); + return array(); } $identities = array(); From 04f62f9e9ceb004e9ef4427c37cde83e2696cc53 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 27 May 2018 10:48:03 -0500 Subject: [PATCH 2/2] SSH2: adjustments for 2.0 branch --- phpseclib/Net/SSH2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index a4baa77e..5ebfd422 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -4589,7 +4589,7 @@ class SSH2 default: $hash = 'sha1'; } - $hashObj = new Crypt_Hash($hash); + $hashObj = new Hash($hash); switch ($this->signature_format) { case 'rsa-sha2-512': $h = pack('N5a*', 0x00305130, 0x0D060960, 0x86480165, 0x03040203, 0x05000440, $hashObj->hash($this->exchange_hash));