diff options
author | David Benjamin <davidben@google.com> | 2024-06-18 01:13:09 -0400 |
---|---|---|
committer | Boringssl LUCI CQ <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-06-21 04:01:30 +0000 |
commit | 2fcdd11f6d33b667968a5bc5147e2ba83a2082b8 (patch) | |
tree | 260adccb46fb6f99f663fde586f941afed961f36 /rust | |
parent | 6c98ebeb8cf24c7be5d462ded7e60d88b2ceccec (diff) | |
download | boringssl-2fcdd11f6d33b667968a5bc5147e2ba83a2082b8.zip boringssl-2fcdd11f6d33b667968a5bc5147e2ba83a2082b8.tar.gz boringssl-2fcdd11f6d33b667968a5bc5147e2ba83a2082b8.tar.bz2 |
Make BoringSSL initialization-less
Now that we don't depend on external CRYPTO_library_init calls or the
static initializer to initialize CPU capabilities, we can drop a ton of
code.
This makes CRYPTO_library_init, and all its wrappers, into no-ops and
drops the (non-FIPS) static initializer. I've added an internal
OPENSSL_init_cpuid function for the places where the library actually
needs to initialize the CPU vector.
Note this slightly changes the default, previously
static-initializer-full build: previously, CRYPTO_library_init was a
no-op and we relied on the static initializer. Now we uniformly use
CRYPTO_once. This should be an atomic read in the steady state and
essentially free. We can restore the static initializer by default if
this ends up being a problem, but having only one mode is more
straightforward. This also avoids problems if an application calls into
BoringSSL during its own static initializer. Static initializers are not
coherently ordered.
Update-Note: The BORINGSSL_NO_STATIC_INITIALIZER build option and
CRYPTO_library_init are now unnecessary. Once updating past this
revision, those options can now be cleaned up from downstream projects.
Fixed: 40644931
Change-Id: Idc2e6ea7a73d6352e0360fd886c46d88dba3568c
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/69508
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Diffstat (limited to 'rust')
-rw-r--r-- | rust/bssl-sys/src/lib.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/rust/bssl-sys/src/lib.rs b/rust/bssl-sys/src/lib.rs index 1d43e14..2d313af 100644 --- a/rust/bssl-sys/src/lib.rs +++ b/rust/bssl-sys/src/lib.rs @@ -55,8 +55,6 @@ pub use { ERR_GET_LIB_RUST as ERR_GET_LIB, CBS_len_RUST as CBS_len }; pub fn init() { - // Safety: `CRYPTO_library_init` may be called multiple times and concurrently. - unsafe { - CRYPTO_library_init(); - } + // This function does nothing. + // TODO(davidben): Remove rust-openssl's dependency on this and remove this. } |