From 959c0cefae8c94058620d45de2acd7debc39f5f6 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sat, 11 Oct 2014 23:26:46 -0500 Subject: [PATCH] SSH2: add setCryptoEngine() function --- phpseclib/Net/SSH2.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 35127d7d..c7760096 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -840,6 +840,16 @@ class Net_SSH2 */ var $windowRows = 24; + /** + * Crypto Engine + * + * @see Net_SSH2::setCryptoEngine() + * @see Net_SSH2::_key_exchange() + * @var Integer + * @access private + */ + var $crypto_engine = false; + /** * Default Constructor. * @@ -941,6 +951,20 @@ class Net_SSH2 $this->connectionTimeout = $timeout; } + /** + * Set Crypto Engine Mode + * + * Possible $engine values: + * CRYPT_MODE_INTERNAL, CRYPT_MODE_MCRYPT + * + * @param Integer $engine + * @access private + */ + function setCryptoEngine($engine) + { + $this->crypto_engine = $engine; + } + /** * Connect to an SSHv2 server * @@ -1646,6 +1670,9 @@ class Net_SSH2 $keyBytes = pack('Na*', strlen($keyBytes), $keyBytes); if ($this->encrypt) { + if ($this->crypto_engine) { + $this->encrypt->setEngine($this->crypto_engine); + } $this->encrypt->enableContinuousBuffer(); $this->encrypt->disablePadding(); @@ -1663,6 +1690,9 @@ class Net_SSH2 } if ($this->decrypt) { + if ($this->crypto_engine) { + $this->decrypt->setEngine($this->crypto_engine); + } $this->decrypt->enableContinuousBuffer(); $this->decrypt->disablePadding();