diff options
Diffstat (limited to 'lib/net/ssh')
-rw-r--r-- | lib/net/ssh/buffer.rb | 4 | ||||
-rw-r--r-- | lib/net/ssh/transport/cipher_factory.rb | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/net/ssh/buffer.rb b/lib/net/ssh/buffer.rb index d0c4ced..563966a 100644 --- a/lib/net/ssh/buffer.rb +++ b/lib/net/ssh/buffer.rb @@ -152,7 +152,7 @@ module Net; module SSH end # Reads all data up to and including the given pattern, which may be a - # String, Fixnum, or Regexp and is interpreted exactly as String#index + # String, Integer, or Regexp and is interpreted exactly as String#index # does. Returns nil if nothing matches. Increments the position to point # immediately after the pattern, if it does match. Returns all data up to # and including the text that matched the pattern. @@ -160,7 +160,7 @@ module Net; module SSH index = @content.index(pattern, @position) or return nil length = case pattern when String then pattern.length - when Fixnum then 1 + when Integer then 1 when Regexp then $&.length end index && read(index+length) diff --git a/lib/net/ssh/transport/cipher_factory.rb b/lib/net/ssh/transport/cipher_factory.rb index 7bb1946..3574120 100644 --- a/lib/net/ssh/transport/cipher_factory.rb +++ b/lib/net/ssh/transport/cipher_factory.rb @@ -45,8 +45,8 @@ module Net; module SSH; module Transport } # Ruby's OpenSSL bindings always return a key length of 16 for RC4 ciphers - # resulting in the error: OpenSSL::CipherError: key length too short. - # The following ciphers will override this key length. + # resulting in the error: OpenSSL::CipherError: key length too short. + # The following ciphers will override this key length. KEY_LEN_OVERRIDE = { "arcfour256" => 32, "arcfour512" => 64 @@ -69,7 +69,7 @@ module Net; module SSH; module Transport def self.get(name, options={}) ossl_name = SSH_TO_OSSL[name] or raise NotImplementedError, "unimplemented cipher `#{name}'" return IdentityCipher if ossl_name == "none" - cipher = OpenSSL::Cipher::Cipher.new(ossl_name) + cipher = OpenSSL::Cipher.new(ossl_name) cipher.send(options[:encrypt] ? :encrypt : :decrypt) @@ -94,10 +94,10 @@ module Net; module SSH; module Transport ossl_name = SSH_TO_OSSL[name] return [0, 0] if ossl_name.nil? || ossl_name == "none" - cipher = OpenSSL::Cipher::Cipher.new(ossl_name) + cipher = OpenSSL::Cipher.new(ossl_name) key_len = KEY_LEN_OVERRIDE[name] || cipher.key_len cipher.key_len = key_len - + return [key_len, ossl_name=="rc4" ? 8 : cipher.block_size] end end |