The Jasmin Compiler Preserves Cryptographic Security
Santiago Arranz-Olmos, Gilles Barthe, Lionel Blatter, Benjamin Grégoire, Vincent Laporte, Paolo Torrini · 2025
Read The Jasmin Compiler Preserves Cryptographic Security by Santiago Arranz-Olmos, Gilles Barthe, Lionel Blatter, Benjamin Grégoire, Vincent Laporte, Paolo Torrini (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2511-11292.txt.
Introduction
Santiago Arranz-Olmos, Gilles Barthe, and their colleagues study the Jasmin compiler. They prove it keeps the security of ML-KEM. ML-KEM is a key encapsulation method. The proven implementation is the one used in the Signal messenger.
Jasmin code is hand-tuned for speed. Compilation must not break correct behavior. It also must not break the strong security notion called KEM-IND-CCA. Both traits were proven earlier for the source code. The new proof is fully mechanized in the Rocq prover. Three general tools support it. One is a framework for game-based security under compilation. One is a new semantics for Jasmin and assembly based on interaction trees. It handles random choices and rejection sampling. The third is a relational Hoare logic for those trees.
Catalog record
| CREATOR | Santiago Arranz-Olmos, Gilles Barthe, Lionel Blatter, Benjamin Grégoire, Vincent Laporte, Paolo Torrini |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 106 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2511-11292
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
The Jasmin Compiler Preserves Cryptographic Security Santiago Arranz-Olmos, Gilles Barthe, Lionel Blatter, Benjamin Grégoire, Vincent Laporte, Paolo Torrini Abstract . Jasmin is a programming and verification framework for developing efficient, formally verified, cryptographic implementations. A main component of the framework is the Jasmin compiler, which empowers programmers to write efficient implementations of state-of-the-art cryptographic primitives, including post-quantum cryptographic standards. The Jasmin compiler is proven functionally correct in the Rocq prover. However, this functional correctness statement does not apply to nonterminating or probabilistic computations, which are essential features in cryptography. In this paper, we significantly enhance the guarantees of the compiler by showing, in the Rocq prover, that its front-end (25 out of 30 passes) preserves cryptographic security. To this end, we first define a Relational Hoare Logic tailored for compiler correctness proofs. We prove the soundness of our logic w.r.t. a new denotational semantics of Jasmin programs based on interaction trees. Secondly, we use our program logic to prove the functional correctness of the (unmodified) Jasmin compiler w.r.t. said semantics. Lastly, we formalize cryptographic security—focusing on IND-CCA—with interaction trees and prove that the Jasmin compiler preserves cryptographic security. Formalizing Cryptographic Security with ITrees and Proving Compiler Preservation with RHL 1. Introduction Security proofs are at the heart of modern cryptography: (almost) every new cryptographic scheme comes with a mathematical proof of security. However, these cryptographic schemes often eschew security critical components to focus on idealized schemes, sometimes known as cryptographic cores. The emphasis on cryptographic cores is primarily justified by the need to ensure that the overall analysis remains tractable with pen-and-paper proofs. However, this emphasis leads to dangerous gaps between security proofs and cryptographic schemes as well as between cryptographic schemes and their implementations. Both gaps can (and have been) exploited to launch devastating attacks on deployed cryptographic implementations ( Degabriele et al. 2011 ) . Computer-aided cryptography ( Barbosa et al. 2021 ) aims to address these gaps by developing and applying methods and tools for reasoning about cryptographic implementations, rather than cryptographic cores. To date, computer-aided cryptography has been used successfully to deploy high-assurance code in mainstream cryptographic libraries and applications. While these deployments avoid the pitfalls of reasoning on cryptographic cores, they still rely on the assumption that compilers preserve cryptographic security: (almost) all verifications are performed at source-level implementations, and implicitly assume that the security guarantees hold for assembly-level implementations. While reasonable, the assumption has never been established formally. This paper addresses this gap by proving that the Jasmin ( Almeida et al. 2017 ; Almeida et al. 2020 ) compiler front-end preserves cryptographic security. The proof is mechanized in the Rocq prover ( The Rocq Development Team 2025 ) , and provided as an artifact. Our choice of the Jasmin compiler is motivated by two reasons. First, Jasmin is a state-of-the-art framework for high-assurance high-speed cryptography. It has been used to write and verify many cryptographic implementations, and in particular a highly optimized, vectorized implementation of the post-quantum key encapsulation mechanism ML-KEM ( of Standards et al. 2024 ) , which was recently standardized by the National Institute of Standards and Technology (NIST)—a KEM is a special form of public-key encryption that is used by two parties to share a secret key. Secondly, the Jasmin compiler is formally specified and verified in the Rocq prover. This formalization provides an excellent starting point for our work. Proving that a compiler preserves cryptographic security requires two ingredients that have not been considered so far in the context of the Jasmin compiler, namely: • Probabilistic Semantics. Randomness is ubiquitous in cryptography; therefore, one must consider randomized programs, and equip them with a probabilistic semantics. Furthermore, many cryptographic implementations, and in particular post-quantum implementations, only achieve a probabilistic notion of termination, known as almost sure termination—meaning that the probability that execution diverges is zero. Therefore, one must extend the usual compiler correctness statements to account for such probabilistic behaviors. • Security Experiments. Most notions of cryptographic security are defined by security experiments, in which an adversary interacts with a challenger with access to the cryptographic system. Every security experiment also defines winning conditions, which determine when the adversary successfully broke the cryptographic system. Therefore, one must extend the usual compiler correctness statements to reason about winning probabilities in an interactive setting. We extend the Jasmin framework to support both ingredients, formalize them, and use the Rocq prover to show that the Jasmin compiler preserves cryptographic security. We elaborate on our main contributions below. Contribution 1: Relational Hoare Logic for Compiler Correctness In Section 4 , we define two Relational Hoare Logics (RHLs) for Jasmin programs. Our first logic is a core RHL akin to ( Benton 2004 ) . Our second logic elaborates on the first to be tailored for compiler correctness proofs: for instance, we update the notion of validity and provide specialized rules for common compiler patterns. This second logic forms the basis of our new proof of the Jasmin compiler. Both logics are proved sound w.r.t. a denotational semantics of programs. Concretely, our denotational semantics is based on the general framework of interaction trees ( Xia et al. 2020 ) . However, many of the ideas of our tailored RHL are independent of interaction trees and of Jasmin. Contribution 2: New Semantics and New Proofs for the Old Jasmin Compiler We leverage the framework of interaction trees to define a new semantics of Jasmin programs that accounts for infinite and probabilistic executions. Then, in Section 5 , we use our Relational Hoare Logic to lift the compiler correctness theorem of Jasmin to this new semantics. Critically, we do not modify the Jasmin compiler, and we largely reuse existing correctness proofs. Pleasingly, we employ the same generic RHL implementation to verify the entire front-end (spanning four intermediate languages), and our proofs involve no probabilistic reasoning (as interaction trees allow us to treat random sampling abstractly). A further benefit of our RHL is that, in spite of the more complex semantics, the correctness proofs are significantly shorter. Contribution 3: Security Experiments and Preservation of Cryptographic Security In Section 6 , we formalize security experiments with interaction trees, and we provide instantiations of security experiments where the adversary interacts with either a Jasmin implementation or its compilation. We apply the compiler correctness theorem to prove that the adversary cannot distinguish between a security experiment based on a source Jasmin implementation and the same experiment based on the compiled implementation. For concreteness, our theorem is stated for KEMs. Interestingly, our theorem underpins all assumptions that guarantee preservation of cryptographic security, including a new assumption about the well-initialization of return values. While retrospectively self-evident, this new assumption highlights the benefits of formally verified end-to-end security theorems in a unified framework. Limitations Our formalization does not yet cover the Jasmin compiler back-end, which comprises five passes, and is left for future work. Furthermore, preservation of cryptographic security is proven assuming the same adversary model for source and target programs—in contrast to robust compilation ( Abate et al. 2020 ) , which explicitly provisions for different adversary models between source and targets. However, one can connect with more concrete assembly-level adversarial models, as briefly discussed in the conclusion and will be reported