Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions pkg/tlsconfig/tlsopt.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ import (
// Cipher suites are IANA names (comma-separated).
// Curve preferences are numeric CurveID values (comma-separated).
// Min version is a Go TLS version string (e.g. "VersionTLS12").
//
// Returns an error if cipher suites are specified with TLS 1.3 minimum,
// since Go's TLS 1.3 does not allow configuring cipher suites.
func OptFor(cipherSuites, curvePreferences, minVersion string) (func(*tls.Config), error) {
ciphers, err := parseCipherSuites(cipherSuites)
if err != nil {
Expand All @@ -32,9 +29,6 @@ func OptFor(cipherSuites, curvePreferences, minVersion string) (func(*tls.Config
if err != nil {
return nil, fmt.Errorf("parsing tls-min-version: %w", err)
}
if ciphers != nil && minVer == tls.VersionTLS13 {
return nil, fmt.Errorf("cipher suites cannot be configured with TLS 1.3")
}
return func(cfg *tls.Config) {
if ciphers != nil {
cfg.CipherSuites = ciphers
Expand Down
9 changes: 5 additions & 4 deletions pkg/tlsconfig/tlsopt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,11 @@ func TestOptFor(t *testing.T) {
wantMinVersion: tls.VersionTLS13,
},
{
name: "rejects cipher suites with TLS 1.3",
cipherSuites: "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
minVersion: "VersionTLS13",
wantErrMsg: "cipher suites cannot be configured with TLS 1.3",
name: "TLS 1.3 with ciphers passes through",
cipherSuites: "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
minVersion: "VersionTLS13",
wantCipherSuites: []uint16{tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256},
wantMinVersion: tls.VersionTLS13,
},
{
name: "invalid cipher returns error",
Expand Down