aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Klein <klein.stefan1@googlemail.com>2020-04-02 23:39:47 +0000
committerGopher Robot <gobot@golang.org>2023-06-05 16:42:04 +0000
commit16222386f4de802a3c27c1714b0bcc28c0fd5397 (patch)
treef87e9e49e702a20a1e0624458892432861b159e5
parenta4e984136a63c90def42a9336ac6507c2f6a896d (diff)
downloadgo-x-crypto-16222386f4de802a3c27c1714b0bcc28c0fd5397.tar.xz
Add support for "hmac-sha2-512-etm@openssh.com"
Change-Id: I0203881afd7ad72e68f76650817451d7e292c91b GitHub-Last-Rev: 42b4119e1987e7a46aa06a2b142d5fd3ef6f216a GitHub-Pull-Request: golang/crypto#129 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/226982 Run-TryBot: Han-Wen Nienhuys <hanwen@google.com> Reviewed-by: Han-Wen Nienhuys <hanwen@google.com> Auto-Submit: Han-Wen Nienhuys <hanwen@google.com> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
-rw-r--r--ssh/common.go2
-rw-r--r--ssh/mac.go4
2 files changed, 5 insertions, 1 deletions
diff --git a/ssh/common.go b/ssh/common.go
index e6a77f2..dc6f301 100644
--- a/ssh/common.go
+++ b/ssh/common.go
@@ -85,7 +85,7 @@ var supportedHostKeyAlgos = []string{
// This is based on RFC 4253, section 6.4, but with hmac-md5 variants removed
// because they have reached the end of their useful life.
var supportedMACs = []string{
- "hmac-sha2-256-etm@openssh.com", "hmac-sha2-256", "hmac-sha1", "hmac-sha1-96",
+ "hmac-sha2-512-etm@openssh.com", "hmac-sha2-256-etm@openssh.com", "hmac-sha2-256", "hmac-sha1", "hmac-sha1-96",
}
var supportedCompressions = []string{compressionNone}
diff --git a/ssh/mac.go b/ssh/mac.go
index c07a062..0a21af4 100644
--- a/ssh/mac.go
+++ b/ssh/mac.go
@@ -10,6 +10,7 @@ import (
"crypto/hmac"
"crypto/sha1"
"crypto/sha256"
+ "crypto/sha512"
"hash"
)
@@ -46,6 +47,9 @@ func (t truncatingMAC) Size() int {
func (t truncatingMAC) BlockSize() int { return t.hmac.BlockSize() }
var macModes = map[string]*macMode{
+ "hmac-sha2-512-etm@openssh.com": {64, true, func(key []byte) hash.Hash {
+ return hmac.New(sha512.New, key)
+ }},
"hmac-sha2-256-etm@openssh.com": {32, true, func(key []byte) hash.Hash {
return hmac.New(sha256.New, key)
}},