From 88f1fcbac12c1292143b9fd03ef4def5671276ac Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Wed, 20 Dec 2023 13:13:28 +0100 Subject: [PATCH] Fix support for fips-link-precompiled This feature expects a recent boringssl checkout (such as the one found in boring-sys/deps/boringssl), so it should not be using the same bindings as the fips feature, which are based on boring-sys/deps/boringssl-fips, which is older and with a different API. --- boring/src/bio.rs | 4 ++-- boring/src/ssl/mod.rs | 10 +++++----- boring/src/x509/mod.rs | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/boring/src/bio.rs b/boring/src/bio.rs index adb119b8..55870ded 100644 --- a/boring/src/bio.rs +++ b/boring/src/bio.rs @@ -19,9 +19,9 @@ impl<'a> Drop for MemBioSlice<'a> { impl<'a> MemBioSlice<'a> { pub fn new(buf: &'a [u8]) -> Result, ErrorStack> { - #[cfg(not(any(feature = "fips", feature = "fips-link-precompiled")))] + #[cfg(not(feature = "fips"))] type BufLen = isize; - #[cfg(any(feature = "fips", feature = "fips-link-precompiled"))] + #[cfg(feature = "fips")] type BufLen = libc::c_int; ffi::init(); diff --git a/boring/src/ssl/mod.rs b/boring/src/ssl/mod.rs index d7299f99..f035e8ab 100644 --- a/boring/src/ssl/mod.rs +++ b/boring/src/ssl/mod.rs @@ -688,7 +688,7 @@ impl SslCurve { pub const X25519: SslCurve = SslCurve(ffi::NID_X25519); - #[cfg(not(any(feature = "fips", feature = "fips-link-precompiled")))] + #[cfg(not(feature = "fips"))] pub const X25519_KYBER768_DRAFT00: SslCurve = SslCurve(ffi::NID_X25519Kyber768Draft00); #[cfg(feature = "pq-experimental")] @@ -1403,7 +1403,7 @@ impl SslContextBuilder { pub fn set_alpn_protos(&mut self, protocols: &[u8]) -> Result<(), ErrorStack> { unsafe { #[cfg_attr( - not(any(feature = "fips", feature = "fips-link-precompiled")), + not(feature = "fips"), allow(clippy::unnecessary_cast) )] { @@ -2121,9 +2121,9 @@ impl SslContextRef { #[derive(Debug)] pub struct GetSessionPendingError; -#[cfg(not(any(feature = "fips", feature = "fips-link-precompiled")))] +#[cfg(not(feature = "fips"))] type ProtosLen = usize; -#[cfg(any(feature = "fips", feature = "fips-link-precompiled"))] +#[cfg(feature = "fips")] type ProtosLen = libc::c_uint; /// Information about the state of a cipher. @@ -2815,7 +2815,7 @@ impl SslRef { pub fn set_alpn_protos(&mut self, protocols: &[u8]) -> Result<(), ErrorStack> { unsafe { #[cfg_attr( - not(any(feature = "fips", feature = "fips-link-precompiled")), + not(feature = "fips"), allow(clippy::unnecessary_cast) )] { diff --git a/boring/src/x509/mod.rs b/boring/src/x509/mod.rs index 10ee1935..de0183e9 100644 --- a/boring/src/x509/mod.rs +++ b/boring/src/x509/mod.rs @@ -972,9 +972,9 @@ impl X509NameBuilder { } } -#[cfg(not(any(feature = "fips", feature = "fips-link-precompiled")))] +#[cfg(not(feature = "fips"))] type ValueLen = isize; -#[cfg(any(feature = "fips", feature = "fips-link-precompiled"))] +#[cfg(feature = "fips")] type ValueLen = i32; foreign_type_and_impl_send_sync! {