@@ -161,6 +161,7 @@ func (s) TestClientOptionsConfigSuccessCases(t *testing.T) {
161161 MinVersion uint16
162162 MaxVersion uint16
163163 cipherSuites []uint16
164+ curvePreferences []tls.CurveID
164165 }{
165166 {
166167 desc : "Use system default if no fields in RootCertificateOptions is specified" ,
@@ -187,6 +188,13 @@ func (s) TestClientOptionsConfigSuccessCases(t *testing.T) {
187188 tls .TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA ,
188189 },
189190 },
191+ {
192+ desc : "CurvePreferences plumbing through client options" ,
193+ curvePreferences : []tls.CurveID {
194+ tls .X25519 ,
195+ tls .CurveP256 ,
196+ },
197+ },
190198 }
191199 for _ , test := range tests {
192200 test := test
@@ -198,6 +206,7 @@ func (s) TestClientOptionsConfigSuccessCases(t *testing.T) {
198206 MinTLSVersion : test .MinVersion ,
199207 MaxTLSVersion : test .MaxVersion ,
200208 CipherSuites : test .cipherSuites ,
209+ CurvePreferences : test .curvePreferences ,
201210 }
202211 clientConfig , err := clientOptions .clientConfig ()
203212 if err != nil {
@@ -232,6 +241,9 @@ func (s) TestClientOptionsConfigSuccessCases(t *testing.T) {
232241 if diff := cmp .Diff (clientConfig .CipherSuites , test .cipherSuites ); diff != "" {
233242 t .Errorf ("cipherSuites diff (-want +got):\n %s" , diff )
234243 }
244+ if diff := cmp .Diff (clientConfig .CurvePreferences , test .curvePreferences ); diff != "" {
245+ t .Errorf ("curvePreferences diff (-want +got):\n %s" , diff )
246+ }
235247 })
236248 }
237249}
@@ -317,6 +329,7 @@ func (s) TestServerOptionsConfigSuccessCases(t *testing.T) {
317329 MinVersion uint16
318330 MaxVersion uint16
319331 cipherSuites []uint16
332+ curvePreferences []tls.CurveID
320333 }{
321334 {
322335 desc : "Use system default if no fields in RootCertificateOptions is specified" ,
@@ -367,6 +380,19 @@ func (s) TestServerOptionsConfigSuccessCases(t *testing.T) {
367380 },
368381 MinVersion : tls .VersionTLS12 ,
369382 },
383+ {
384+ desc : "CurvePreferences plumbing through server options" ,
385+ IdentityOptions : IdentityCertificateOptions {
386+ Certificates : []tls.Certificate {},
387+ },
388+ RootOptions : RootCertificateOptions {
389+ RootCertificates : x509 .NewCertPool (),
390+ },
391+ curvePreferences : []tls.CurveID {
392+ tls .X25519 ,
393+ tls .CurveP256 ,
394+ },
395+ },
370396 }
371397 for _ , test := range tests {
372398 test := test
@@ -379,6 +405,7 @@ func (s) TestServerOptionsConfigSuccessCases(t *testing.T) {
379405 MinTLSVersion : test .MinVersion ,
380406 MaxTLSVersion : test .MaxVersion ,
381407 CipherSuites : test .cipherSuites ,
408+ CurvePreferences : test .curvePreferences ,
382409 }
383410 serverConfig , err := serverOptions .serverConfig ()
384411 if err != nil {
@@ -395,6 +422,9 @@ func (s) TestServerOptionsConfigSuccessCases(t *testing.T) {
395422 if diff := cmp .Diff (serverConfig .CipherSuites , test .cipherSuites ); diff != "" {
396423 t .Errorf ("cipherSuites diff (-want +got):\n %s" , diff )
397424 }
425+ if diff := cmp .Diff (serverConfig .CurvePreferences , test .curvePreferences ); diff != "" {
426+ t .Errorf ("curvePreferences diff (-want +got):\n %s" , diff )
427+ }
398428 })
399429 }
400430}
0 commit comments