From a613d4b510b726a21ee542cc74db91701b5ceb20 Mon Sep 17 00:00:00 2001 From: Rushil Mehra Date: Mon, 10 Feb 2025 14:07:49 -0800 Subject: [PATCH] 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. --- boring-sys/src/lib.rs | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/boring-sys/src/lib.rs b/boring-sys/src/lib.rs index c821b3e5..094221ff 100644 --- a/boring-sys/src/lib.rs +++ b/boring-sys/src/lib.rs @@ -48,18 +48,7 @@ pub const fn ERR_GET_REASON(l: c_uint) -> c_int { } pub fn init() { - use std::ptr; - use std::sync::Once; - - // 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 - ) - }); + unsafe { + CRYPTO_library_init(); + } }