Paper 2026/2653

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

Jing Liu, Max Planck Institute for Security and Privacy
Lucía Martínez Gavier, Max Planck Institute for Security and Privacy
Zhiyuan Zhang, Max Planck Institute for Security and Privacy
Marcel Böhme, Max Planck Institute for Security and Privacy
Gilles Barthe, Max Planck Institute for Security and Privacy
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.

Metadata
Available format(s)
PDF
Category
Implementation
Publication info
Published elsewhere. Minor revision. IEEE Symposium on Security and Privacy 2027
Keywords
Constant-timeCompiler OptimizationSide-channel Security
Contact author(s)
jing liu @ mpi-sp org
lucia martinez-gavier @ mpi-sp org
zhiyuan zhang @ mpi-sp org
marcel boehme @ acm org
gilles barthe @ mpi-sp org
History
2026-10-27: approved
2026-10-26: received
See all versions
Short URL
https://ia.cr/2026/2653
License
Creative Commons Attribution
CC BY

BibTeX

@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}
}
Note: In order to protect the privacy of readers, eprint.iacr.org does not use cookies or embedded third party content.