@@ -20,13 +20,32 @@ func newTestTLSConfig(side connSide) *tls.Config {
20
20
tls .TLS_CHACHA20_POLY1305_SHA256 ,
21
21
},
22
22
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
+ },
23
30
}
24
31
if side == serverSide {
25
32
config .Certificates = []tls.Certificate {testCert }
26
33
}
27
34
return config
28
35
}
29
36
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
+
30
49
var testCert = func () tls.Certificate {
31
50
cert , err := tls .X509KeyPair (localhostCert , localhostKey )
32
51
if err != nil {
0 commit comments