@@ -202,6 +202,31 @@ const (
202202 TLSProfileCustomType TLSProfileType = "Custom"
203203)
204204
205+ // TLSCurve is a named curve identifier that can be used in TLSProfile.Curves.
206+ // There is a one-to-one mapping between these names and the curve IDs defined
207+ // in crypto/tls package based on IANA's "TLS Supported Groups" registry:
208+ // https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8
209+ //
210+ // +kubebuilder:validation:Enum=X25519;P-256;P-384;P-521;X25519MLKEM768
211+ type TLSCurve string
212+
213+ const (
214+ // TLSCurveX25519 represents X25519.
215+ TLSCurveX25519 TLSCurve = "X25519"
216+ // TLSCurveP256 represents P-256 (secp256r1).
217+ TLSCurveP256 TLSCurve = "P-256"
218+ // TLSCurveP384 represents P-384 (secp384r1).
219+ TLSCurveP384 TLSCurve = "P-384"
220+ // TLSCurveP521 represents P-521 (secp521r1).
221+ TLSCurveP521 TLSCurve = "P-521"
222+ // TLSCurveX25519MLKEM768 represents X25519MLKEM768.
223+ TLSCurveX25519MLKEM768 TLSCurve = "X25519MLKEM768"
224+ // TLSCurveP256r1MLKEM1024 represents P256r1MLKEM1024 (secp256r1MLKEM1024).
225+ TLSCurveP256r1MLKEM768 TLSCurve = "P256r1MLKEM768"
226+ // TLSCurveP384r1MLKEM1024 represents P384r1MLKEM1024 (secp384r1MLKEM1024).
227+ TLSCurveP384r1MLKEM1024 TLSCurve = "P384r1MLKEM1024"
228+ )
229+
205230// TLSProfileSpec is the desired behavior of a TLSSecurityProfile.
206231type TLSProfileSpec struct {
207232 // ciphers is used to specify the cipher algorithms that are negotiated
@@ -213,6 +238,38 @@ type TLSProfileSpec struct {
213238 //
214239 // +listType=atomic
215240 Ciphers []string `json:"ciphers"`
241+ // curves is used to specify the elliptic curves that are used during
242+ // the TLS handshake. Operators may remove entries their operands do
243+ // not support.
244+ //
245+ // TLSProfiles Old, Intermediate, Modern are including by default the following
246+ // curves: X25519, P-256, P-384, P-521, X25519MLKEM768, SecP256r1MLKEM1024, SecP384r1MLKEM1024.
247+ // TLSProfiles Custom do not include any curves by default.
248+ // NOTE: since this field is optional, if no curves are specified, the default curves
249+ // used by the underlying TLS library will be used.
250+ //
251+ // For example, to use X25519 and P-256 (yaml):
252+ //
253+ // # Example: Force PQC-only encryption
254+ // apiVersion: config.openshift.io/v1
255+ // kind: APIServer
256+ // spec:
257+ // tlsSecurityProfile:
258+ // type: Custom
259+ // custom:
260+ // ciphers:
261+ // - TLS_AES_128_GCM_SHA256
262+ // - TLS_AES_256_GCM_SHA384
263+ // - TLS_CHACHA20_POLY1305_SHA256
264+ // curves:
265+ // - X25519MLKEM768 # PQC-only: only hybrid quantum-resistant curve
266+ // minTLSVersion: VersionTLS13
267+ //
268+ // +optional
269+ // +listType=set
270+ // +kubebuilder:validation:MaxItems=5
271+ // +openshift:enable:FeatureGate=TLSCurvesConfiguration
272+ Curves []TLSCurve `json:"curves,omitempty"`
216273 // minTLSVersion is used to specify the minimal version of the TLS protocol
217274 // that is negotiated during the TLS handshake. For example, to use TLS
218275 // versions 1.1, 1.2 and 1.3 (yaml):
@@ -283,6 +340,12 @@ var TLSProfiles = map[TLSProfileType]*TLSProfileSpec{
283340 "AES256-SHA" ,
284341 "DES-CBC3-SHA" ,
285342 },
343+ Curves : []TLSCurve {
344+ TLSCurveX25519 ,
345+ TLSCurveP256 ,
346+ TLSCurveP384 ,
347+ TLSCurveX25519MLKEM768 ,
348+ },
286349 MinTLSVersion : VersionTLS10 ,
287350 },
288351 TLSProfileIntermediateType : {
@@ -299,6 +362,12 @@ var TLSProfiles = map[TLSProfileType]*TLSProfileSpec{
299362 "DHE-RSA-AES128-GCM-SHA256" ,
300363 "DHE-RSA-AES256-GCM-SHA384" ,
301364 },
365+ Curves : []TLSCurve {
366+ TLSCurveX25519 ,
367+ TLSCurveP256 ,
368+ TLSCurveP384 ,
369+ TLSCurveX25519MLKEM768 ,
370+ },
302371 MinTLSVersion : VersionTLS12 ,
303372 },
304373 TLSProfileModernType : {
@@ -307,6 +376,12 @@ var TLSProfiles = map[TLSProfileType]*TLSProfileSpec{
307376 "TLS_AES_256_GCM_SHA384" ,
308377 "TLS_CHACHA20_POLY1305_SHA256" ,
309378 },
379+ Curves : []TLSCurve {
380+ TLSCurveX25519 ,
381+ TLSCurveP256 ,
382+ TLSCurveP384 ,
383+ TLSCurveX25519MLKEM768 ,
384+ },
310385 MinTLSVersion : VersionTLS13 ,
311386 },
312387}
0 commit comments