From 33e72266f5c3fb41bfda89c16d02fbffd7874331 Mon Sep 17 00:00:00 2001 From: asonix Date: Fri, 3 May 2024 23:05:17 -0500 Subject: [PATCH] Add public mechanism for installing aws-lc-rs --- src/lib.rs | 13 +++++++++++++ src/main.rs | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 9894efc..fe386c5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1937,6 +1937,19 @@ impl PictRsConfiguration { Ok(self) } + /// Install aws-lc-rs as the default crypto provider + /// + /// This would happen automatically anyway unless rustls crate features get mixed up + pub fn install_crypto_provider(self) -> Self { + if rustls023::crypto::aws_lc_rs::default_provider() + .install_default() + .is_err() + { + tracing::info!("rustls crypto provider already installed"); + } + self + } + /// Run the pict-rs application on a tokio `LocalSet` /// /// This must be called from within `tokio::main` directly diff --git a/src/main.rs b/src/main.rs index 6319a7f..394a134 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,6 +4,7 @@ fn main() -> color_eyre::Result<()> { pict_rs::PictRsConfiguration::build_default()? .install_tracing()? .install_metrics()? + .install_crypto_provider() .run() .await }) @@ -18,6 +19,7 @@ fn main() -> color_eyre::Result<()> { pict_rs::PictRsConfiguration::build_default()? .install_tracing()? .install_metrics()? + .install_crypto_provider() .run_on_localset() .await })