Make post-quantum cryptography updates routine with AWS-LC

Post Syndicated from Josh Williams original https://aws.amazon.com/blogs/security/make-post-quantum-cryptography-updates-routine-with-aws-lc/

As your organization plans upgrades to post-quantum cryptography (PQC), you should also think about cryptographic agility to more easily update algorithms used to protect your data. Changes to cryptography and related protocols aren’t new, but PQC is accelerating the pace at which organizations must add new algorithms and remove old ones to keep up with changing regulations and evolving business risk. AWS believes our key to success is standardizing on one cryptographic library that embodies three key properties: compatibility, assurance, and performance. In this blog post, you’ll learn how we think of the cost and friction of ongoing cryptographic updates in terms of these properties. You’ll learn how AWS built AWS-LC to embody these properties, thus making cryptographic upgrades straightforward and low-impact for ourselves and our customers. For custom applications where you can’t yet use AWS services and must operate your own stacks, this post also shares why you might consider using AWS-LC as your standardized library.

Every cryptographic algorithm used to protect your data today has an expiration date, even if no regulator has set one yet. Algorithms that were once the standard, such as MD5 and SHA-1, have been retired. Standards are revised and flaws are found in implementations. The move to post-quantum cryptography is the current wave of changes, with dates set by governments and regulators to complete the transition. PQC itself will progress in phases to enable hybrid and pure post-quantum algorithms and then deprecate traditional cryptography. Each change reaches your systems as a software library update, so the practical question is how often you can roll out a new version of your cryptographic library, and what each rollout costs. At AWS, we think of this cost in terms of three properties. Compatibility means an update doesn’t require application changes. Assurance means new code can be trusted when it ships, without a long bake period. Performance means a new algorithm doesn’t add so much computational overhead or latency that it gives teams a reason to wait. This post describes how AWS-LC provides each property, and how you can apply the same approach to the cryptography you own.

AWS-LC is the general-purpose cryptographic library that AWS maintains and uses across its services. It is derived from BoringSSL, which originated from OpenSSL. If you’ve called an AWS API, AWS-LC was used on the server side. Through s2n-tls, it provides hybrid post-quantum key exchange on AWS service endpoints and in services like Application Load Balancer and Network Load Balancer. It’s also the cryptography under aws-lc-rs for Rust, the default provider for rustls, and under the Amazon Corretto Crypto Provider for Java. Because so much of AWS depends on one library, we built it to be updated often. AWS-LC keeps an OpenSSL-compatible API so applications can replace algorithms without a rewrite. It uses formal verification to prove selected algorithm implementations correct. It optimizes algorithm implementations to reduce the latency and compute costs that new algorithms add. The same properties work outside AWS. For example, 1Password used AWS-LC to move its clients to hybrid post-quantum key exchange with no application code changes.

Hand off what you can, standardize what you keep

Each piece of cryptography you own is one more thing to change at every transition. By owning as little of your cryptographic stack as your constraints or requirements allow, and using AWS services to manage the rest, you can minimize your ongoing responsibility and operational risk.

If your workload relies solely on managed services like AWS Key Management Service (AWS KMS) and managed resources like Elastic Load Balancer or Amazon Relational Database Service (Amazon RDS), you’re already reaping the benefits of AWS-LC and the AWS shared responsibility model. You only need to keep your clients and resource configurations updated. Many organizations can rely on AWS to provide the infrastructure and basic automation, but still own and manage the endpoints and applications where most of the work happens. For these components, it’s helpful to standardize on as few cryptographic libraries as possible. With fewer libraries, your team learns each one well: how to configure it, run it, and update it. The library you standardize on also decides how often you can update it. If an update requires application changes, ships new code that no one trusts yet, or adds compute and latency, teams have a reason to wait. In the rest of this post, we show you how AWS-LC removes each of those reasons through compatibility, assurance, and performance.

Compatibility

The best library update is one that doesn’t impact your application and that your users don’t notice. Code changes happen at three points: adopting a library, adding an algorithm, and updating the library. AWS-LC keeps each one small.

  • Adopting AWS-LC  – For TLS, AWS-LC libssl keeps an OpenSSL-compatible API, so most applications that use OpenSSL for TLS build against it with small changes. Applications that call libcrypto directly might need more work, because the AWS-LC libcrypto API differs from OpenSSL’s in places. See the porting guide for where behavior differs.
  • Adding an algorithm  – When new algorithms are added in AWS-LC behind interfaces applications already call, s2n-tls, s2n-quic, aws-lc-rs, and the Amazon Corretto Crypto Provider adopt them automatically. Hybrid ML-KEM key exchange, for example, is enabled through existing TLS configuration APIs. For 1Password, that meant a one-line Cargo.toml change and no application code changes.
  • Updating the library – AWS-LC long-term support (LTS) releases keep a stable application binary interface (ABI). Applications link once, then take library updates without a rebuild. One update reaches every application on the host when each process restarts. The Amazon Linux 2027 preview uses this method to ship AWS-LC as a system library.

