Skip to content

Commit 9bcac6a

Browse files
committed
crypto: support ECDHE when ec_point_formats is missing in ClientHello
As describe in rfc8422 5.1.2, we will support ECDHE in the case client does not include ec_point_formats extension in ClientHello extension. This make sure ECDHE will work with (uncompressed point format is listed explicitly) or without extension. rfc8422 5.1.2: https://datatracker.ietf.org/doc/html/rfc8422#section-5.1.2. Fixes #49126
1 parent ae4d67c commit 9bcac6a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/crypto/tls/handshake_server.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,9 @@ func supportsECDHE(c *Config, supportedCurves []CurveID, supportedPoints []uint8
314314
}
315315
}
316316

317-
supportsPointFormat := false
317+
// RFC 8422, Section 5.1.2
318+
// If this extension is missing, it means that only the uncompressed point format is supported
319+
supportsPointFormat := len(supportedPoints) == 0
318320
for _, pointFormat := range supportedPoints {
319321
if pointFormat == pointFormatUncompressed {
320322
supportsPointFormat = true

src/crypto/tls/handshake_server_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ func TestTLS12OnlyCipherSuites(t *testing.T) {
280280
}
281281

282282
func TestTLSPointFormats(t *testing.T) {
283-
// Test that a Server returns the ec_point_format extension when ECC is
283+
// Test that a Server returns the ec_point_formats extension when ECC is
284284
// negotiated, and not returned on RSA handshake.
285285
tests := []struct {
286286
name string
@@ -290,6 +290,7 @@ func TestTLSPointFormats(t *testing.T) {
290290
wantSupportedPoints bool
291291
}{
292292
{"ECC", []uint16{TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA}, []CurveID{CurveP256}, []uint8{compressionNone}, true},
293+
{"ECC without ec_point_formats", []uint16{TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA}, []CurveID{CurveP256}, []uint8{}, true},
293294
{"RSA", []uint16{TLS_RSA_WITH_AES_256_GCM_SHA384}, nil, nil, false},
294295
}
295296
for _, tt := range tests {

0 commit comments

Comments
 (0)