When an LLM writes cryptographic code, what should you base your trust on? On November 28, 2026, two maintainers of pyca/cryptography released Verified Garbage, an experimental cryptography library that uses formal verification to check assembly written by LLMs (announcement). It is one concrete answer to the question of how to establish the safety of AI-generated code. This article introduces the approach, which places trust in specifications and proofs, and separates what has been proven from what has not.
How it works: specifications in Lean, formally verified assembly
According to the announcement, Verified Garbage starts by writing, in Lean, specifications for cryptographic algorithms (such as AES-GCM or X25519) and specifications for CPU instruction sets that model their instructions and behaviors. Each algorithm is then implemented in assembly for each architecture, and that assembly is proven to be equivalent to the specified algorithm and to be constant time. The authors name three properties they verify, namely correctness, well-definedness, and constant-timeness, and say the approach is inspired by AWS's s2n-bignum (announcement). The README explains constant time as meaning that the sequence of instructions executed and the memory addresses accessed do not depend on secrets (README).
The library targets six architectures: x86, x86-64, ARMv7, ARM64, PPC64LE, and RISC-V (RV64GC). The README's tables show, for each algorithm, whether its specification exists and whether verified assembly and a public Rust API exist on each architecture. In the README for version 0.1.0, every row is marked for all six architectures. What differs by architecture is whether there are additional implementations that use instruction set extensions such as AVX2 or the SHA extensions (README).
According to the authors, the specifications, the assembly, and the proofs were all written by LLMs. In the announcement, the authors call the specifications for the cryptographic algorithms and the instruction sets their trusted computing base (TCB). The authors say that the assembly and proofs are formally verified and so do not require review, whereas the specifications must be reviewed by hand, and they explain that the specifications were written by LLMs and then reviewed by humans (announcement, "Conclusion"). The authors themselves write that the correctness of the library depends on the correctness of the specifications. What the proofs show is agreement with the specifications, not that the specifications themselves are correct. As one option for the future, the authors mention replacing the LLM-authored specifications with community-maintained, human-authored specifications for cryptographic algorithms (same post, "What’s next?").

What lies outside the formal verification
The README states which parts are not proven and which assumptions the proofs rest on (how it works, what is not verified, what the constant-time guarantee assumes).
- The public Rust APIs are Rust code that composes the verified functions; that code is tested, not proven. According to the README, most of it only lays out buffers, but in some algorithms it does part of the cryptography. For AES-GCM, the length limits and the order of the streaming calls are checked in Rust (the mode itself is verified end to end). For HMAC with a key longer than a block, hashing the key first is done in Rust.
- The constant-time proofs rest on an assumption about the CPU: that the timing of each instruction itself does not depend on its data. On AArch64 the proofs assume that
PSTATE.DITis 1. According to the README, on CPUs withFEAT_DITthe library sets it while any operation that may process secrets runs; for CPUs withoutFEAT_DIT, Arm makes no timing statement at all. On x86 and x86-64 they rely on guidance from Intel, and the README says this guidance covers only Intel's Core and Atom processors and does not include processors such as AMD's. - Speculative execution is outside the model. The README says that nothing shows the code is free of Spectre-class attacks and that the code contains no mitigations aimed at them.
- Some operations, such as scrypt's ROMix, have a contract that declares what they are allowed to leak.
Neither the announcement nor the README mentions an external security audit. The authors themselves write that this is a new library, that it is an experiment in whether this approach is an effective one, and that it will benefit from time and feedback.
Release status and performance
The announcement points to two crates published on crates.io: verified-garbage and rustls-verified-garbage, a provider for rustls (supporting crates, such as those holding the per-architecture assembly, are also published on crates.io). As of our check on November 30, 2026, both of these are at version 0.1.0 (published on November 28). The license is a choice between Apache-2.0 and BSD-3-Clause (verified-garbage on crates.io, rustls-verified-garbage on crates.io, CHANGELOG, Cargo.toml). Asked whether they plan to replace pyca/cryptography's use of OpenSSL, the authors answer "Not at the moment." They add that it is on their minds, but that there is a lot of work to do, both technical and social, before they would consider it (announcement, "Frequently Asked Questions").
The performance figures were measured by the authors on two machines: an AMD Ryzen 9 9950X (Ubuntu 26.04, pinned to one core) and an Apple M1 Max (macOS 27). The numbers are throughput relative to a baseline of 1.0 for OpenSSL 4.1.0 built from source. Only the rustls benchmarks use a different baseline: AWS-LC 5.12.0 as bundled in aws-lc-rs 1.19.0 (announcement, "Benchmarks"). In the ML-KEM charts, for example, Verified Garbage ranges from 2.82 to 11.1 times the baseline on the Ryzen and from 3.18 to 14.8 times on the M1 Max. The maximums, 11.1 and 14.8, are both for ML-KEM-768 key generation, so not every operation is this fast. In the AES-128-GCM charts, on the other hand, some bars fall below the baseline, such as decryption of 1 MiB (that bar has no numeric label; this is a reading of the chart).
The numbers are ratios of throughput, not a comparison of security, and all of them are the authors' own measurements. The authors note that the relative performance of cryptographic libraries can vary depending on the instruction set and on which extensions a CPU supports, and that the data they present (x86-64 and ARM64 with modern extensions) represents a target on which they have spent the most time and energy optimizing.
What to check when judging the safety of AI-generated code
We recommend that companies handling code written by LLMs check the following points.
- Have you decided what you base your trust on for LLM-written code (tests, review, or specifications and proofs)?
- Are the specifications themselves reviewed by humans?
- Have you listed the parts that fall outside the proofs and tests?
- Do you read performance figures together with the machines measured and the baseline used?
Place trust not in the LLM's output itself but in specifications and proofs that can be checked. This way of thinking is also a useful reference when handling AI-generated code outside cryptography.
Elith builds AI products for enterprises and conducts advanced research on a foundation of AI safety and security. We share trends in AI safety and security and insights from research and practice in Elith AI Signal. We will keep reading announcements like this one against primary sources and reporting on them.

