Skip to content

Commit

Permalink
do not set rustls default provider
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Jun 17, 2024
1 parent e711b1b commit 8d7c2f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
15 changes: 2 additions & 13 deletions src/authenticator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ impl<C, F> AuthenticatorBuilder<C, F> {
}

fn new(auth_flow: F, hyper_client_builder: C) -> AuthenticatorBuilder<C, F> {
install_crypto_provider_if_not_set();
AuthenticatorBuilder {
hyper_client_builder,
storage_type: StorageType::Memory,
Expand Down Expand Up @@ -1004,7 +1003,7 @@ impl HyperClientBuilder for DefaultHyperClient {
) -> Result<hyper_util::client::legacy::Client<Self::Connector, String>, Error> {
#[cfg(feature = "hyper-rustls")]
let connector = hyper_rustls::HttpsConnectorBuilder::new()
.with_native_roots()?
.with_provider_and_native_roots(rustls::crypto::ring::default_provider())?
.https_or_http()
.enable_http1()
.enable_http2()
Expand All @@ -1024,7 +1023,7 @@ impl HyperClientBuilder for DefaultHyperClient {
) -> hyper_util::client::legacy::Client<Self::Connector, String> {
#[cfg(feature = "hyper-rustls")]
let connector = hyper_rustls::HttpsConnectorBuilder::new()
.with_native_roots()
.with_provider_and_native_roots(rustls::crypto::ring::default_provider())
.unwrap()
.https_or_http()
.enable_http1()
Expand Down Expand Up @@ -1066,16 +1065,6 @@ enum StorageType {
Custom(Box<dyn TokenStorage>),
}

#[cfg(feature = "hyper-rustls")]
fn install_crypto_provider_if_not_set() {
if rustls::crypto::CryptoProvider::get_default().is_none() {
let _ = rustls::crypto::ring::default_provider().install_default();
}
}

#[cfg(not(feature = "hyper-rustls"))]
fn install_crypto_provider_if_not_set() {}

#[cfg(test)]
mod tests {
#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/service_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ mod tests {
hyper_util::client::legacy::Client::builder(hyper_util::rt::TokioExecutor::new())
.build(
hyper_rustls::HttpsConnectorBuilder::new()
.with_native_roots()
.with_provider_and_native_roots(rustls::crypto::ring::default_provider())
.unwrap()
.https_only()
.enable_http1()
Expand Down

0 comments on commit 8d7c2f8

Please sign in to comment.