Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use once_cell::sync::Lazy;
use std::env;

pub mod admin;
pub mod app;
pub mod assertions;
Expand Down Expand Up @@ -42,3 +45,7 @@ pub mod xds;

#[cfg(any(test, feature = "testing"))]
pub mod test_helpers;

#[allow(dead_code)]
static PQC_ENABLED: Lazy<bool> =
Lazy::new(|| env::var("COMPLIANCE_POLICY").unwrap_or_default() == "pqc");
12 changes: 10 additions & 2 deletions src/tls/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

use super::Error;

#[allow(unused_imports)]
use crate::PQC_ENABLED;
use crate::identity::{self, Identity};

use std::fmt::Debug;
Expand Down Expand Up @@ -68,14 +70,20 @@ pub(super) fn provider() -> Arc<CryptoProvider> {

#[cfg(feature = "tls-aws-lc")]
pub(super) fn provider() -> Arc<CryptoProvider> {
Arc::new(CryptoProvider {
let mut provider = CryptoProvider {
// Limit to only the subset of ciphers that are FIPS compatible
cipher_suites: vec![
rustls::crypto::aws_lc_rs::cipher_suite::TLS13_AES_256_GCM_SHA384,
rustls::crypto::aws_lc_rs::cipher_suite::TLS13_AES_128_GCM_SHA256,
],
..rustls::crypto::aws_lc_rs::default_provider()
})
};

if *PQC_ENABLED {
provider.kx_groups = vec![rustls::crypto::aws_lc_rs::kx_group::X25519MLKEM768]
}

Arc::new(provider)
}

#[cfg(feature = "tls-openssl")]
Expand Down