Verified Garbage: An experimental formally verified cryptography library
Cryptography library developers often grapple with trade-offs between performance, security, and verifiability. Writing code in assembly can boost performance but makes it difficult to review and ensure correctness. High-level languages, on the other hand, are easier to work with but can introduce issues like buffer overflows. Verified Garbage is an experimental cryptography library designed to address these challenges by writing code in assembly and rigorously verifying its properties, such as correctness, well-definedness, and constant-timeness.
This approach is inspired by AWS's s2n-bignum library and enables the use of large language models (LLMs) to implement sophisticated optimizations with confidence in correctness. The library starts with Lean specifications for cryptographic algorithms and CPU instruction sets, followed by assembly implementation and formal proofs to ensure equivalence with the specified algorithms and constant-time behavior.
Benchmark results show the library's performance on AMD Ryzen 9 9950X and Apple M1 Max, comparing it to OpenSSL 4.1.0 and AWS-LC 5.12.0. While the library's performance may vary depending on the instruction set, it represents a target for optimized implementation. The library's specifications, written by LLMs and reviewed by humans, form the trusted computing base and require human review.
The developers aim to continuously optimize the library for every algorithm and architecture and explore ways to bolster trust in the Trusted Computing Base (TCB), such as potentially replacing LLM-authored specifications with community-maintained, human-authored ones. The library, written as a Rust library, is available on crates.io and can be used in TLS with a rustls provider.
The project underscores the developers' commitment to building a trustworthy cryptography library and welcomes feedback and ideas from potential users.
Rewritten by urgent.news; may contain errors — check the original.
Source: verified-garbage.dev