
Announcing Verified Garbage, an experimental formally verified cryptography library
Verified Garbage is a new experimental cryptography library that writes assembly and formally verifies correctness, well-definedness, and constant-timeness, while supporting many algorithms and architectures.
Verified Garbage is a new experimental cryptography library that attempts to balance performance, security, verifiability, complexity, and cross-platform support. It writes cryptographic algorithms in assembly and formally verifies properties such as correctness, well-definedness, and constant-timeness. The library is also packaged as a Rust crate and includes a provider for rustls.
How the approach works
The work starts with Lean specifications for cryptographic algorithms such as AES-GCM and X25519, along with specifications for CPU instruction sets. Developers then write assembly for each algorithm on each architecture and prove that it matches the specification and is constant time under that instruction set. Constant-timeness means the instruction trace does not depend on secret inputs and no instruction handling secret data has data-dependent timing. Because the assembly is formally verified, it can be optimized aggressively without losing safety.
Coverage and platforms
Verified Garbage includes every cryptographic algorithm used by pyca/cryptography, all of them formally verified. It runs on x86, x86-64, ARMv7, ARM64, PPC64le, and RISCV64. The project also built a crypto provider for rustls and uses rustls benchmarks to measure end-to-end performance.
Benchmarks and performance
The benchmark suite measures every algorithm and compares Verified Garbage with other libraries. Tests ran on an AMD Ryzen 9 9950X with Ubuntu 26.04 pinned to one core, and on an Apple M1 Max with macOS 27. OpenSSL 4.1.0 built from source and AWS-LC 5.12.0 as bundled in aws-lc-rs 1.19.0 were used for comparison, with throughput reported relative to a 1.0 baseline for OpenSSL. The reported x86-64 and ARM64 results with modern extensions reflect the architectures the team optimized most. Benchmark categories included ML-KEM, ML-DSA, ECDH, ECDSA, RSA PKCS#1, RSA PSS, AES-128-GCM, ChaCha20Poly1305, SHA256, HMAC-SHA256, and Rustls TLS 1.3 handshakes and bulk data, with Rustls TLS 1.3 benchmarks using AWS-LC as baseline.
Trust, limitations, and next steps
Correctness depends on specifications for algorithms and instruction sets, which form the trusted computing base and were written by LLMs then reviewed by humans. The assembly and proofs are formally verified and do not require review. The authors describe two observations: given a trusted computing base, LLMs are effective at improving performance and verifying optimizations, and that base can be turned into a useful library. Future plans include further optimization across algorithms and architectures, and work to bolster trust in the trusted computing base, possibly by replacing LLM-authored specifications with community-maintained human-authored specifications. The authors also ask potential users what would make the library valuable. The maintainers do not currently plan to replace pyca/cryptography's use of OpenSSL, though they may consider it after further technical and social work. The name is an ironic reference to garbage in, garbage out and the view that many would consider the library to be slop. Verified Garbage is inspired by AWS s2n-bignum and credits graviola, Bobby Powers, and discussions at Real World Crypto and HACS.
Sources: verified-garbage.dev
SiTech — AI-powered web development
We build fast, modern websites and bring AI into real business workflows. Have a project or a question? We'd love to help.