Skip to content

Commit dfe216a

Browse files
committed
Unify the two BoringSSL codepaths a bit and simplify init
Although bssl-sys (currently) provides init, it only does so for rust-openssl, and it's more natural for rust-openssl to consistently be responsible for it. Also BoringSSL has not required initialization at all since June 2024. I've also removed the ambiguous_glob_reexports allowance. I couldn't reproduce whatever triggered it, and it seems unlikely that the two codepaths would have different needs here. This leaves the remaining non-build unstable_boringssl trigger so minor that perhaps we should just remove it here? It dates to some problematic Android Rust integration. At this point, it's just an external mechanism to get the same output as the build.rs logic around bindgen, mostly because bindgen has perpetual deficiencies w.r.t. correctly binding C, so we need to work around it. Ideally there wouldn't be two sources of those workarounds, but Google's build environments care about build reproducibility and hermeticity, while Rust and Cargo have... very much not achieved this yet. But there's no reason for rust-openssl's build to care about this.
1 parent acd312c commit dfe216a

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

openssl-sys/src/lib.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
non_upper_case_globals,
77
unused_imports
88
)]
9-
#![cfg_attr(feature = "unstable_boringssl", allow(ambiguous_glob_reexports))]
109
#![doc(html_root_url = "https://docs.rs/openssl-sys/0.9")]
1110
#![recursion_limit = "128"] // configure fixed limit across all rust versions
1211

@@ -15,21 +14,19 @@ pub use libc::c_int;
1514

1615
#[cfg(feature = "unstable_boringssl")]
1716
extern crate bssl_sys;
18-
#[cfg(feature = "unstable_boringssl")]
19-
pub use bssl_sys::*;
2017

21-
#[cfg(all(boringssl, not(feature = "unstable_boringssl")))]
18+
#[cfg(boringssl)]
2219
#[path = "."]
2320
mod boringssl {
21+
#[cfg(feature = "unstable_boringssl")]
22+
pub use bssl_sys::*;
23+
#[cfg(not(feature = "unstable_boringssl"))]
2424
include!(concat!(env!("OUT_DIR"), "/bindgen.rs"));
2525

26-
pub fn init() {
27-
unsafe {
28-
CRYPTO_library_init();
29-
}
30-
}
26+
// BoringSSL does not require initialization.
27+
pub fn init() {}
3128
}
32-
#[cfg(all(boringssl, not(feature = "unstable_boringssl")))]
29+
#[cfg(boringssl)]
3330
pub use boringssl::*;
3431

3532
#[cfg(openssl)]

0 commit comments

Comments
 (0)