Skip to content

Commit 987ccae

Browse files
committed
ssh: add hmac-sha2-512
This adds support for hmac-sha2-512 to ensure compatibility with SSH clients that request this MAC algorithm. This rebases #18.
1 parent 1622238 commit 987ccae

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

ssh/common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ var supportedHostKeyAlgos = []string{
8585
// This is based on RFC 4253, section 6.4, but with hmac-md5 variants removed
8686
// because they have reached the end of their useful life.
8787
var supportedMACs = []string{
88-
"hmac-sha2-512-etm@openssh.com", "hmac-sha2-256-etm@openssh.com", "hmac-sha2-256", "hmac-sha1", "hmac-sha1-96",
88+
"hmac-sha2-512-etm@openssh.com", "hmac-sha2-256-etm@openssh.com", "hmac-sha2-256", "hmac-sha2-512", "hmac-sha1", "hmac-sha1-96",
8989
}
9090

9191
var supportedCompressions = []string{compressionNone}

ssh/mac.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ var macModes = map[string]*macMode{
5353
"hmac-sha2-256-etm@openssh.com": {32, true, func(key []byte) hash.Hash {
5454
return hmac.New(sha256.New, key)
5555
}},
56+
"hmac-sha2-512": {64, false, func(key []byte) hash.Hash {
57+
return hmac.New(sha512.New, key)
58+
}},
5659
"hmac-sha2-256": {32, false, func(key []byte) hash.Hash {
5760
return hmac.New(sha256.New, key)
5861
}},

0 commit comments

Comments
 (0)