@@ -157,6 +157,31 @@ const (
157157 TLSProfileCustomType TLSProfileType = "Custom"
158158)
159159
160+ // TLSCurve is a named curve identifier that can be used in TLSProfile.Curves.
161+ // There is a one-to-one mapping between these names and the curve IDs defined
162+ // in crypto/tls package based on IANA's "TLS Supported Groups" registry:
163+ // https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8
164+ //
165+ // +kubebuilder:validation:Enum=X25519;P-256;P-384;P-521;X25519MLKEM768
166+ type TLSCurve string
167+
168+ const (
169+ // TLSCurveX25519 represents X25519.
170+ TLSCurveX25519 TLSCurve = "X25519"
171+ // TLSCurveP256 represents P-256 (secp256r1).
172+ TLSCurveP256 TLSCurve = "P-256"
173+ // TLSCurveP384 represents P-384 (secp384r1).
174+ TLSCurveP384 TLSCurve = "P-384"
175+ // TLSCurveP521 represents P-521 (secp521r1).
176+ TLSCurveP521 TLSCurve = "P-521"
177+ // TLSCurveX25519MLKEM768 represents X25519MLKEM768.
178+ TLSCurveX25519MLKEM768 TLSCurve = "X25519MLKEM768"
179+ // TLSCurveP256r1MLKEM1024 represents P256r1MLKEM1024 (secp256r1MLKEM1024).
180+ TLSCurveP256r1MLKEM768 TLSCurve = "P256r1MLKEM768"
181+ // TLSCurveP384r1MLKEM1024 represents P384r1MLKEM1024 (secp384r1MLKEM1024).
182+ TLSCurveP384r1MLKEM1024 TLSCurve = "P384r1MLKEM1024"
183+ )
184+
160185// TLSProfileSpec is the desired behavior of a TLSSecurityProfile.
161186type TLSProfileSpec struct {
162187 // ciphers is used to specify the cipher algorithms that are negotiated
@@ -168,6 +193,38 @@ type TLSProfileSpec struct {
168193 //
169194 // +listType=atomic
170195 Ciphers []string `json:"ciphers"`
196+ // curves is used to specify the elliptic curves that are used during
197+ // the TLS handshake. Operators may remove entries their operands do
198+ // not support.
199+ //
200+ // TLSProfiles Old, Intermediate, Modern are including by default the following
201+ // curves: X25519, P-256, P-384, P-521, X25519MLKEM768, SecP256r1MLKEM1024, SecP384r1MLKEM1024.
202+ // TLSProfiles Custom do not include any curves by default.
203+ // NOTE: since this field is optional, if no curves are specified, the default curves
204+ // used by the underlying TLS library will be used.
205+ //
206+ // For example, to use X25519 and P-256 (yaml):
207+ //
208+ // # Example: Force PQC-only encryption
209+ // apiVersion: config.openshift.io/v1
210+ // kind: APIServer
211+ // spec:
212+ // tlsSecurityProfile:
213+ // type: Custom
214+ // custom:
215+ // ciphers:
216+ // - TLS_AES_128_GCM_SHA256
217+ // - TLS_AES_256_GCM_SHA384
218+ // - TLS_CHACHA20_POLY1305_SHA256
219+ // curves:
220+ // - X25519MLKEM768 # PQC-only: only hybrid quantum-resistant curve
221+ // minTLSVersion: VersionTLS13
222+ //
223+ // +optional
224+ // +listType=set
225+ // +kubebuilder:validation:MaxItems=5
226+ // +openshift:enable:FeatureGate=TLSCurvesConfiguration
227+ Curves []TLSCurve `json:"curves,omitempty"`
171228 // minTLSVersion is used to specify the minimal version of the TLS protocol
172229 // that is negotiated during the TLS handshake. For example, to use TLS
173230 // versions 1.1, 1.2 and 1.3 (yaml):
@@ -241,6 +298,12 @@ var TLSProfiles = map[TLSProfileType]*TLSProfileSpec{
241298 "AES256-SHA" ,
242299 "DES-CBC3-SHA" ,
243300 },
301+ Curves : []TLSCurve {
302+ TLSCurveX25519 ,
303+ TLSCurveP256 ,
304+ TLSCurveP384 ,
305+ TLSCurveX25519MLKEM768 ,
306+ },
244307 MinTLSVersion : VersionTLS10 ,
245308 },
246309 TLSProfileIntermediateType : {
@@ -257,6 +320,12 @@ var TLSProfiles = map[TLSProfileType]*TLSProfileSpec{
257320 "DHE-RSA-AES128-GCM-SHA256" ,
258321 "DHE-RSA-AES256-GCM-SHA384" ,
259322 },
323+ Curves : []TLSCurve {
324+ TLSCurveX25519 ,
325+ TLSCurveP256 ,
326+ TLSCurveP384 ,
327+ TLSCurveX25519MLKEM768 ,
328+ },
260329 MinTLSVersion : VersionTLS12 ,
261330 },
262331 TLSProfileModernType : {
@@ -265,6 +334,12 @@ var TLSProfiles = map[TLSProfileType]*TLSProfileSpec{
265334 "TLS_AES_256_GCM_SHA384" ,
266335 "TLS_CHACHA20_POLY1305_SHA256" ,
267336 },
337+ Curves : []TLSCurve {
338+ TLSCurveX25519 ,
339+ TLSCurveP256 ,
340+ TLSCurveP384 ,
341+ TLSCurveX25519MLKEM768 ,
342+ },
268343 MinTLSVersion : VersionTLS13 ,
269344 },
270345}
0 commit comments