Constantine: Automatic Side-Channel Resistance Using Efficient Control and Data Flow Linearization

Pietro Borrello, Daniele Cono D'Elia, Leonardo Querzoni, Cristiano Giuffrida
4/21/2021
cs.CRcs.PL

Official code: pietroborrello/constantine (85 stars, C, Apache-2.0, last commit 2025-11-03).

Abstract

In the era of microarchitectural side channels, vendors scramble to deploy mitigations for transient execution attacks, but leave traditional side-channel attacks against sensitive software (e.g., crypto programs) to be fixed by developers by means of constant-time programming (i.e., absence of secret-dependent code/data patterns). Unfortunately, writing constant-time code by hand is hard, as evidenced by the many flaws discovered in production side channel-resistant code.

Show full abstract

Prior efforts to automatically transform programs into constant-time equivalents offer limited security or compatibility guarantees, hindering their applicability to real-world software. In this paper, we present Constantine, a compiler-based system to automatically harden programs against microarchitectural side channels. Constantine pursues a radical design point where secret-dependent control and data flows are completely linearized (i.e., all involved code/data accesses are always executed). This strategy provides strong security and compatibility guarantees by construction, but its natural implementation leads to state explosion in real-world programs. To address this challenge, Constantine relies on carefully designed optimizations such as just-in-time loop linearization and aggressive function cloning for fully context-sensitive points-to analysis, which not only address state explosion, but also lead to an efficient and compatible solution. Constantine yields overheads as low as 16% on standard benchmarks and can handle a fully-fledged component from the production wolfSSL library.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Constantine is a compiler-based system to automatically harden programs against microarchitectural side channels

8512C, C++Apr 21, 20211 years agoApache-2.0

Similar Papers

Cite this paper

@article{borrello2021constantine,
  title  = {Constantine: Automatic Side-Channel Resistance Using Efficient Control and Data Flow Linearization},
  author = {Pietro Borrello and Daniele Cono D'Elia and Leonardo Querzoni and Cristiano Giuffrida},
  year   = {2021},
  eprint = {2104.10749},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2104.10749}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2104.10749.svg)](https://codeofpaper.com/paper/2104.10749)

Discussion