Skip to main content

install_crypto_provider

Function install_crypto_provider 

Source
pub fn install_crypto_provider()
Expand description

Install a process-level rustls CryptoProvider so that rustls 0.23 has an unambiguous default.

In the bigtable build our dependency graph unifies onto a single rustls 0.23 build that has both the ring and aws-lc-rs provider features compiled in (ring via tonic’s tls-ring and gcp_auth; aws-lc-rs via reqwest). When more than one provider is present, any library that builds a rustls config through the default path — e.g. reqwest, on the actix arbiter threads at startup — panics because rustls can’t pick a provider. (tonic itself doesn’t panic: it falls back to ring, but it adopts whatever default we install here.)

We install aws-lc-rs because reqwest pulls it into every build, so this never introduces a second provider into the otherwise single-provider redis/postgres builds.

Call this once, as early as possible in main(), before any TLS use. It is idempotent: a second call (or a provider installed by another crate) is ignored.