Paper 2025/338

CT-LLVM: Automatic Large-Scale Constant-Time Analysis

Zhiyuan Zhang
Gilles Barthe
Abstract

Constant-time (CT) is a popular programming discipline to protect cryptographic libraries against micro-architectural timing attacks. One appeal of the CT discipline lies in its conceptual simplicity: a program is CT iff it has no secret-dependent data-flow, control-flow or variable-timing operation. Thanks to its simplicity, the CT discipline is supported by dozens of analysis tools. However, a recent user study demonstrates that these tools are seldom used due to poor usability and maintainability (Jancar et al. IEEE SP 2022). In this paper, we introduce CT-LLVM, a CT analysis tool designed for usability, maintainability and automatic large-scale analysis. Concretely, CT-LLVM is packaged as a LLVM plugin and is built as a thin layer on top of two standard LLVM analysis: def-use and alias analysis. Besides confirming known CT violations, we demonstrate the usability and scalability of CT-LLVM by automatically analyzing nine cryptographic libraries. On average, CT-LLVM can automatically and soundly analyze 36% of the functions in these libraries, proving that 61% of them are CT. In addition, the large-scale automatic analysis also reveals new vulnerabilities in these libraries. In the end, we demonstrate that CT-LLVM helps systematically mitigate compiler-introduced CT violations, which has been a long-standing issue in CT analysis.

PDF
BibTeX
ePrint ↗
@misc{cryptoeprint:2025/338,
      author = {Zhiyuan Zhang and Gilles Barthe},
      title = {CT-LLVM: Automatic Large-Scale Constant-Time Analysis},
      howpublished = {Cryptology {ePrint} Archive, Paper 2025/338},
      year = {2025},
      url = {https://eprint.iacr.org/2025/338}
}
Category
Implementation
License
CC BY
Submitted
Versions

Report a problem

Comments

Log in or create an account

Privacy