Skip to content

Commit

Permalink
Fix support for fips-link-precompiled
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nox committed Dec 20, 2023
1 parent 3df4054 commit 88f1fcb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions boring/src/bio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ impl<'a> Drop for MemBioSlice<'a> {

impl<'a> MemBioSlice<'a> {
pub fn new(buf: &'a [u8]) -> Result<MemBioSlice<'a>, 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();
Expand Down
10 changes: 5 additions & 5 deletions boring/src/ssl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down Expand Up @@ -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)
)]
{
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
)]
{
Expand Down
4 changes: 2 additions & 2 deletions boring/src/x509/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
Expand Down

0 comments on commit 88f1fcb

Please sign in to comment.