-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: make an actual policy recommendation for fips (#2246)
- Loading branch information
Showing
3 changed files
with
65 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use super::*; | ||
use crate::provider::tls::default::{self as tls, security}; | ||
|
||
fn test_policy(policy: &security::Policy) { | ||
let model = Model::default(); | ||
|
||
test(model, |handle| { | ||
let server = tls::Server::from_loader({ | ||
let mut builder = tls::config::Config::builder(); | ||
builder | ||
.enable_quic()? | ||
.set_application_protocol_preference(["h3"])? | ||
.set_security_policy(policy)? | ||
.load_pem( | ||
certificates::CERT_PEM.as_bytes(), | ||
certificates::KEY_PEM.as_bytes(), | ||
)?; | ||
|
||
builder.build()? | ||
}); | ||
|
||
let server = Server::builder() | ||
.with_io(handle.builder().build()?)? | ||
.with_tls(server)? | ||
.with_event(tracing_events())? | ||
.with_random(Random::with_seed(456))? | ||
.start()?; | ||
|
||
let client = tls::Client::from_loader({ | ||
let mut builder = tls::config::Config::builder(); | ||
builder | ||
.enable_quic()? | ||
.set_application_protocol_preference(["h3"])? | ||
.set_security_policy(policy)? | ||
.trust_pem(certificates::CERT_PEM.as_bytes())?; | ||
|
||
builder.build()? | ||
}); | ||
|
||
let client = Client::builder() | ||
.with_io(handle.builder().build()?)? | ||
.with_tls(client)? | ||
.with_event(tracing_events())? | ||
.with_random(Random::with_seed(456))? | ||
.start()?; | ||
|
||
let addr = start_server(server)?; | ||
start_client(client, addr, Data::new(1000))?; | ||
Ok(addr) | ||
}) | ||
.unwrap(); | ||
} | ||
|
||
#[test] | ||
fn default_fips_test() { | ||
// TODO switch this to `default_fips` when the policy supports TLS 1.3 | ||
// see https://github.com/aws/s2n-quic/issues/2247 | ||
test_policy(&security::Policy::from_version("20230317").unwrap()); | ||
} |