clia_rustls_mod/manual/fips.rs
1/*! # Using rustls with FIPS-approved cryptography
2
3To use FIPS-approved cryptography with rustls, you should take
4these actions:
5
6## 1. Enable the `fips` crate feature for rustls.
7
8Use:
9
10```toml
11rustls = { version = "0.23", features = [ "fips" ] }
12```
13
14## 2. Use the FIPS `CryptoProvider`
15
16This is [`default_fips_provider()`]:
17
18```rust,ignore
19rustls::crypto::default_fips_provider()
20 .install_default()
21 .expect("default provider already set elsewhere");
22```
23
24This snippet makes use of the process-default provider,
25and that assumes all your uses of rustls use that.
26See [`CryptoProvider`] documentation for other ways to
27specify which `CryptoProvider` to use.
28
29## 3. Validate the FIPS status of your `ClientConfig`/`ServerConfig` at run-time
30
31See [`ClientConfig::fips()`] or [`ServerConfig::fips()`].
32
33You could, for example:
34
35```rust,ignore
36# let client_config = unreachable!();
37assert!(client_config.fips());
38```
39
40But maybe your application has an error handling
41or health-check strategy better than panicking.
42
43# aws-lc-rs FIPS approval status
44
45At the time of writing, this is pending approval on Linux
46for two architectures (ARM aarch64 and Intel x86-64).
47
48For the most up-to-date details see the latest documentation
49for the [`aws-lc-fips-sys`] crate.
50
51[`aws-lc-fips-sys`]: https://crates.io/crates/aws-lc-fips-sys
52[`default_fips_provider()`]: crate::crypto::default_fips_provider
53[`CryptoProvider`]: crate::crypto::CryptoProvider
54[`ClientConfig::fips()`]: crate::client::ClientConfig::fips
55[`ServerConfig::fips()`]: crate::server::ServerConfig::fips
56*/