ssh: support chacha20-poly1305 cipher

chacha20-poly1305 is an AEAD which performs well without hardware
support. It is recommended as a replacement for the aging arcfour128
and arcfour256 ciphers.

Fixes golang/go#9489

Change-Id: I5d5a4620a435e65997f0ba7e683a34c29d9a396b
Reviewed-on: https://go-review.googlesource.com/87077
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Han-Wen Nienhuys
2018-01-19 07:46:36 +00:00
parent 13931e22f9
commit ee41a25c63
3 changed files with 153 additions and 11 deletions
+6 -7
View File
@@ -254,15 +254,14 @@ func generateKeys(d direction, algs directionAlgorithms, kex *kexResult) (iv, ke
func newPacketCipher(d direction, algs directionAlgorithms, kex *kexResult) (packetCipher, error) {
iv, key, macKey := generateKeys(d, algs, kex)
if algs.Cipher == gcmCipherID {
switch algs.Cipher {
case chacha20Poly1305ID:
return newChaCha20Cipher(key)
case gcmCipherID:
return newGCMCipher(iv, key)
}
if algs.Cipher == aes128cbcID {
case aes128cbcID:
return newAESCBCCipher(iv, key, macKey, algs)
}
if algs.Cipher == tripledescbcID {
case tripledescbcID:
return newTripleDESCBCCipher(iv, key, macKey, algs)
}