Skip to content

Commit ebe9262

Browse files
drakkangopherbot
authored andcommitted
ssh: add support for [email protected]
Change-Id: I91caf3bda3dfd00c050f5ebf23c2a35a04c5762b GitHub-Last-Rev: 6e71340 GitHub-Pull-Request: #127 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/223518 Auto-Submit: Filippo Valsorda <[email protected]> Run-TryBot: Filippo Valsorda <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Roland Shoemaker <[email protected]> Reviewed-by: Filippo Valsorda <[email protected]> Reviewed-by: Han-Wen Nienhuys <[email protected]>
1 parent a9f661c commit ebe9262

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

ssh/cipher.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ var cipherModes = map[string]*cipherMode{
114114
"arcfour": {16, 0, streamCipherMode(0, newRC4)},
115115

116116
// AEAD ciphers
117-
gcmCipherID: {16, 12, newGCMCipher},
117+
gcm128CipherID: {16, 12, newGCMCipher},
118+
gcm256CipherID: {32, 12, newGCMCipher},
118119
chacha20Poly1305ID: {64, 0, newChaCha20Cipher},
119120

120121
// CBC mode is insecure and so is not included in the default config.

ssh/cipher_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func TestCVE202143565(t *testing.T) {
141141
constructPacket func(packetCipher) io.Reader
142142
}{
143143
{
144-
cipher: gcmCipherID,
144+
cipher: gcm128CipherID,
145145
constructPacket: func(client packetCipher) io.Reader {
146146
internalCipher := client.(*gcmCipher)
147147
b := &bytes.Buffer{}

ssh/common.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const (
2828
// supportedCiphers lists ciphers we support but might not recommend.
2929
var supportedCiphers = []string{
3030
"aes128-ctr", "aes192-ctr", "aes256-ctr",
31-
31+
"[email protected]", gcm256CipherID,
3232
chacha20Poly1305ID,
3333
"arcfour256", "arcfour128", "arcfour",
3434
aes128cbcID,
@@ -37,7 +37,7 @@ var supportedCiphers = []string{
3737

3838
// preferredCiphers specifies the default preference for ciphers.
3939
var preferredCiphers = []string{
40-
40+
"[email protected]", gcm256CipherID,
4141
chacha20Poly1305ID,
4242
"aes128-ctr", "aes192-ctr", "aes256-ctr",
4343
}
@@ -168,7 +168,7 @@ func (a *directionAlgorithms) rekeyBytes() int64 {
168168
// 2^(BLOCKSIZE/4) blocks. For all AES flavors BLOCKSIZE is
169169
// 128.
170170
switch a.Cipher {
171-
case "aes128-ctr", "aes192-ctr", "aes256-ctr", gcmCipherID, aes128cbcID:
171+
case "aes128-ctr", "aes192-ctr", "aes256-ctr", gcm128CipherID, gcm256CipherID, aes128cbcID:
172172
return 16 * (1 << 32)
173173

174174
}
@@ -178,7 +178,8 @@ func (a *directionAlgorithms) rekeyBytes() int64 {
178178
}
179179

180180
var aeadCiphers = map[string]bool{
181-
gcmCipherID: true,
181+
gcm128CipherID: true,
182+
gcm256CipherID: true,
182183
chacha20Poly1305ID: true,
183184
}
184185

ssh/handshake_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ func TestHandshakeRekeyDefault(t *testing.T) {
562562
}
563563

564564
func TestHandshakeAEADCipherNoMAC(t *testing.T) {
565-
for _, cipher := range []string{chacha20Poly1305ID, gcmCipherID} {
565+
for _, cipher := range []string{chacha20Poly1305ID, gcm128CipherID} {
566566
checker := &syncChecker{
567567
called: make(chan int, 1),
568568
}

ssh/transport.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import (
1717
const debugTransport = false
1818

1919
const (
20-
gcmCipherID = "[email protected]"
20+
gcm128CipherID = "[email protected]"
21+
gcm256CipherID = "[email protected]"
2122
aes128cbcID = "aes128-cbc"
2223
tripledescbcID = "3des-cbc"
2324
)

0 commit comments

Comments
 (0)