@@ -281,16 +281,19 @@ func TestTLS12OnlyCipherSuites(t *testing.T) {
281
281
282
282
func TestTLSPointFormats (t * testing.T ) {
283
283
// Test that a Server returns the ec_point_format extension when ECC is
284
- // negotiated, and not returned on RSA handshake.
284
+ // negotiated, and not on a RSA handshake or if ec_point_format is missing .
285
285
tests := []struct {
286
286
name string
287
287
cipherSuites []uint16
288
288
supportedCurves []CurveID
289
289
supportedPoints []uint8
290
290
wantSupportedPoints bool
291
291
}{
292
- {"ECC" , []uint16 {TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA }, []CurveID {CurveP256 }, []uint8 {compressionNone }, true },
292
+ {"ECC" , []uint16 {TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA }, []CurveID {CurveP256 }, []uint8 {pointFormatUncompressed }, true },
293
+ {"ECC without ec_point_format" , []uint16 {TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA }, []CurveID {CurveP256 }, nil , false },
294
+ {"ECC with extra values" , []uint16 {TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA }, []CurveID {CurveP256 }, []uint8 {13 , 37 , pointFormatUncompressed , 42 }, true },
293
295
{"RSA" , []uint16 {TLS_RSA_WITH_AES_256_GCM_SHA384 }, nil , nil , false },
296
+ {"RSA with ec_point_format" , []uint16 {TLS_RSA_WITH_AES_256_GCM_SHA384 }, nil , []uint8 {pointFormatUncompressed }, false },
294
297
}
295
298
for _ , tt := range tests {
296
299
t .Run (tt .name , func (t * testing.T ) {
@@ -330,18 +333,8 @@ func TestTLSPointFormats(t *testing.T) {
330
333
t .Fatalf ("didn't get ServerHello message in reply. Got %v\n " , reply )
331
334
}
332
335
if tt .wantSupportedPoints {
333
- if len (serverHello .supportedPoints ) < 1 {
334
- t .Fatal ("missing ec_point_format extension from server" )
335
- }
336
- found := false
337
- for _ , p := range serverHello .supportedPoints {
338
- if p == pointFormatUncompressed {
339
- found = true
340
- break
341
- }
342
- }
343
- if ! found {
344
- t .Fatal ("missing uncompressed format in ec_point_format extension from server" )
336
+ if ! bytes .Equal (serverHello .supportedPoints , []uint8 {pointFormatUncompressed }) {
337
+ t .Fatal ("incorrect ec_point_format extension from server" )
345
338
}
346
339
} else {
347
340
if len (serverHello .supportedPoints ) != 0 {
0 commit comments