Skip to content

Commit 603e3e6

Browse files
neildgopherbot
authored andcommitted
quic: disable X25519Kyber768Draft00 in tests
Enabling this bloats the TLS handshake so flights no longer fit in a single datagram. Disable it in tests. Add a test using the crypto/tls defaults, to ensure we do handshake properly with them. Fixes golang/go#67783 Change-Id: I521188e7b5a313e9289e726935e5b26994090b4a Reviewed-on: https://go-review.googlesource.com/c/net/+/589855 Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Filippo Valsorda <filippo@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 parent 67e8d0c commit 603e3e6

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

quic/endpoint_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ func TestConnect(t *testing.T) {
2323
newLocalConnPair(t, &Config{}, &Config{})
2424
}
2525

26+
func TestConnectDefaultTLSConfig(t *testing.T) {
27+
serverConfig := newTestTLSConfigWithMoreDefaults(serverSide)
28+
clientConfig := newTestTLSConfigWithMoreDefaults(clientSide)
29+
newLocalConnPair(t, &Config{TLSConfig: serverConfig}, &Config{TLSConfig: clientConfig})
30+
}
31+
2632
func TestStreamTransfer(t *testing.T) {
2733
ctx := context.Background()
2834
cli, srv := newLocalConnPair(t, &Config{}, &Config{})

quic/tlsconfig_test.go

+19
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,32 @@ func newTestTLSConfig(side connSide) *tls.Config {
2020
tls.TLS_CHACHA20_POLY1305_SHA256,
2121
},
2222
MinVersion: tls.VersionTLS13,
23+
// Default key exchange mechanisms as of Go 1.23 minus X25519Kyber768Draft00,
24+
// which bloats the client hello enough to spill into a second datagram.
25+
// Tests were written with the assuption each flight in the handshake
26+
// fits in one datagram, and it's simpler to keep that property.
27+
CurvePreferences: []tls.CurveID{
28+
tls.X25519, tls.CurveP256, tls.CurveP384, tls.CurveP521,
29+
},
2330
}
2431
if side == serverSide {
2532
config.Certificates = []tls.Certificate{testCert}
2633
}
2734
return config
2835
}
2936

37+
// newTestTLSConfigWithMoreDefaults returns a *tls.Config for testing
38+
// which behaves more like a default, empty config.
39+
//
40+
// In particular, it uses the default curve preferences, which can increase
41+
// the size of the handshake.
42+
func newTestTLSConfigWithMoreDefaults(side connSide) *tls.Config {
43+
config := newTestTLSConfig(side)
44+
config.CipherSuites = nil
45+
config.CurvePreferences = nil
46+
return config
47+
}
48+
3049
var testCert = func() tls.Certificate {
3150
cert, err := tls.X509KeyPair(localhostCert, localhostKey)
3251
if err != nil {

0 commit comments

Comments
 (0)