1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! Process-wide TLS crypto provider installation.
//!
//! Centralises the rustls `CryptoProvider` install so every entry point
//! (HTTP/WebSocket server, MCP stdio bridge, Enterprise QUIC cluster bus)
//! agrees on the same provider and so the FIPS feature can be enforced in
//! exactly one place.
use Result;
use CryptoProvider;
/// Install the rustls process-default crypto provider.
///
/// Under `feature = "fips"` this installs `default_fips_provider()` so TLS
/// handshakes are restricted to FIPS-approved cipher suites, KX groups, and
/// signature schemes, then asserts the resolved provider reports FIPS mode
/// active. Aborts startup if the assertion fails — silent FIPS downgrade is
/// strictly worse than failing closed.
///
/// `install_default` only returns `Err` if another crate has already installed
/// a provider, which leaves a working TLS stack in place, so the install
/// result is intentionally discarded. The FIPS check still runs against
/// whatever provider was installed.
///
/// Idempotent: safe to call from multiple entry points; the first caller wins
/// and subsequent installs are no-ops.