Skip to content

Commit 2b41359

Browse files
committed
add ext-info-s to KEX algorithms only in the first key exchange
Signed-off-by: Nicola Murino <[email protected]>
1 parent 0196e38 commit 2b41359

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ssh/handshake.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,11 @@ func (t *handshakeTransport) sendKexInit() error {
479479
msg.ServerHostKeyAlgos = append(msg.ServerHostKeyAlgos, keyFormat)
480480
}
481481
}
482-
msg.KexAlgos = append(msg.KexAlgos, extInfoServer)
482+
if firstKeyExchange := t.sessionID == nil; firstKeyExchange {
483+
msg.KexAlgos = make([]string, 0, len(t.config.KeyExchanges)+1)
484+
msg.KexAlgos = append(msg.KexAlgos, t.config.KeyExchanges...)
485+
msg.KexAlgos = append(msg.KexAlgos, extInfoServer)
486+
}
483487
} else {
484488
msg.ServerHostKeyAlgos = t.hostKeyAlgorithms
485489

0 commit comments

Comments
 (0)