@@ -2231,8 +2231,8 @@ func TestMultipleHelloVerifyRequest(t *testing.T) {
22312231 cancel ()
22322232}
22332233
2234- // Assert that a DTLS Server always responds with RenegotiationInfo if
2235- // a ClientHello contained that extension or not .
2234+ // Assert that a DTLS Server only responds with RenegotiationInfo if a ClientHello contained that
2235+ // extension according to RFC5746 section 3.6, RFC5246 section 7.4.1.4 and RFC5746 section 4.2 .
22362236func TestRenegotationInfo (t * testing.T ) { //nolint:cyclop
22372237 // Limit runtime in case of deadlocks
22382238 lim := test .TimeOut (10 * time .Second )
@@ -2245,8 +2245,8 @@ func TestRenegotationInfo(t *testing.T) { //nolint:cyclop
22452245 resp := make ([]byte , 1024 )
22462246
22472247 for _ , testCase := range []struct {
2248- Name string
2249- SendRenegotiationInfo bool
2248+ Name string
2249+ ExpectRenegotiationInfo bool
22502250 }{
22512251 {
22522252 "Include RenegotiationInfo" ,
@@ -2281,7 +2281,7 @@ func TestRenegotationInfo(t *testing.T) { //nolint:cyclop
22812281 time .Sleep (50 * time .Millisecond )
22822282
22832283 extensions := []extension.Extension {}
2284- if test .SendRenegotiationInfo {
2284+ if test .ExpectRenegotiationInfo {
22852285 extensions = append (extensions , & extension.RenegotiationInfo {
22862286 RenegotiatedConnection : 0 ,
22872287 })
@@ -2311,14 +2311,16 @@ func TestRenegotationInfo(t *testing.T) { //nolint:cyclop
23112311 serverHello , ok := record .Content .(* handshake.Handshake ).Message .(* handshake.MessageServerHello )
23122312 assert .True (t , ok )
23132313
2314- gotNegotationInfo := false
2314+ actualNegotationInfo := false
23152315 for _ , v := range serverHello .Extensions {
23162316 if _ , ok := v .(* extension.RenegotiationInfo ); ok {
2317- gotNegotationInfo = true
2317+ actualNegotationInfo = true
23182318 }
23192319 }
23202320
2321- assert .True (t , gotNegotationInfo , "Expected RenegotiationInfo extension in ServerHello" )
2321+ assert .True (t , test .ExpectRenegotiationInfo == actualNegotationInfo ,
2322+ "NegotationInfo state in ServerHello is incorrect: expected(%t) actual(%t)" ,
2323+ test .ExpectRenegotiationInfo , actualNegotationInfo )
23222324 })
23232325 }
23242326}
0 commit comments