Preservation of Speculative Constant-Time by Compilation
Open Access
- 7 January 2025
- journal article
- Published by Association for Computing Machinery (ACM) in Proceedings of the ACM on Programming Languages
- Vol. 9 (POPL) , 1293-1325
Abstract
Compilers often weaken or even discard software-based countermeasures commonly used to protect programs against side-channel attacks; worse, they may also introduce vulnerabilities that attackers can exploit. The solution to this problemis to develop compilers that preserve such countermeasures. Prior work establishes that (a mildly modified version of) the CompCert and Jasmin formally verified compilers preserve constant-time, an information flow policy that ensures that programs are protected against timing side-channel attacks. However, nothing is known about preservation of speculative constant-time, a strengthening of the constant-time policythat ensures that programs are protected against Spectre-v1 attacks. We first show that preservation of speculative constant-time fails in practice by providing examples of secure programs whose compilation is not speculative constant-time using GCC (GCC -O0 and GCC -O1) and Jasmin. Then, we define a proof-of-concept compiler that distills some of the critical passes of the Jasmin compiler and use the C oq proof assistant to prove that it preserves speculative constant-time. Finally, we patch the Jasmin speculative constant-time type checker and demonstrate that all cryptographic implementations written in Jasmin can be fixed with minimal impact.Keywords
Funding Information
- Deutsche Forschungsgemeinschaft (EXC 2092 CASA - 390781972)
- Agence Nationale de la Recherche (ANR-22-PECY-0006)
This publication has 52 references indexed in Scilit:
- TeeJam: Sub-Cache-Line Leakages Strike BackIACR Transactions on Cryptographic Hardware and Embedded Systems, 2023
- An Extended Account of Trace-relating Compiler Correctness and Secure CompilationACM Transactions on Programming Languages and Systems, 2021
- Compiling Sandboxes: Formally Verified Software Fault Isolation2019
- CacheBleed: a timing attack on OpenSSL constant-time RSAJournal of Cryptographic Engineering, 2017
- A survey of microarchitectural timing attacks and countermeasures on contemporary hardwareJournal of Cryptographic Engineering, 2016
- Lucky Microseconds: A Timing Attack on Amazon’s s2n Implementation of TLS2016
- Certified Complexity (CerCo)2014
- Efficient Cache Attacks on AES, and CountermeasuresJournal of Cryptology, 2009
- Faster and Timing-Attack Resistant AES-GCM2009
- Timing Attacks on Implementations of Diffie-Hellman, RSA, DSS, and Other Systems1996