Clean up boring_sys::init()

We don't need the workaround that was initially introduced for a bug in
openssl, and OPENSSL_init_ssl always calls into CRYPTO_library_init on
boringssl, so just call it explicitly.
This commit is contained in:
Rushil Mehra 2025-02-10 14:07:49 -08:00 committed by Rushil Mehra
parent 3b36cb6c78
commit a613d4b510
1 changed files with 3 additions and 14 deletions

View File

@ -48,18 +48,7 @@ pub const fn ERR_GET_REASON(l: c_uint) -> c_int {
} }
pub fn init() { pub fn init() {
use std::ptr; unsafe {
use std::sync::Once; CRYPTO_library_init();
}
// explicitly initialize to work around https://github.com/openssl/openssl/issues/3505
static INIT: Once = Once::new();
let init_options = OPENSSL_INIT_LOAD_SSL_STRINGS;
INIT.call_once(|| {
assert_eq!(
unsafe { OPENSSL_init_ssl(init_options.try_into().unwrap(), ptr::null_mut()) },
1
)
});
} }