VellSSLH: Sound Type-Guided Selective Speculative Load Hardening for LLVM IR
Abstract
Constant-time cryptographic programs written in C can still leak secrets during speculative execution. Mispredicted branches may allow instructions to access secret data and expose it through observable behavior. Speculative load hardening (SLH) addresses these leaks, but protecting values unnecessarily can introduce significant runtime overhead. We present VellSSLH, which selectively inserts speculative load hardening at LLVM IR. Programmers specify Public and Secret inputs in annotated C programs, and our analysis infers which values may become secret during speculation. The transformation then inserts misspeculation-flag operations and protections only where needed. VellSCT, our extracted checker, validates the resulting LLVM IR. We formalize speculative constant-time (SCT) security by extending Vellvm's LLVM semantics with speculative execution, attacker directives, and leakage observations. Our security type system reasons about SSA joins, symbolic values, poison, pointer provenance, and observable faults, and supports declared declassifications and trusted external services. In Rocq, we prove that programs accepted by the checker satisfy SCT, and that a reference hardening transformation preserves architectural behavior. Evaluated optimized variants are rechecked for SCT but are not covered by this preservation proof. Our mechanized guarantees apply at LLVM IR; security of the generated binary additionally depends on backend and hardware assumptions. We evaluate VellSSLH on 24 cryptographic entries on a bare-metal Intel processor. VellSSLH achieves 4.03% lower geometric-mean runtime than LLVM SLH, with 13 comparisons favoring VellSSLH, eight favoring LLVM SLH, and three inconclusive. For X25519, VellSSLH improves runtime by 22.69% over LLVM SLH with only 1.86% overhead over unprotected code. Compared with Ultimate SLH, VellSSLH achieves 19.65% lower runtime.
Create a lesson
Related papers
Agentic Discovery of Soundness Bugs in Safe Rust Bindings
Shared title terminologycs.CRMarius Momeu, Koushik Sen
Code-Based Message Authentication with Statistical Guarantees via Coordinate Selection and Masking
Shared title terminologycs.CRHsuan-Po Liu, Hessam Mahdavifar
AutoClip-DPZO: Practical Private Clipping Selection for Differentially Private Zeroth-Order LLM Fine-Tuning
Shared title terminologycs.CRXinghe Chen, Haichao Sha, Zihao Wang et al.
IDSMorph: Self-Adaptive Malicious Traffic Detection through Consistency-Guided Dynamic Decision Boundaries
Shared title terminologycs.CRHao Fu, Degang Sun, Jinxia Wei et al.
Autonomous Parameter Surgery: How LLMs Implant Selective Backdoors into Language Models
Shared title terminologycs.CRXuyang Liu, Zhiwei Xu, Zirui Li et al.
LLM-Guided Cyber-Physical Attack Path Identification in Smart Grids
Shared title terminologycs.CRAmr Elshazly, Jesse Roberts, Rachad Atat et al.