Don't panic on crypto provider installation

This commit is contained in:
Jackson Coxson
2025-04-24 23:42:25 -06:00
parent d114ec8369
commit ee90d27c83

View File

@@ -327,7 +327,14 @@ impl Idevice {
pairing_file: &pairing_file::PairingFile, pairing_file: &pairing_file::PairingFile,
) -> Result<(), IdeviceError> { ) -> Result<(), IdeviceError> {
if CryptoProvider::get_default().is_none() { 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 config = sni::create_client_config(pairing_file)?;
let connector = tokio_rustls::TlsConnector::from(Arc::new(config)); let connector = tokio_rustls::TlsConnector::from(Arc::new(config));