Skip to content

Commit ba701fe

Browse files
chore: rearrange fips feature for tests
1 parent b859aaf commit ba701fe

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

ddcommon/src/connector/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,23 @@ mod https {
9797
/// happens here. On non-unix platforms, ddcommon uses `ring` instead, which handles this
9898
/// at rustls initialization. TODO: Move to the more ergonomic LazyLock when MSRV is 1.80
9999
/// In fips mode we expect someone to have done this already.
100+
#[cfg(not(feature = "fips"))]
100101
fn ensure_crypto_provider_initialized() {
101102
use std::sync::OnceLock;
102103
static INIT_CRYPTO_PROVIDER: OnceLock<()> = OnceLock::new();
103104
INIT_CRYPTO_PROVIDER.get_or_init(|| {
104-
#[cfg(all(unix, not(feature = "fips")))]
105+
#[cfg(unix)]
105106
#[allow(clippy::expect_used)]
106107
rustls::crypto::aws_lc_rs::default_provider()
107108
.install_default()
108109
.expect("Failed to install default CryptoProvider");
109110
});
110111
}
111112

113+
// This this actually needs to be done by the user somewhere in their own main.
114+
#[cfg(feature = "fips")]
115+
fn ensure_crypto_provider_initialized() {}
116+
112117
#[cfg(feature = "use_webpki_roots")]
113118
pub(super) fn build_https_connector_with_webpki_roots() -> anyhow::Result<
114119
hyper_rustls::HttpsConnector<hyper_util::client::legacy::connect::HttpConnector>,

0 commit comments

Comments
 (0)