SSH2: fix more E_DEPRECATE_NOTICEs

This commit is contained in:
terrafrost 2023-06-13 03:01:43 -05:00
parent b6c01f9318
commit 16c67f4399

View File

@ -439,6 +439,13 @@ class Net_SSH2
*/ */
var $hmac_create = false; var $hmac_create = false;
/**
* Client to Server HMAC Name
*
* @var string|false
*/
private $hmac_create_name;
/** /**
* Server to Client HMAC Object * Server to Client HMAC Object
* *
@ -448,6 +455,13 @@ class Net_SSH2
*/ */
var $hmac_check = false; var $hmac_check = false;
/**
* Server to Client HMAC Name
*
* @var string|false
*/
var $hmac_check_name;
/** /**
* Size of server to client HMAC * Size of server to client HMAC
* *
@ -2062,7 +2076,7 @@ class Net_SSH2
$this->hmac_create = new Crypt_Hash('md5-96'); $this->hmac_create = new Crypt_Hash('md5-96');
$createKeyLength = 16; $createKeyLength = 16;
} }
$this->hmac_create->name = $mac_algorithm_out; $this->hmac_create_name = $mac_algorithm_out;
$checkKeyLength = 0; $checkKeyLength = 0;
$this->hmac_size = 0; $this->hmac_size = 0;
@ -2092,7 +2106,7 @@ class Net_SSH2
$checkKeyLength = 16; $checkKeyLength = 16;
$this->hmac_size = 12; $this->hmac_size = 12;
} }
$this->hmac_check->name = $mac_algorithm_in; $this->hmac_check_name = $mac_algorithm_in;
$key = $kexHash->hash($keyBytes . $this->exchange_hash . 'E' . $this->session_id); $key = $kexHash->hash($keyBytes . $this->exchange_hash . 'E' . $this->session_id);
while ($createKeyLength > strlen($key)) { while ($createKeyLength > strlen($key)) {
@ -3619,7 +3633,7 @@ class Net_SSH2
// "implementations SHOULD check that the packet length is reasonable" // "implementations SHOULD check that the packet length is reasonable"
// PuTTY uses 0x9000 as the actual max packet size and so to shall we // PuTTY uses 0x9000 as the actual max packet size and so to shall we
if ($remaining_length < -$this->decrypt_block_size || $remaining_length > 0x9000 || $remaining_length % $this->decrypt_block_size != 0) { if ($remaining_length < -$this->decrypt_block_size || $remaining_length > 0x9000 || $remaining_length % $this->decrypt_block_size != 0) {
if (!$this->bad_key_size_fix && $this->_bad_algorithm_candidate($this->decrypt->name) && !($this->bitmap & NET_SSH2_MASK_LOGIN)) { if (!$this->bad_key_size_fix && $this->_bad_algorithm_candidate($this->decryptName) && !($this->bitmap & NET_SSH2_MASK_LOGIN)) {
$this->bad_key_size_fix = true; $this->bad_key_size_fix = true;
$this->_reset_connection(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); $this->_reset_connection(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED);
return false; return false;
@ -5014,13 +5028,13 @@ class Net_SSH2
'kex' => $this->kex_algorithm, 'kex' => $this->kex_algorithm,
'hostkey' => $this->signature_format, 'hostkey' => $this->signature_format,
'client_to_server' => array( 'client_to_server' => array(
'crypt' => $this->encrypt->name, 'crypt' => $this->encryptName,
'mac' => $this->hmac_create->name, 'mac' => $this->hmac_create_name,
'comp' => $compression_map[$this->compress], 'comp' => $compression_map[$this->compress],
), ),
'server_to_client' => array( 'server_to_client' => array(
'crypt' => $this->decrypt->name, 'crypt' => $this->decryptName,
'mac' => $this->hmac_check->name, 'mac' => $this->hmac_check_name,
'comp' => $compression_map[$this->decompress], 'comp' => $compression_map[$this->decompress],
) )
); );