← Back to section · Tutorials & Labs
ring and rustls: From Cryptographic Primitives to a TLS Implementation
ring is a low-level cryptographic primitives library and rustls is a pure-Rust TLS implementation; the two are often confused. This article clarifies each one's role, rustls's pluggable CryptoProvider architecture, and the realistic path to post-quantum key exchange today.
Why These Two Names Always Appear Together
In Rust networking code, ring and rustls are constantly confused by newcomers: some think rustls is part of ring, others think installing ring gives them TLS connections. In fact they live at entirely different layers: ring is a cryptographic primitives library; rustls is a TLS protocol implementation. In its early years rustls used ring as its default cryptographic backend, and the two appeared bound together — that is where the misunderstanding comes from. Separating the layers is what lets you find the right place to change things during a post-quantum migration.
ring: A Low-Level Primitives Toolbox
ring descends from Google’s BoringSSL: it wraps battle-tested C and assembly implementations in a Rust interface, providing AEAD encryption (ring::aead, such as AES-GCM and ChaCha20-Poly1305), key agreement (ring::agreement, such as X25519 and P-256 ECDH), signing and verification (ring::signature, such as Ed25519, ECDSA, RSA), digests and HMAC (ring::digest, ring::hmac), and randomness (ring::rand::SystemRandom).
ring’s best-known design philosophy is to expose only interfaces that are hard to misuse: it offers no raw AES block-cipher interface, does not let you assemble CBC mode yourself, and many dangerous usages that exist in OpenSSL simply cannot be written in ring. If your need is “encrypt this data in a custom protocol” or “perform one X25519 agreement,” ring is the right tool; but it does not parse certificates and does not run a handshake state machine — those belong to the protocol layer.
rustls: A Pure-Rust TLS Implementation
rustls implements TLS 1.2 and TLS 1.3 clients and servers, rewriting in memory-safe Rust a stack with a long history of vulnerabilities. The key to its architecture is the CryptoProvider abstraction: since version 0.23, rustls makes “which cryptographic implementation to use” a pluggable provider interface, with two officially maintained backends — a provider based on ring and one based on aws-lc-rs. The application picks one at initialization, and the TLS logic itself is unaware of the difference.
This means “which algorithms rustls uses” is no longer a question for the rustls project alone, but for the backend: whatever key-exchange groups and signature algorithms the backend supports, rustls can negotiate. Once you understand this, the post-quantum question has a clear place to land.
The Realistic Path in a Post-Quantum Context
First, a plain fact: ring itself provides no post-quantum algorithms; its key agreement is classical ECDH only. Expecting “upgrade ring and get ML-KEM” is looking in the wrong place.
The realistic path is on the aws-lc-rs side. aws-lc-rs is AWS’s Rust binding for AWS-LC (which shares the BoringSSL lineage), and it added ML-KEM support relatively early, including key generation and encapsulation/decapsulation interfaces. When used as rustls’s CryptoProvider backend, it enables rustls to negotiate the X25519MLKEM768 hybrid key-exchange group — classical X25519 and ML-KEM-768 negotiated in parallel, with the shared secrets combined for derivation — which is exactly the scheme browsers and major CDNs already deploy on the public internet. In other words, shipping post-quantum TLS in Rust today requires waiting for nothing beyond the standard: rustls plus the aws-lc-rs provider is a walkable path.
The other route is to bypass the TLS stack entirely: use the ml-kem or oqs crates from earlier in this subcategory to do key encapsulation directly in a custom protocol. That suits non-TLS scenarios, but certificates, authentication, and session management are then all yours to solve — a completely different threshold.
First, Check by Hand: What Is Your Project Actually Using?
With the concepts separated, do an inventory of your existing project. Use cargo tree to check three things: which provider rustls actually selected (ring or aws-lc-rs), whether ring is a direct dependency or only arrives as a transitive dependency of rustls, and whether some other component — a default feature of an HTTP client, say — has quietly pulled in a second TLS implementation. A common real-world situation: the application layer chose rustls, but some dependency pulls in a native TLS binding by default, so the final binary contains two TLS stacks and the security policy covers only one of them. Only with a clear inventory does a post-quantum retrofit know where to cut.
Also remember ring’s boundary list: it does not do X.509 certificate parsing and chain verification (that is the domain of components such as rustls-webpki), does not do protocol state machines, and does not manage session resumption or tickets. These “does-nots” are not defects but division of labor — ring answers for primitive correctness and misuse resistance, while protocol correctness is rustls’s layer to carry. If you find yourself hand-rolling a handshake flow with ring, you have almost certainly chosen the wrong layer.
And a note on how aws-lc-rs and ring relate: they share ancestry (both from the BoringSSL lineage) but their maintainers and directions have diverged — ring pursues minimalism and stability, while aws-lc-rs, backed by AWS-LC, covers algorithms more aggressively and leads on FIPS validation and post-quantum support. This is not a matter of better or worse but of different goals: one is a “small and steady primitives library,” the other a “large and complete compliance-oriented cryptographic library.” Whichever side your compliance and algorithm needs fall on is the provider to choose.
A Common Misjudgment: Assuming a Backend Swap Is Trivial
Because rustls makes the backend pluggable, many teams assume switching from ring to aws-lc-rs is a one-line initialization change. At the interface level that is true, but at the engineering level there are three more bills to pay. The build bill: aws-lc-rs needs a C compiler and tools such as CMake, so CI and cross-compilation environments must be upgraded along with it, and container images rebuilt. The compliance bill: the two backends have different certification status (such as FIPS validation progress), so deployments with compliance requirements must re-verify against the target backend rather than reusing old conclusions. The behavior bill: the negotiable algorithm set changes, which changes the interoperability surface with older clients; before rollout, test handshakes against a real client matrix — especially after enabling the ML-KEM hybrid group, confirm that middleboxes do not choke on the larger ClientHello, a lesson the public internet deployment of hybrid key exchange has taught repeatedly. Settle these three bills first, then make the switch — that is the correct way to use a pluggable architecture.
Selection Summary
Ask three questions when deciding. First, do you need primitives or a protocol? Primitives: ring (classical) or ml-kem/oqs (post-quantum); protocol: rustls. Second, does your TLS need post-quantum key exchange? If yes, choose the aws-lc-rs backend; if not yet, the ring backend is lighter. Third, how much tolerance does your deployment environment have for FFI and build toolchains? aws-lc-rs brings a C build step, while the pure-Rust ring backend is easier for cross-compilation. Answer these three and ring and rustls fall into their places naturally. One last reminder: whichever backend you choose, before rollout verify from packet captures or handshake logs that the actually negotiated key-exchange group and signature algorithm match expectations — a correct configuration does not guarantee that is what runs in production, and this is doubly true for post-quantum hybrid groups, because client capabilities, server preference order, and middleboxes all influence the final negotiation result.
Tags: RustringrustlsTLS