Certifying derivation of state machines from coroutines
Mirai Ikebuchi, Andres Erbsen, Adam Chlipala
Abstract
One of the biggest implementation challenges in security-critical network protocols is nested state machines. In practice today, state machines are either implemented manually at a low level, risking bugs easily missed in audits; or are written using higher-level abstractions like threads, depending on runtime systems that may sacrifice performance or compatibility with the ABIs of important platforms (e.g., resource-constrained IoT systems). We present a compiler-based technique allowing the best of both worlds, coding protocols in a natural high-level form, using freer monads to represent nested coroutines , which are then compiled automatically to lower-level code with explicit state. In fact, our compiler is implemented as a tactic in the Coq proof assistant, structuring compilation as search for an equivalence proof for source and target programs. As such, it is straightforwardly (and soundly) extensible with new hints, for instance regarding new data structures that may be used for efficient lookup of coroutines. As a case study, we implemented a core of TLS sufficient for use with popular Web browsers, and our experiments show that the extracted Haskell code achieves reasonable performance.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext a080ec5e-3c33-423f-bc58-2a8aeb7a2fcaCited by top-tier papers2
- Foundational Integration Verification of a Cryptographic ServerAndres Erbsen, Jade Philipoom, Dustin Jamner, Ashley Lin et al.PLDI 2024 · 8 citations
- OwlC: Compiling Security Protocols to Verified, Secure, High-Performance LibrariesPratap Singh, Joshua Gancher, Bryan ParnoUSENIX Security 2025
Builds on5
- Simple High-Level Code for Cryptographic Arithmetic - With Proofs, Without CompromisesAndres Erbsen, Jade Philipoom, Jason Gross, Robert Sloan et al.S&P 2019 · 147 citations
- Interaction trees: representing recursive and impure programs in CoqLi-yao Xia, Yannick Zakowski, Paul He, Chung-Kil Hur et al.POPL 2020 · 133 citations
- EverCrypt: A Fast, Verified, Cross-Platform Cryptographic ProviderJonathan Protzenko, Bryan Parno, Aymeric Fromherz, Chris Hawblitzel et al.S&P 2020 · 114 citations
- Verified Correctness and Security of mbedTLS HMAC-DRBGKatherine Q. Ye, Matthew Green, Naphat Sanguansin, Lennart Beringer et al.CCS 2017 · 59 citations
- Perceus: garbage free reference counting with reuseAlex Reinking, Ningning Xie, Leonardo de Moura, Daan LeijenPLDI 2021 · 31 citations
Related papers
- Noise*: A Library of Verified High-Performance Secure Channel Protocol ImplementationsSon Ho, Jonathan Protzenko, Abhishek Bichhawat, Karthikeyan BhargavanS&P 2022 · 22 citations
- CryptOpt: Verified Compilation with Randomized Program Search for Cryptographic PrimitivesJoel Kuepper, Andres Erbsen, Jason Gross, Owen Conoly et al.PLDI 2023 · 12 citations
- Formal Security and Functional Verification of Cryptographic Protocol Implementations in RustKarthikeyan Bhargavan, Lasse Letager Hansen, Franziskus Kiefer, Jonas Schneider-Bensch et al.CCS 2025 · 1 citation
- Hyperblock Scheduling for Verified High-Level SynthesisYann Herklotz, John WickersonPLDI 2024 · 3 citations
- Verified Extraction from Coq to OCamlYannick Forster, Matthieu Sozeau, Nicolas TabareauPLDI 2024 · 13 citations
