runner: Remove need for an AllCurves value
Among other things, this shortcut meant that every curve test explicitly
configures every other curve, but only the curve under test needs to be
configured.
Change-Id: If21dcd997c78c6a02dab30aa16259c60ea7f479b
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/81347
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Lily Chen <chlily@google.com>
Commit-Queue: Lily Chen <chlily@google.com>
diff --git a/ssl/test/runner/curve_tests.go b/ssl/test/runner/curve_tests.go
index 099bb2a..3ccf16a 100644
--- a/ssl/test/runner/curve_tests.go
+++ b/ssl/test/runner/curve_tests.go
@@ -59,6 +59,8 @@
TLS_AES_256_GCM_SHA384,
}
+ // Not all curves are enabled by default, so these tests explicitly enable
+ // the curve under test in the shim.
for _, curve := range testCurves {
for _, ver := range tlsVersions {
if isPqGroup(curve.id) && ver.version < VersionTLS13 {
@@ -77,7 +79,7 @@
},
flags: append(
[]string{"-expect-curve-id", strconv.Itoa(int(curve.id))},
- flagInts("-curves", shimConfig.AllCurves)...,
+ flagCurves("-curves", []CurveID{curve.id})...,
),
expectations: connectionExpectations{
curveID: curve.id,
@@ -104,7 +106,7 @@
TruncateKeyShare: true,
},
},
- flags: flagInts("-curves", shimConfig.AllCurves),
+ flags: flagCurves("-curves", []CurveID{curve.id}),
shouldFail: true,
expectedError: ":BAD_ECPOINT:",
expectedLocalError: badKeyShareLocalError,
@@ -121,7 +123,7 @@
PadKeyShare: true,
},
},
- flags: flagInts("-curves", shimConfig.AllCurves),
+ flags: flagCurves("-curves", []CurveID{curve.id}),
shouldFail: true,
expectedError: ":BAD_ECPOINT:",
expectedLocalError: badKeyShareLocalError,
@@ -139,7 +141,7 @@
SendCompressedCoordinates: true,
},
},
- flags: flagInts("-curves", shimConfig.AllCurves),
+ flags: flagCurves("-curves", []CurveID{curve.id}),
shouldFail: true,
expectedError: ":BAD_ECPOINT:",
expectedLocalError: badKeyShareLocalError,
@@ -155,7 +157,7 @@
ECDHPointNotOnCurve: true,
},
},
- flags: flagInts("-curves", shimConfig.AllCurves),
+ flags: flagCurves("-curves", []CurveID{curve.id}),
shouldFail: true,
expectedError: ":BAD_ECPOINT:",
expectedLocalError: badKeyShareLocalError,
@@ -175,7 +177,7 @@
SetX25519HighBit: true,
},
},
- flags: flagInts("-curves", shimConfig.AllCurves),
+ flags: flagCurves("-curves", []CurveID{curve.id}),
expectations: connectionExpectations{
curveID: curve.id,
},
@@ -193,7 +195,7 @@
LowOrderX25519Point: true,
},
},
- flags: flagInts("-curves", shimConfig.AllCurves),
+ flags: flagCurves("-curves", []CurveID{curve.id}),
shouldFail: true,
expectedError: ":BAD_ECPOINT:",
expectedLocalError: badKeyShareLocalError,
@@ -212,7 +214,7 @@
MLKEMEncapKeyNotReduced: true,
},
},
- flags: flagInts("-curves", shimConfig.AllCurves),
+ flags: flagCurves("-curves", []CurveID{curve.id}),
shouldFail: true,
expectedError: ":BAD_ECPOINT:",
expectedLocalError: badKeyShareLocalError,
diff --git a/ssl/test/runner/runner.go b/ssl/test/runner/runner.go
index ca6ac7d..d9a863a 100644
--- a/ssl/test/runner/runner.go
+++ b/ssl/test/runner/runner.go
@@ -97,11 +97,6 @@
// expect before half-RTT data when testing 0-RTT.
HalfRTTTickets int
- // AllCurves is the list of all curve code points supported by the shim.
- // This is currently used to control tests that enable all curves but may
- // automatically disable tests in the future.
- AllCurves []int
-
// MaxACKBuffer is the maximum number of received records the shim is
// expected to retain when ACKing.
MaxACKBuffer int
@@ -294,6 +289,14 @@
return ret
}
+func flagCurves(flagName string, vals []CurveID) []string {
+ ret := make([]string, 0, 2*len(vals))
+ for _, val := range vals {
+ ret = append(ret, flagName, strconv.Itoa(int(val)))
+ }
+ return ret
+}
+
func base64FlagValue(in []byte) string {
return base64.StdEncoding.EncodeToString(in)
}
@@ -2191,12 +2194,6 @@
}
}
- if shimConfig.AllCurves == nil {
- for _, curve := range testCurves {
- shimConfig.AllCurves = append(shimConfig.AllCurves, int(curve.id))
- }
- }
-
addBasicTests()
addCipherSuiteTests()
addBadECDSASignatureTests()