@@ -764,7 +764,7 @@ private async ValueTask<bool> HandleClientHello(PeerData peer, IPEndPoint peerAd
764764 }
765765
766766 // Find an acceptable cipher suite we can use
767- var selectedCipherSuite = CipherSuite . TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 ;
767+ const CipherSuite selectedCipherSuite = CipherSuite . TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 ;
768768 if ( ! clientHello . ContainsCipherSuite ( CipherSuite . TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 ) ||
769769 ! clientHello . ContainsCurve ( NamedCurve . x25519 ) )
770770 {
@@ -787,7 +787,7 @@ private async ValueTask<bool> HandleClientHello(PeerData peer, IPEndPoint peerAd
787787 recordProtection = peer . CurrentEpoch . RecordProtection ;
788788 }
789789
790- await SendHelloVerifyRequest ( peerAddress , outgoingSequence , record . Epoch , recordProtection ) ;
790+ await SendHelloVerifyRequest ( peerAddress , outgoingSequence , record . Epoch , recordProtection , peer . ProtocolVersion ) ;
791791 return true ;
792792 }
793793
@@ -1132,7 +1132,7 @@ private async ValueTask HandleNonPeerRecord(ByteSpan message, IPEndPoint peerAdd
11321132 if ( ! HelloVerifyRequest . VerifyCookie ( clientHello . Cookie , peerAddress , currentCookieHmac ) )
11331133 if ( ! HelloVerifyRequest . VerifyCookie ( clientHello . Cookie , peerAddress , previousCookieHmac ) )
11341134 {
1135- await SendHelloVerifyRequest ( peerAddress , 1 , 0 , NullRecordProtection . Instance ) ;
1135+ await SendHelloVerifyRequest ( peerAddress , 1 , 0 , NullRecordProtection . Instance , clientHello . ClientProtocolVersion ) ;
11361136 return ;
11371137 }
11381138
@@ -1151,7 +1151,7 @@ private async ValueTask HandleNonPeerRecord(ByteSpan message, IPEndPoint peerAdd
11511151
11521152 //Send a HelloVerifyRequest handshake message to a peer
11531153 private ValueTask SendHelloVerifyRequest ( IPEndPoint peerAddress , ulong recordSequence , ushort epoch ,
1154- IRecordProtection recordProtection )
1154+ IRecordProtection recordProtection , ProtocolVersion protocolVersion )
11551155 {
11561156 // Do we need to rotate the HMAC key?
11571157 var now = DateTime . UtcNow ;
@@ -1177,6 +1177,7 @@ private ValueTask SendHelloVerifyRequest(IPEndPoint peerAddress, ulong recordSeq
11771177 var record = new Record
11781178 {
11791179 ContentType = ContentType . Handshake ,
1180+ ProtocolVersion = protocolVersion ,
11801181 Epoch = epoch ,
11811182 SequenceNumber = recordSequence ,
11821183 Length = ( ushort ) recordProtection . GetEncryptedSize ( plaintextPayloadSize )
@@ -1189,7 +1190,7 @@ private ValueTask SendHelloVerifyRequest(IPEndPoint peerAddress, ulong recordSeq
11891190 writer = writer [ Record . Size ..] ;
11901191 handshake . Encode ( writer ) ;
11911192 writer = writer [ Handshake . Handshake . Size ..] ;
1192- HelloVerifyRequest . Encode ( writer , peerAddress , currentCookieHmac ) ;
1193+ HelloVerifyRequest . Encode ( writer , peerAddress , currentCookieHmac , protocolVersion ) ;
11931194
11941195 // Protect record payload
11951196 recordProtection . EncryptServerPlaintext (
0 commit comments