x/crypto/ssh/test: test all key exchanges against sshd.
Change-Id: I9d775d6e9c39bee1f2bf914ba3659acb6b0029dd Reviewed-on: https://go-review.googlesource.com/13591 Reviewed-by: Adam Langley <agl@golang.org>
This commit is contained in:
Родитель
173ce04bfa
Коммит
e3ebf1a8d3
|
@ -319,3 +319,22 @@ func TestMACs(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestKeyExchanges(t *testing.T) {
|
||||
var config ssh.Config
|
||||
config.SetDefaults()
|
||||
kexOrder := config.KeyExchanges
|
||||
for _, kex := range kexOrder {
|
||||
server := newServer(t)
|
||||
defer server.Shutdown()
|
||||
conf := clientConfig()
|
||||
// Don't fail if sshd doesnt have the kex.
|
||||
conf.KeyExchanges = append([]string{kex}, kexOrder...)
|
||||
conn, err := server.TryDial(conf)
|
||||
if err == nil {
|
||||
conn.Close()
|
||||
} else {
|
||||
t.Errorf("failed for kex %q", kex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче