ssh: expose negotiated algorithms
Fixes golang/go#58523 Fixes golang/go#46638 Change-Id: Ic64bd2fdd6e9ec96acac3ed4be842e2fbb15231d Reviewed-on: https://go-review.googlesource.com/c/crypto/+/538235 Reviewed-by: Filippo Valsorda <filippo@golang.org> Auto-Submit: Nicola Murino <nicola.murino@gmail.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
committed by
Gopher Robot
parent
78a1fd7893
commit
e944286e33
+17
-17
@@ -51,33 +51,33 @@ func TestFindAgreedAlgorithms(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
initDirAlgs := func(a *directionAlgorithms) {
|
||||
initDirAlgs := func(a *DirectionAlgorithms) {
|
||||
if a.Cipher == "" {
|
||||
a.Cipher = "cipher1"
|
||||
}
|
||||
if a.MAC == "" {
|
||||
a.MAC = "mac1"
|
||||
}
|
||||
if a.Compression == "" {
|
||||
a.Compression = "compression1"
|
||||
if a.compression == "" {
|
||||
a.compression = "compression1"
|
||||
}
|
||||
}
|
||||
|
||||
initAlgs := func(a *algorithms) {
|
||||
if a.kex == "" {
|
||||
a.kex = "kex1"
|
||||
initAlgs := func(a *NegotiatedAlgorithms) {
|
||||
if a.KeyExchange == "" {
|
||||
a.KeyExchange = "kex1"
|
||||
}
|
||||
if a.hostKey == "" {
|
||||
a.hostKey = "hostkey1"
|
||||
if a.HostKey == "" {
|
||||
a.HostKey = "hostkey1"
|
||||
}
|
||||
initDirAlgs(&a.r)
|
||||
initDirAlgs(&a.w)
|
||||
initDirAlgs(&a.Read)
|
||||
initDirAlgs(&a.Write)
|
||||
}
|
||||
|
||||
type testcase struct {
|
||||
name string
|
||||
clientIn, serverIn kexInitMsg
|
||||
wantClient, wantServer algorithms
|
||||
wantClient, wantServer NegotiatedAlgorithms
|
||||
wantErr bool
|
||||
}
|
||||
|
||||
@@ -120,19 +120,19 @@ func TestFindAgreedAlgorithms(t *testing.T) {
|
||||
CiphersClientServer: []string{"cipher2", "cipher1"},
|
||||
CiphersServerClient: []string{"cipher3", "cipher2"},
|
||||
},
|
||||
wantClient: algorithms{
|
||||
r: directionAlgorithms{
|
||||
wantClient: NegotiatedAlgorithms{
|
||||
Read: DirectionAlgorithms{
|
||||
Cipher: "cipher3",
|
||||
},
|
||||
w: directionAlgorithms{
|
||||
Write: DirectionAlgorithms{
|
||||
Cipher: "cipher2",
|
||||
},
|
||||
},
|
||||
wantServer: algorithms{
|
||||
w: directionAlgorithms{
|
||||
wantServer: NegotiatedAlgorithms{
|
||||
Write: DirectionAlgorithms{
|
||||
Cipher: "cipher3",
|
||||
},
|
||||
r: directionAlgorithms{
|
||||
Read: DirectionAlgorithms{
|
||||
Cipher: "cipher2",
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user