Skip to content

Commit

Permalink
Clean up boring_sys::init()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rushilmehra committed Feb 12, 2025
1 parent 3b36cb6 commit a613d4b
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions boring-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

0 comments on commit a613d4b

Please sign in to comment.