Paper 2026/2653

Analyzing Compiler-induced Constant-time Violations with Compiler at Scale

Jing Liu
Lucía Martínez Gavier
Zhiyuan Zhang
Marcel Böhme
Gilles Barthe
Abstract

The constant-time programming policy is a de facto standard for cryptographic libraries to prevent timing side-channel attacks. However, compiler optimizations may break constant-time source code during compilation. Systematically preventing this requires understanding where a violation arises, how it is introduced, and which compiler configurations are problematic. Existing approaches analyze a single compilation point, either the final binary or one intermediate representation, and thus only partially answer the three questions. We propose CTGREP, a compiler-based framework that answers all three questions by applying differential analysis across the entire compilation chain. We use CTGREP to analyze seven complete cryptographic libraries across three Clang versions, six target platforms, and thousands of compiler configurations. We systematically detect compiler-induced constant-time violations in the wild and collaborate with library developers to address 48 cases. We further identify seven new problematic LLVM passes, bypass and improve the state-of-the-art compiler-flag-based mitigation. Finally, we quantify how the compiler version, target platform, and optimization configuration affect the violations. By covering entire libraries across the full compilation chain, CTGREP effectively detects remaining compiler-induced constant-time violations and complements the community's ongoing hardening efforts.

PDF
BibTeX
ePrint ↗
@misc{cryptoeprint:2026/2653,
      author = {Jing Liu and Lucía Martínez Gavier and Zhiyuan Zhang and Marcel Böhme and Gilles Barthe},
      title = {Analyzing Compiler-induced Constant-time Violations with Compiler at Scale},
      howpublished = {Cryptology {ePrint} Archive, Paper 2026/2653},
      year = {2026},
      url = {https://eprint.iacr.org/2026/2653}
}
Category
Implementation
License
CC BY
Submitted
Updated
Versions

Report a problem

Comments

Log in or create an account

Privacy