We built these properties so AWS services could move to AWS-LC with minimal effort. aws-lc-rs is also used by open source projects; it’s the default cryptography provider for rustls with over 100 million downloads in the past 90 days, CPython tests against AWS-LC in continuous integration, and HAProxy publishes packages built on it. Each new use surfaces problems earlier in the update process, and every fix is recorded in one codebase.

Assurance

Every new algorithm arrives as new code, and new code is where bugs and security vulnerabilities are usually found. If you can’t trust new code when it ships, you wait, and each wait delays the next change. Tests check the inputs you run, and proofs check every input. AWS-LC uses machine-checked proofs for its most critical code, including its post-quantum algorithms and parts of its classical algorithms, such as its 25519 elliptic-curve code.

AWS-LC contributes to and takes its ML-KEM and ML-DSA code from two open source projects: mlkem-native and mldsa-native. The algorithmic implementations in these projects already incorporate formal verification safeguards such as ensuring no out of bound memory access, no integer overflows, constant assembly run time, and functional correctness using tools like CBMC and HOL Light (for more information, see Verifying and optimizing post-quantum cryptography at Amazon). AWS-LC imports this code from upstream without changing it. The proofs don’t depend on instruction order, so the assembly can be re-optimized without redoing them. That prevents verification from becoming the reason a faster implementation waits. Other cryptographic implementations of the library are verified in s2n-bignum.

We use these proofs alongside testing and FIPS validation. For workloads that require FIPS 140-3, a validated module is required to allow new code to be deployed. AWS-LC FIPS 3.0 was the first cryptographic library to include ML-KEM in a FIPS 140-3 validation. ML-DSA, the NIST post-quantum signature standard (FIPS 204), is in the AWS-LC FIPS 4.0 module, and the FIPS 5.0 module includes the faster, formally verified mldsa-native implementation. Both have been submitted to NIST for validation.

Performance

A new algorithm that costs more to run gives teams a reason to delay, and across many connections a small cost per connection adds up. AWS-LC optimizes each algorithm it adds so that cost doesn’t delay the update. Amazon Science reports 2.0 to 2.4 times more ML-KEM operations per second than the reference implementations across Amazon Elastic Compute Cloud (Amazon EC2) instance types. Earlier work applied the same approach to 25519 elliptic-curve cryptography. The optimized code is covered by the proofs described in the previous section, so speed doesn’t reduce assurance.

ML-DSA followed the same path. AWS-LC moved from its original implementation to mldsa-native, with optimized assembly for AArch64 and x86_64 platforms, and it now signs and verifies faster on both Graviton and x86 EC2 instance types. As a result, compute is no longer the main cost of post-quantum signatures: in the measurements in the following section, we show that ML-DSA-44 certificates lowered average TLS handshake latency compared with RSA-2048. What remains is size, which the next section measures.

What it costs to move

AWS services handle billions of requests every second, so anything that could affect those requests must be carefully considered. Post-quantum cryptography impacts the performance of every new TLS connection, so before we adopted ML-KEM and ML-DSA, we invested heavily in making them fast. Figure 1 shows the resulting reduction in time for both key exchange and authentication. Today, moving to PQ confidentiality has no net cost for most AWS use-cases, and PQ authentication takes less compute than the RSA certificates we use today.

Figure 1. ML-KEM-768 and ML-DSA-87 time per handshake, before and after AWS-LC’s native implementations, on AWS Graviton4

Figure 1. ML-KEM-768 and ML-DSA-87 time per handshake, before and after AWS-LC’s native implementations, on AWS Graviton4

ML-KEM-768 key exchange decreased by over 50 percent on both the client and the server (as shown in Figure 1); we described how in Verifying and optimizing post-quantum cryptography at Amazon. In this post, we’re focusing on ML-DSA. In AWS-LC v1.49.1, ML-DSA used the original AWS-LC implementation, adapted from the reference code. In v5.10.0, it runs on mldsa-native, which implements the performance-critical kernels in hand-written Arm64 Neon assembly for AWS Graviton, including: the number-theoretic transform (NTT) and its inverse, tuned for Arm cores with the SLOTHY superoptimizer, along with pointwise multiplication, rejection sampling, and the decompose, hint, and norm-check steps of signing and verification. It also expands the public matrix four entries at a time using the AWS-LC four-way parallel SHA-3 (Keccak). These optimizations, as shown in the right half of Figure 1, reduced ML-DSA-87 signing time on the server and verification time on the client, and the same assembly is covered by the formal proofs described earlier. mldsa-native is open source, part of the PQ Code Package in the Linux Foundation’s Post-Quantum Cryptography Alliance (PQCA), and the AWS Cryptography team and Amazon Automated Reasoning Group contribute to it.

