mirror of
https://github.com/openai/codex.git
synced 2026-04-30 09:26:44 +00:00
chore: put crypto provider logic in a shared crate (#11294)
Ensures a process-wide rustls crypto provider is installed. Both the `codex-network-proxy` and `codex-api` crates need this.
This commit is contained in:
12
codex-rs/utils/rustls-provider/src/lib.rs
Normal file
12
codex-rs/utils/rustls-provider/src/lib.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
use std::sync::Once;
|
||||
|
||||
/// Ensures a process-wide rustls crypto provider is installed.
|
||||
///
|
||||
/// rustls cannot auto-select a provider when both `ring` and `aws-lc-rs`
|
||||
/// features are enabled in the dependency graph.
|
||||
pub fn ensure_rustls_crypto_provider() {
|
||||
static RUSTLS_PROVIDER_INIT: Once = Once::new();
|
||||
RUSTLS_PROVIDER_INIT.call_once(|| {
|
||||
let _ = rustls::crypto::ring::default_provider().install_default();
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user