Skip to content

Commit d8975dc

Browse files
cjpattonkornelski
authored andcommitted
boring: Disable SslCurve API with "fips" feature
The "fips" feature implies use of a prebuilt boringSSL. The boringSSL API consumed by `SslCurve` in incompatible with older versions of boringSSL. In the `ffi` bindings, the following symbols don't exist in older builds: * NID_X25519MLKEM768 * SSL_CURVE_X25519_MLKEM768 * NID_X25519Kyber768Draft00Old The following symbols have been renamed: * SSL_CURVE_P256KYBER768DRAFT00 => SSL_CURVE_P256_KYBER768_DRAFT00 * SSL_CURVE_X25519KYBER512DRAFT00 => SSL_CURVE_X25519_KYBER512_DRAFT00 * SSL_CURVE_X25519KYBER768DRAFT00OLD => SSL_CURVE_X25519_KYBER768_DRAFT00_OLD * SSL_CURVE_P256KYBER768DRAFT00 => SSL_CURVE_P256_KYBER768_DRAFT00 Meanwhile, the `ssl_set_curves_list()` API is stable across these versions of boringSSL. These codepoints are added to the `SslCurve` API whenever "pq-experimental" is enabled. Since this feature is no longer mutually exclusive with prebuilt boringSSL (`boring-sys` just ignores patches), we also need to disable this API whenever "fips" is enabled.
1 parent 867f2b3 commit d8975dc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

boring/src/ssl/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -718,15 +718,15 @@ impl SslCurve {
718718
pub const X25519_KYBER768_DRAFT00: SslCurve =
719719
SslCurve(ffi::SSL_CURVE_X25519_KYBER768_DRAFT00 as _);
720720

721-
#[cfg(feature = "pq-experimental")]
721+
#[cfg(all(not(feature = "fips"), feature = "pq-experimental"))]
722722
pub const X25519_KYBER768_DRAFT00_OLD: SslCurve =
723723
SslCurve(ffi::SSL_CURVE_X25519_KYBER768_DRAFT00_OLD as _);
724724

725-
#[cfg(feature = "pq-experimental")]
725+
#[cfg(all(not(feature = "fips"), feature = "pq-experimental"))]
726726
pub const X25519_KYBER512_DRAFT00: SslCurve =
727727
SslCurve(ffi::SSL_CURVE_X25519_KYBER512_DRAFT00 as _);
728728

729-
#[cfg(feature = "pq-experimental")]
729+
#[cfg(all(not(feature = "fips"), feature = "pq-experimental"))]
730730
pub const P256_KYBER768_DRAFT00: SslCurve = SslCurve(ffi::SSL_CURVE_P256_KYBER768_DRAFT00 as _);
731731

732732
/// Returns the curve name
@@ -761,13 +761,13 @@ impl SslCurve {
761761
ffi::SSL_CURVE_X25519 => Some(ffi::NID_X25519),
762762
#[cfg(not(feature = "fips"))]
763763
ffi::SSL_CURVE_X25519_KYBER768_DRAFT00 => Some(ffi::NID_X25519Kyber768Draft00),
764-
#[cfg(feature = "pq-experimental")]
764+
#[cfg(all(not(feature = "fips"), feature = "pq-experimental"))]
765765
ffi::SSL_CURVE_X25519_KYBER768_DRAFT00_OLD => Some(ffi::NID_X25519Kyber768Draft00Old),
766-
#[cfg(feature = "pq-experimental")]
766+
#[cfg(all(not(feature = "fips"), feature = "pq-experimental"))]
767767
ffi::SSL_CURVE_X25519_KYBER512_DRAFT00 => Some(ffi::NID_X25519Kyber512Draft00),
768-
#[cfg(feature = "pq-experimental")]
768+
#[cfg(all(not(feature = "fips"), feature = "pq-experimental"))]
769769
ffi::SSL_CURVE_P256_KYBER768_DRAFT00 => Some(ffi::NID_P256Kyber768Draft00),
770-
#[cfg(feature = "pq-experimental")]
770+
#[cfg(all(not(feature = "fips"), feature = "pq-experimental"))]
771771
ffi::SSL_CURVE_X25519_MLKEM768 => Some(ffi::NID_X25519MLKEM768),
772772
_ => None,
773773
}

0 commit comments

Comments
 (0)