Install ring crypto provider for quinn endpoint

A default crypto provider in installed before creating the quinn
endpoint, as that is needed for rustls (part of the endpoint tls
config). This also allows us to get the default provider when connecting
to a remote quic endpoint.

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
Lee Smet
2024-05-08 12:40:42 +02:00
parent d11bbf50a5
commit 36d7961b20
+3
View File
@@ -1062,6 +1062,9 @@ fn make_quic_endpoint(
quic_listen_port: u16,
firewall_mark: Option<u32>,
) -> Result<quinn::Endpoint, Box<dyn std::error::Error>> {
// Install ring crypto provider for rustls
rustls::crypto::CryptoProvider::install_default(rustls::crypto::ring::default_provider())
.expect("Crypto provider has not been installed yet");
// Generate self signed certificate certificate.
// TODO: sign with router keys
let cert = rcgen::generate_simple_self_signed(vec![format!("{router_id}")])?;