forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only permit X25519 based QUIC-TLS key exchanges
- Loading branch information
Showing
12 changed files
with
60 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use { | ||
rustls::{ | ||
client::WantsClientCert, server::WantsServerCert, ClientConfig, ConfigBuilder, ServerConfig, | ||
}, | ||
std::sync::Arc, | ||
}; | ||
|
||
pub fn tls_client_config_builder() -> ConfigBuilder<ClientConfig, WantsClientCert> { | ||
ClientConfig::builder_with_provider(Arc::new(crate::crypto_provider())) | ||
.with_safe_default_protocol_versions() | ||
.unwrap() | ||
.dangerous() | ||
.with_custom_certificate_verifier(crate::SkipServerVerification::new()) | ||
} | ||
|
||
pub fn tls_server_config_builder() -> ConfigBuilder<ServerConfig, WantsServerCert> { | ||
ServerConfig::builder_with_provider(Arc::new(crate::crypto_provider())) | ||
.with_safe_default_protocol_versions() | ||
.unwrap() | ||
.with_client_cert_verifier(crate::SkipClientVerification::new()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use rustls::{crypto::CryptoProvider, NamedGroup}; | ||
|
||
pub fn crypto_provider() -> CryptoProvider { | ||
let mut provider = rustls::crypto::ring::default_provider(); | ||
// Disable all key exchange algorithms except X25519 | ||
provider | ||
.kx_groups | ||
.retain(|kx| kx.name() == NamedGroup::X25519); | ||
provider | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters