Skip to content

Commit 8a33abb

Browse files
yeoleobunclaude
andcommitted
docs(tls): install a rustls crypto provider when both backends are linked
When an application links both the ring and aws-lc-rs rustls backends, rustls cannot pick a process default and the first TLS connection panics. Document calling install_default at startup, in the README and on TlsConfig. Closes #212. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent efc729a commit 8a33abb

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

‎README.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,23 @@ transport_layer.add_transport(tcp_listener.into());
156156
To add TLS or WebSocket listeners, construct a `TlsListenerConnection` or
157157
`WebSocketListenerConnection` and register it with `transport_layer.add_transport(...)`.
158158

159+
> **rustls crypto provider.** rsipstack's TLS uses rustls's process-wide crypto
160+
> provider and builds rustls with `ring`. If your application also links the
161+
> `aws-lc-rs` backend (for example through `reqwest`'s default rustls setup),
162+
> rustls cannot pick one on its own and the first TLS connection panics with
163+
> *"Could not automatically determine the process-level CryptoProvider"*.
164+
> Install a provider once at startup, before creating any TLS transport:
165+
>
166+
> ```rust
167+
> rustls::crypto::ring::default_provider()
168+
> .install_default()
169+
> .expect("install rustls crypto provider");
170+
> // or: rustls::crypto::aws_lc_rs::default_provider().install_default()
171+
> ```
172+
>
173+
> The installed provider is used for every rustls user in the process,
174+
> rsipstack included, so it is also where to restrict cipher suites.
175+
159176
The raw `TransportEvent` stream is an internal API consumed by `Endpoint::serve`.
160177
To process incoming SIP messages, build an `Endpoint` around the transport layer and
161178
drive it with `endpoint.serve()` while consuming transactions via

‎src/transport/tls.rs‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,18 @@ impl Clone for ReloadableCertResolver {
222222
}
223223
}
224224

225-
// TLS configuration
225+
/// TLS configuration.
226+
///
227+
/// TLS uses rustls's process-wide crypto provider. When the application links
228+
/// both the `ring` and `aws-lc-rs` backends (e.g. through another crate's
229+
/// rustls features), rustls cannot pick one and the first TLS connection
230+
/// panics; install one at startup, before creating any TLS transport:
231+
///
232+
/// ```ignore
233+
/// rustls::crypto::ring::default_provider()
234+
/// .install_default()
235+
/// .expect("install rustls crypto provider");
236+
/// ```
226237
#[derive(Clone, Debug, Default)]
227238
pub struct TlsConfig {
228239
// Server certificate in PEM format

0 commit comments

Comments
 (0)