summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMiklós Fazekas <mfazekas@szemafor.com>2019-08-28 06:30:09 +0200
committerGitHub <noreply@github.com>2019-08-28 06:30:09 +0200
commitbd7d0b3ba7358f7df6b98e044c7c153d04598c01 (patch)
tree9c203c7c09680c241a83ed1cf42d0e7ed3520a92 /lib
parent5ca085ea30baf63d3a05ee931f324a9dabf504e6 (diff)
parent602ad9f91e876590aa43cc091728b699388ce011 (diff)
downloadnet-ssh-bd7d0b3ba7358f7df6b98e044c7c153d04598c01.tar.gz
Merge pull request #703 from fwininger/openssl4
Modernize OpenSSL SHA2 implementation
Diffstat (limited to 'lib')
-rw-r--r--lib/net/ssh/transport/hmac.rb20
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/net/ssh/transport/hmac.rb b/lib/net/ssh/transport/hmac.rb
index 3ba9349..d8560eb 100644
--- a/lib/net/ssh/transport/hmac.rb
+++ b/lib/net/ssh/transport/hmac.rb
@@ -15,21 +15,19 @@ require 'net/ssh/transport/hmac/none'
module Net::SSH::Transport::HMAC
# The mapping of SSH hmac algorithms to their implementations
MAP = {
- 'hmac-md5' => MD5,
- 'hmac-md5-96' => MD5_96,
- 'hmac-sha1' => SHA1,
- 'hmac-sha1-96' => SHA1_96,
- 'hmac-ripemd160' => RIPEMD160,
+ 'hmac-md5' => MD5,
+ 'hmac-md5-96' => MD5_96,
+ 'hmac-sha1' => SHA1,
+ 'hmac-sha1-96' => SHA1_96,
+ 'hmac-sha2-256' => SHA2_256,
+ 'hmac-sha2-256-96' => SHA2_256_96,
+ 'hmac-sha2-512' => SHA2_512,
+ 'hmac-sha2-512-96' => SHA2_512_96,
+ 'hmac-ripemd160' => RIPEMD160,
'hmac-ripemd160@openssh.com' => RIPEMD160,
'none' => None
}
- # add mapping to sha2 hmac algorithms if they're available
- MAP['hmac-sha2-256'] = SHA2_256 if defined?(::Net::SSH::Transport::HMAC::SHA2_256)
- MAP['hmac-sha2-256-96'] = SHA2_256_96 if defined?(::Net::SSH::Transport::HMAC::SHA2_256_96)
- MAP['hmac-sha2-512'] = SHA2_512 if defined?(::Net::SSH::Transport::HMAC::SHA2_512)
- MAP['hmac-sha2-512-96'] = SHA2_512_96 if defined?(::Net::SSH::Transport::HMAC::SHA2_512_96)
-
# Retrieves a new hmac instance of the given SSH type (+name+). If +key+ is
# given, the new instance will be initialized with that key.
def self.get(name, key="", parameters = {})