一句话:将部分控制流线性化用于安全,使程序执行路径不依赖秘密,从而消除时序侧信道。
本文把原本用于向量化程序的“部分控制流线性化”代码变换用于安全领域。该变换会线性化所有依赖秘密数据的分支,使同一公开输入下的程序无论秘密输入如何都执行相同指令序列,从而抵御时序攻击;若原程序公开安全,变换后数据缓存访问也对数据不敏感。其优势是无需剖析信息即可保证操作不变性,并能处理编译期未知循环次数的程序,以及 C 的 goto、break、switch、continue 等结构。变换在依赖秘密的分支上完全线性化,对仅依赖公开数据的分支和循环则不线性化;但若离开循环的分支均依赖秘密,变换后程序可能不终止。论文通过形式性质与与 FaCT、Constantine、SC-Eliminator、Lif 等工作的对比展示其扩展性。
Partial control-flow linearization is a code transformation conceived to maximize work performed in vectorized programs. In this article, we find a new service for it. We show that partial control-flow linearization protects programs against timing attacks. This transformation is sound: Given an instance of its public inputs, the partially linearized program always runs the same sequence of instructions, regardless of secret inputs. Incidentally, if the original program is publicly safe, then accesses to the data cache will be data oblivious in the transformed code. The transformation is optimal: Every branch that depends on some secret data is linearized; no branch that depends on only public data is linearized. Therefore, the transformation preserves loops that depend exclusively on public information. If every branch that leaves a loop depends on secret data, then the transformed program will not terminate. Our transformation extends previous work in non-trivial ways. It handles C constructs such as “goto,” “break,” “switch,” and “continue,” which are absent in the FaCT domain-specific language (2018). Like Constantine (2021), our transformation ensures operation invariance but without requiring profiling information. Additionally, in contrast to SC-Eliminator (2018) and Lif (2021), it handles programs containing loops whose trip count is not known at compilation time.
@article{paperbot2131,
title = {Side-channel Elimination via Partial Control-flow Linearization},
author = {Luigi Soares and Michael Canesche and Fernando Magno Quintão Pereira},
journal = {ACM Transactions on Programming Languages and Systems},
volume = {45},
number = {2},
year = {2023},
doi = {10.1145/3594736}
}