Figure 2. TLS 1.3 connection setup time by algorithm, between two AWS Graviton4 hosts in the same Availability Zone

Figure 2. TLS 1.3 connection setup time by algorithm, between two AWS Graviton4 hosts in the same Availability Zone

Figure 2 shows total handshake time for various configurations, when the client and server are in the same AWS Region. For a baseline, we used TLS performance when the server prioritized ECDHE with P-256 for key exchange and RSA-2048 certificates for authentication. With the optimizations to ML-KEM, there is negligible overhead from moving to hybrid ML-KEM key exchange (the second bar from left). The hybrid key exchange preferred in AWS systems today pairs X25519 with ML-KEM-768. X25519 is faster than P-256, and that saving covers the remaining ML-KEM work, so a full connection setup takes roughly 12 microseconds more, which doesn’t meaningfully impact throughput or latency. It’s worth noting here that ML-KEM-768 introduces approximately 2.3 KB to the handshake.

PQ authentication carries more risk, because authentication is more of the handshake cost. The server signs once for each handshake, and the client verifies three signatures: the server’s handshake signature, the signature on the leaf, and the signature on the intermediate certificate. RSA-2048 signing is expensive and verification is inexpensive. ML-DSA-87 reverses that balance, shifting some work from the server to the client.

ML-DSA keys and signatures are also much larger, so the server’s handshake messages grow from 4–7 KB to 17–24 KB depending on the chosen certificate parameters. That adds certificate parsing on the client and more data to encrypt and send on the server. Within an Availability Zone, those messages still arrive in one round trip, and we measured no difference in network time between configurations.

Compared to RSA 2048, which is still prevalent today, ECDSA offers faster processing. However, both must be replaced by ML-DSA for post-quantum authentication. With the optimizations in AWS-LC, ML-DSA-44 comes close to ECDSA, and every ML-DSA parameter set is significantly faster than RSA-2048, as shown in Figure 2. As a result, we’re confident in managing the performance impact from migrating to post-quantum certificates.

Another facet of our investments in reducing performance impact is session resumption. Handshake costs apply only to new connections. Session resumption reduces how often that cost is paid. A resumed TLS 1.3 handshake authenticates with a key from the earlier session and sends no certificates or signatures, so the larger ML-DSA keys and signatures apply only to full handshakes. We’ll note here that in psk_dhe_ke mode, the resumed handshake still runs a fresh hybrid ML-KEM key exchange, which preserves forward secrecy. Now, resumption only helps if the client can present its ticket to any server behind the endpoint, so AWS has been extending support for resumption across the hosts behind its service endpoints. AWS SDKs can reuse connections across many requests, and session resumption can skip certificates and signatures entirely, which gives the most performance benefit for workloads using AWS managed services. If you’re using AWS-LC directly in your own custom applications, consider keeping session tickets enabled, prefer TLS 1.3 with psk_dhe_ke, and reuse clients so that they keep their tickets between connections.

Conclusion

Every cryptographic choice has an expiration date, so the goal isn’t to pick the right algorithm once and never replace or update it, but to make each replacement routine. Start by handing off what you can to AWS services and standardizing what you keep on as few libraries as possible. For the cryptography you own, three properties decide how quickly and how often you can implement each update. For compatibility, new algorithms arrive behind the APIs your applications already call, and long-term support releases keep a stable ABI, so adopting one takes a library update and a restart, not a rebuild. For assurance, machine-checked proofs cover a library’s most critical code, ML-KEM is inside a FIPS 140-3 validated module, and ML-DSA is in modules submitted for validation. For performance, optimized implementations keep each new algorithm from adding compute or latency that might give teams a reason to wait. Post-quantum cryptography is the change in front of us now, and it won’t be the last.

If you have questions about this post, contact AWS Support or start a new thread on AWS re:Post.


Josh Williams

Josh Williams

Josh is a Software Engineering Manager in AWS Cryptography, where he leads the team that builds AWS-LC. His team’s work spans post-quantum algorithms, formal verification, and performance optimization. He previously led teams in AWS Networking and Amazon Aurora DSQL and brings broad experience in ecommerce and distributed systems.

Jake Massimo

Jake Massimo

Jake is an Applied Scientist on the AWS Cryptography team, where he bridges Amazon with the global cryptographic community through active participation in international conferences, academic research, and standards organizations. His work focuses on advancing the adoption of post-quantum cryptographic technology at cloud scale. Currently, he leads the development of optimized and formally verified post-quantum algorithms within the AWS cryptographic library.

Rohit Panjala

Rohit is a Senior Security Specialist at AWS, driving go-to-market (GTM) strategy on a global scale for AWS data protection services, including keys, certificates, secrets, and post-quantum cryptography. He brings 7 years of experience in cybersecurity and cloud, with a background in security product management at IBM and electrical engineering.