From ee90d27c83fac7338b22e1fd2714e2ea1e50152c Mon Sep 17 00:00:00 2001 From: Jackson Coxson Date: Thu, 24 Apr 2025 23:42:25 -0600 Subject: [PATCH] Don't panic on crypto provider installation --- idevice/src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/idevice/src/lib.rs b/idevice/src/lib.rs index 26704fd..c529207 100644 --- a/idevice/src/lib.rs +++ b/idevice/src/lib.rs @@ -327,7 +327,14 @@ impl Idevice { pairing_file: &pairing_file::PairingFile, ) -> Result<(), IdeviceError> { if CryptoProvider::get_default().is_none() { - CryptoProvider::install_default(rustls::crypto::aws_lc_rs::default_provider()).unwrap(); + if let Err(e) = + CryptoProvider::install_default(rustls::crypto::aws_lc_rs::default_provider()) + { + // For whatever reason, getting the default provider will return None on iOS at + // random. Installing the default provider a second time will return an error, so + // we will log it but not propogate it. An issue should be opened with rustls. + log::error!("Failed to set crypto provider: {e:?}"); + } } let config = sni::create_client_config(pairing_file)?; let connector = tokio_rustls::TlsConnector::from(Arc::new(config));