@@ -281,7 +281,18 @@ func testServer(
281281 return conn , conn .HandshakeContext (ctx )
282282}
283283
284- func sendClientHello (cookie []byte , ca net.Conn , sequenceNumber uint64 , extensions []extension.Extension ) error {
284+ func sendClientHello (
285+ cookie []byte ,
286+ ca net.Conn ,
287+ sequenceNumber uint64 ,
288+ extensions []extension.Extension ,
289+ cipherSuiteIDsOverride ... uint16 ,
290+ ) error {
291+ cipherSuites := cipherSuiteIDsOverride
292+ if len (cipherSuites ) == 0 {
293+ cipherSuites = cipherSuiteIDs (defaultCipherSuites ())
294+ }
295+
285296 packet , err := (& recordlayer.RecordLayer {
286297 Header : recordlayer.Header {
287298 Version : protocol .Version1_2 ,
@@ -294,7 +305,7 @@ func sendClientHello(cookie []byte, ca net.Conn, sequenceNumber uint64, extensio
294305 Message : & handshake.MessageClientHello {
295306 Version : protocol .Version1_2 ,
296307 Cookie : cookie ,
297- CipherSuiteIDs : cipherSuiteIDs ( defaultCipherSuites ()) ,
308+ CipherSuiteIDs : cipherSuites ,
298309 CompressionMethods : defaultCompressionMethods (),
299310 Extensions : extensions ,
300311 },
@@ -2328,16 +2339,24 @@ func TestRenegotationInfo(t *testing.T) { //nolint:cyclop
23282339 resp := make ([]byte , 1024 )
23292340
23302341 for _ , testCase := range []struct {
2331- Name string
2332- ExpectRenegotiationInfo bool
2342+ Name string
2343+ ExpectRenegotiationInfo bool
2344+ SendRenegotiationInfoExt bool
2345+ IncludeRenegotiationSCSV bool
23332346 }{
23342347 {
2335- "Include RenegotiationInfo" ,
2336- true ,
2348+ Name : "Include RenegotiationInfo" ,
2349+ ExpectRenegotiationInfo : true ,
2350+ SendRenegotiationInfoExt : true ,
23372351 },
23382352 {
2339- "No RenegotiationInfo" ,
2340- false ,
2353+ Name : "RenegotiationInfo SCSV" ,
2354+ ExpectRenegotiationInfo : true ,
2355+ IncludeRenegotiationSCSV : true ,
2356+ },
2357+ {
2358+ Name : "No RenegotiationInfo" ,
2359+ ExpectRenegotiationInfo : false ,
23412360 },
23422361 } {
23432362 test := testCase
@@ -2364,12 +2383,16 @@ func TestRenegotationInfo(t *testing.T) { //nolint:cyclop
23642383 time .Sleep (50 * time .Millisecond )
23652384
23662385 extensions := []extension.Extension {}
2367- if test .ExpectRenegotiationInfo {
2386+ if test .SendRenegotiationInfoExt {
23682387 extensions = append (extensions , & extension.RenegotiationInfo {
23692388 RenegotiatedConnection : 0 ,
23702389 })
23712390 }
2372- err := sendClientHello ([]byte {}, ca , 0 , extensions )
2391+ cipherSuites := cipherSuiteIDs (defaultCipherSuites ())
2392+ if test .IncludeRenegotiationSCSV {
2393+ cipherSuites = append (cipherSuites , renegotiationInfoSCSV )
2394+ }
2395+ err := sendClientHello ([]byte {}, ca , 0 , extensions , cipherSuites ... )
23732396 assert .NoError (t , err )
23742397
23752398 n , err := ca .Read (resp )
@@ -2381,7 +2404,7 @@ func TestRenegotationInfo(t *testing.T) { //nolint:cyclop
23812404 helloVerifyRequest , ok := record .Content .(* handshake.Handshake ).Message .(* handshake.MessageHelloVerifyRequest )
23822405 assert .True (t , ok )
23832406
2384- err = sendClientHello (helloVerifyRequest .Cookie , ca , 1 , extensions )
2407+ err = sendClientHello (helloVerifyRequest .Cookie , ca , 1 , extensions , cipherSuites ... )
23852408 assert .NoError (t , err )
23862409
23872410 n , err = ca .Read (resp )
0 commit comments