From ec5aead74655665ff7074c3e404cb6d563caa252 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Mon, 17 Sep 2012 02:33:03 -0500 Subject: [PATCH] SSH-2.0-SSHD doesn't implement hmac-*-96 correctly --- phpseclib/Net/SSH2.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 3b1b4c2a..57cc9ab8 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -938,6 +938,15 @@ class Net_SSH2 { //'zlib' // OPTIONAL ZLIB (LZ77) compression ); + // some SSH servers have buggy implementations of some of the above algorithms + switch ($this->server_identifier) { + case 'SSH-2.0-SSHD': + $mac_algorithms = array_values(array_diff( + $mac_algorithms, + array('hmac-sha1-96', 'hmac-md5-96') + )); + } + static $str_kex_algorithms, $str_server_host_key_algorithms, $encryption_algorithms_server_to_client, $mac_algorithms_server_to_client, $compression_algorithms_server_to_client, $encryption_algorithms_client_to_server, $mac_algorithms_client_to_server, $compression_algorithms_client_to_server;