This repository contains the implementation of the techniques described in the paper "Side-Channel Elimination via Partial Control-Flow Linearization", which is currently under review. Partial control-flow linearization is a code transformation technique invented by folks from Saarland-U's Compiler Design Lab to maximize work performed in vectorized programs. In this paper, we find a new service for it. We show that partial control-flow linearization protects programs against timing attacks. This transformation delivers many good properties:
- It is sound: given an instance of its public inputs, the partially linearized program always runs the same sequence of instructions, regardless of secret inputs.
- If the original program is publicly safe, then accesses to the data cache will be data oblivious in the transformed code.
- It is optimal: every branch that depends on some secret data is linearized; no branch that depends on only public data is linearized.
- It preserves loops that depend on public information. If every branch that leaves a loop depends on secret data, then the transformed program will not terminate.