From 285fb2ed20d1dc450fc743a1b3ff7c36bef372b9 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 26 Apr 2016 14:32:32 +0200 Subject: [PATCH] x/crypto/ssh: fix subsequent key exchanges. In https://go-review.googlesource.com/#/c/21606/ , kexResult.SessionID was erroneously not set for all but the first key exchange. The unittests did not catch this, as server and client make the same mistake, but OpenSSH notices corrupted data and kills the connection. Fixes #15445. Change-Id: If98249b37d81efaa2ebefc836df0b150feba1256 Reviewed-on: https://go-review.googlesource.com/22418 Reviewed-by: Adam Langley Run-TryBot: Han-Wen Nienhuys TryBot-Result: Gobot Gobot --- ssh/handshake.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssh/handshake.go b/ssh/handshake.go index 08abd66..8854274 100644 --- a/ssh/handshake.go +++ b/ssh/handshake.go @@ -370,8 +370,8 @@ func (t *handshakeTransport) enterKeyExchangeLocked(otherInitPacket []byte) erro if t.sessionID == nil { t.sessionID = result.H - result.SessionID = result.H } + result.SessionID = t.sessionID t.conn.prepareKeyChange(algs, result) if err = t.conn.writePacket([]byte{msgNewKeys}); err != nil {