Skip to content

Commit be8197d

Browse files
committed
fix: install ring CyrptoProvider manually
For some reason I do not yet understand, this used to happen automatically but is not happening, and it causes a crashtracker test `crash_tracking_empty_endpoint` to fail because it doesn't have a CryptoProvider.
1 parent d8b4f36 commit be8197d

File tree

1 file changed

+11
-0
lines changed
  • ddcommon-net1/src/connector

1 file changed

+11
-0
lines changed

ddcommon-net1/src/connector/mod.rs

+11
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ lazy_static! {
4848
};
4949
}
5050

51+
#[cfg(not(feature = "use_webpki_roots"))]
52+
lazy_static! {
53+
static ref INIT_CRYPTO_PROVIDER: () = {
54+
#[cfg(unix)]
55+
rustls::crypto::ring::default_provider()
56+
.install_default()
57+
.expect("Failed to install default CryptoProvider");
58+
};
59+
}
60+
5161
impl Default for Connector {
5262
fn default() -> Self {
5363
DEFAULT_CONNECTOR.clone()
@@ -123,6 +133,7 @@ fn build_https_connector_with_webpki_roots(
123133

124134
#[cfg(not(feature = "use_webpki_roots"))]
125135
fn load_root_certs() -> anyhow::Result<rustls::RootCertStore> {
136+
*INIT_CRYPTO_PROVIDER; // One-time initialization of a crypto provider if needed
126137
let mut roots = rustls::RootCertStore::empty();
127138

128139
for cert in rustls_native_certs::load_native_certs()? {

0 commit comments

Comments
 (0)