TL;DR
EverCrypt is the first comprehensive, industrial-grade cryptographic library that is both mathematically proven to be secure and fast enough to rival (or beat) unverified state-of-the-art providers like OpenSSL. By using advanced formal verification, it offers a "best of both worlds" solution: the performance of hand-optimized assembly with the ironclad guarantees of formal proofs.
What Problem Does This Paper Address?
In the world of software, cryptographic code is the "linchpin" of security, yet it is notoriously difficult to write. It must be fast, but it must also be perfectly correct and resistant to "side-channel attacks" (where an attacker guesses a key by measuring how long an operation takes).
Historically, developers faced a grim choice:
- Use unverified libraries (like OpenSSL): These are incredibly fast but prone to bugs. OpenSSL’s
libcryptoreported 24 vulnerabilities in just three years. - Use verified libraries: Previous research produced "proven" code, but it was often limited to a single algorithm, supported only one platform, or was significantly slower than unverified alternatives.
Furthermore, modern apps need agility (the ability to swap a broken algorithm for a new one) and multiplexing (automatically choosing the fastest implementation for a specific CPU, like using AVX instructions on newer Intel chips). Doing this manually is error-prone and often leads to crashes or security holes.
Methods
The authors built EverCrypt using F*, a functional programming language designed for formal verification. Their approach relies on several key technical pillars:
- Low* and Vale: EverCrypt isn't just one language. It uses Low* to write high-level C-like code and Vale to write hand-tuned x64 assembly. Both are embedded in F*, allowing the authors to prove that the C code and assembly code work together perfectly.
- Zero-Cost Abstractions: Using "dependently typed generic programming," they wrote generic specifications for families of algorithms (like SHA-2). The F* compiler then "specializes" this into highly efficient, platform-specific C or assembly code at compile-time, ensuring no performance penalty at runtime.
- Agile & Abstract API: They designed a unified API that hides the complexity of implementation. A developer just calls
hash(), and EverCrypt automatically detects the CPU's features and picks the fastest verified implementation available. - Formal Proofs: Every line of code is proven for memory safety (no buffer overflows), functional correctness (it matches the mathematical spec), and side-channel resistance (it runs in "constant time").
Datasets
As a systems and cryptography paper, EverCrypt is evaluated against standard cryptographic benchmarks and test vectors rather than training datasets. The authors compared EverCrypt’s performance against:
- Unverified Providers: OpenSSL and
libsodium. - Verified Libraries: HACL*, ValeCrypt,
fiat-crypto, andlibjc. - Real-world Applications: They integrated EverCrypt into a Merkle-tree library (used in blockchains) and the QUIC network protocol to test "line-rate" performance.
Key Insights and Ideas
- Agility Simplifies Verification: Instead of verifying ten different hash functions separately, the authors factored out the common structure (the Merkle-Damgård construction). This reduced "specification bloat" and made the proofs more robust.
- Assembly is a First-Class Citizen: They proved that you don't have to sacrifice assembly-level optimizations for safety. By porting OpenSSL’s complex, interleaved assembly for AES-GCM into their verified framework, they achieved identical speeds.
- The "Multiplexing" Safety Net: EverCrypt solves the "illegal instruction" problem. It provably checks CPU capabilities (CPUID) before running optimized code, falling back to a verified C implementation if the hardware doesn't support specific extensions.
- Vulnerability Prevention: The authors analyzed 24 recent OpenSSL CVEs and concluded that EverCrypt’s methodology would have prevented 23 of them by construction.
Key Results
- Performance: EverCrypt’s Curve25519 implementation is the fastest on record (verified or unverified), narrowly beating the previous best by 1%. Its AES-GCM is 6x faster than previous verified versions, matching OpenSSL's speed.
- Scale: The project involves over 124,000 lines of formal specifications, code, and proofs.
- Real-World Utility:
- Merkle Trees: Their verified implementation supports 2.7 million insertions per second, outperforming the unverified Bitcoin Core implementation by 40%.
- QUIC Protocol: Their verified transport layer supports "line-rate" speeds, proving that verified crypto is ready for high-traffic internet infrastructure.
Limitations and Future Work
- Algorithm Support: EverCrypt currently lacks support for older but still widely used algorithms like RSA and DES.
- Platform Support: While the C code is cross-platform, the high-performance assembly optimizations are currently limited to x64 platforms. The authors plan to target ARM in the future.
- Proof Scope: The paper focuses on functional correctness (the code does what the math says). It does not yet include cryptographic proofs (e.g., proving that an algorithm is mathematically "unbreakable" under certain assumptions), though the authors view this as a logical next step.
- Randomness: The library does not yet provide a verified API for generating random numbers, as this requires modeling non-deterministic hardware instructions.
Summary updated