@@ -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+
3049var testCert = func () tls.Certificate {
3150 cert , err := tls .X509KeyPair (localhostCert , localhostKey )
3251 if err != nil {
0 commit comments