rustls_openssl/kx_group/
mod.rs

1//! Key exchange groups using OpenSSL
2use rustls::crypto::SupportedKxGroup;
3
4mod ec;
5pub use ec::{SECP256R1, SECP384R1};
6
7#[cfg(not(feature = "fips"))]
8mod x25519;
9#[cfg(not(feature = "fips"))]
10pub use x25519::X25519;
11
12#[cfg(ossl350)]
13mod kem;
14#[cfg(ossl350)]
15pub use kem::{MLKEM768, X25519MLKEM768};
16
17/// Key exchanges enabled by default by this provider:
18/// * [X25519MLKEM768] (OpenSSL 3.5+)
19/// * [X25519] (if fips feature not enabled)
20/// * [SECP384R1]
21/// * [SECP256R1]
22///
23/// If the `prefer-post-quantum` feature is enabled, X25519MLKEM768 will
24/// be the first group offered, otherwise it will be the last.
25pub static DEFAULT_KX_GROUPS: &[&dyn SupportedKxGroup] = &[
26    #[cfg(all(ossl350, feature = "prefer-post-quantum"))]
27    X25519MLKEM768,
28    #[cfg(not(feature = "fips"))]
29    X25519,
30    SECP256R1,
31    SECP384R1,
32    #[cfg(all(ossl350, not(feature = "prefer-post-quantum")))]
33    X25519MLKEM768,
34];
35
36/// All key exchanges supported by this provider:
37/// * [X25519MLKEM768] (OpenSSL 3.5+)
38/// * [X25519] (if fips feature not enabled)
39/// * [SECP384R1]
40/// * [SECP256R1]
41/// * [MLKEM768] (OpenSSL 3.5+)
42///
43/// If the `prefer-post-quantum` feature is enabled, X25519MLKEM768 will
44/// be the first group offered, otherwise it will be the last.
45pub static ALL_KX_GROUPS: &[&dyn SupportedKxGroup] = &[
46    #[cfg(all(ossl350, feature = "prefer-post-quantum"))]
47    X25519MLKEM768,
48    #[cfg(not(feature = "fips"))]
49    X25519,
50    SECP256R1,
51    SECP384R1,
52    #[cfg(all(ossl350, not(feature = "prefer-post-quantum")))]
53    X25519MLKEM768,
54    #[cfg(ossl350)]
55    MLKEM768,
56];