Relax feature guard on ServerConfig::with_crypto

This constructor doesn't require rustls.
This commit is contained in:
Benjamin Saunders
2022-02-19 11:56:17 -08:00
committed by Dirkjan Ochtman
parent 0d65abd8e0
commit ce1071195b
+5 -2
View File
@@ -518,11 +518,14 @@ impl ServerConfig {
let crypto = crypto::rustls::server_config(cert_chain, key)?;
Ok(Self::with_crypto(Arc::new(crypto)))
}
}
/// Create a server config with the given [`rustls::ServerConfig`]
#[cfg(feature = "ring")]
impl ServerConfig {
/// Create a server config with the given [`crypto::ServerConfig`]
///
/// Uses a randomized handshake token key.
pub fn with_crypto(crypto: Arc<rustls::ServerConfig>) -> Self {
pub fn with_crypto(crypto: Arc<dyn crypto::ServerConfig>) -> Self {
let rng = &mut rand::thread_rng();
let mut master_key = [0u8; 64];
rng.fill_bytes(&mut master_key);