@@ -457,6 +457,7 @@ func (t *handshakeTransport) sendKexInit() error {
457
457
io .ReadFull (rand .Reader , msg .Cookie [:])
458
458
459
459
isServer := len (t .hostKeys ) > 0
460
+ firstKeyExchange := t .sessionID == nil
460
461
if isServer {
461
462
for _ , k := range t .hostKeys {
462
463
// If k is an AlgorithmSigner, presume it supports all signature algorithms
@@ -475,7 +476,7 @@ func (t *handshakeTransport) sendKexInit() error {
475
476
msg .ServerHostKeyAlgos = append (msg .ServerHostKeyAlgos , keyFormat )
476
477
}
477
478
}
478
- if firstKeyExchange := t . sessionID == nil ; firstKeyExchange {
479
+ if firstKeyExchange {
479
480
msg .KexAlgos = make ([]string , 0 , len (t .config .KeyExchanges )+ 1 )
480
481
msg .KexAlgos = append (msg .KexAlgos , t .config .KeyExchanges ... )
481
482
msg .KexAlgos = append (msg .KexAlgos , extInfoServer )
@@ -486,7 +487,7 @@ func (t *handshakeTransport) sendKexInit() error {
486
487
// As a client we opt in to receiving SSH_MSG_EXT_INFO so we know what
487
488
// algorithms the server supports for public key authentication. See RFC
488
489
// 8308, Section 2.1.
489
- if firstKeyExchange := t . sessionID == nil ; firstKeyExchange {
490
+ if firstKeyExchange {
490
491
msg .KexAlgos = make ([]string , 0 , len (t .config .KeyExchanges )+ 1 )
491
492
msg .KexAlgos = append (msg .KexAlgos , t .config .KeyExchanges ... )
492
493
msg .KexAlgos = append (msg .KexAlgos , extInfoClient )
0 commit comments