betaFeedback

WorksComputer Science

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.

Introduction

Constant-time cryptography avoids secret-dependent branches and memory addresses. A mispredicted branch can nonetheless bypass a bounds check and access secret data, violating speculative constant-time (SCT) [3, 11]. LLVM’s speculative load hardening (SLH) tracks misspeculation via a predicate and introduces dependencies to prevent leakage [14]. Maintaining that predicate increases register pressure; hardening also adds instructions and dependencies. Selective hardening protects only values that can cause speculative leakage.

Spectre Declassified [2] introduced selective SLH. Subsequent work on Jasmin [3] distinguishes values that are public in both normal and speculative execution, secret in both, or normally public but potentially secret during misspeculation. We build on this type system and its forward execution model. Only the third category needs protection before observable uses; secret arithmetic need not be masked. Blade [19] similarly separates speculative sources from observable sinks and protects paths between them.

Author’s Contact Information: Swarn Priya, Washington State University, USA, [email protected]. Our goal is to bring mechanized guarantees to C-based cryptography through LLVM. Ultimate SLH [21] implements hardening in LLVM with a core-language security argument, but its LLVM transformation is not mechanically verified. Jasmin provides verified selective hardening for its own language rather than C. We use Vellvm [20] to account for LLVM’s SSA control flow, symbolic values, poison and memory semantics. We extend it with speculative execution and observations, mechanize checker soundness and reference-insertion preservation in Rocq, and extract the analysis into LLVM.

Problem statement and contributions. We present VellSSLH, an approach to selectively hardening constant-time C implementations against Spectre v1 at LLVM IR. Programmers specify which inputs are public or secret; the compiler infers and inserts the speculative protections. § 2.1 explains the LLVM-specific difficulties. Our contributions are as follows:

  • We define an SCT type system called VellSCT for LLVM IR with normal/speculative security types and MSF typestate, handling PHIs, poison, under-defined values and pointer operations. We extend Vellvm with speculative execution and leakage observations, and prove checker soundness in Rocq, including explicit declassification and trusted external services. Our Rocq development adds 337,040 lines of code and proofs, excluding existing Vellvm sources, generated files, comments and blank lines.

  • We develop automatic analysis and hardening from Public/Secret annotations, generating MSF initialization, edge updates and protections. We prove architectural preservation for a reference insertion algorithm in Rocq, including normal results, memory effects and faults. Evaluated optimized variants are rechecked by VellSCT and tested functionally; this preservation proof does not cover those variants.

  • We implement VellSSLH in LLVM using the extracted VellSCT checker. Our backend handles compiler-generated spills and ensures that the misspeculation flag (MSF) is never spilled, without permanently reserving a physical register. We evaluate the x86-64 backend and distinguish the mechanized IR guarantees from the conditional backend argument.

  • We evaluate 24 cryptographic API/component entries spanning symmetric primitives, hashes, X25519 and Kyber Round 3. On bare-metal Intel, VellSSLH reduces geometric-mean runtime by 4.03% against LLVM SLH and 19.65% against full Ultimate SLH, with version and campaign effects disclosed. Functional tests and bounded binary analysis complement timings; a controlled three-core experiment isolates selectivity, reducing runtime by 2.3–5.3% relative to conservative placement.

Overview of VellSSLH. In Figure 1, Clang carries C contracts into normalized LLVM IR, which an OCaml driver parses into Vellvm’s AST. VellSCT returns accepted inputs unchanged. A failed check leaves SCT unestablished; the figure’s “not SCT” branch has this meaning. For uncertified inputs, inference guides MSF initialization, branch updates, and protections, followed by another check; failure rejects the transformation. Declassification and external functions use explicit policies and contracts. Accepted IR is compiled with a nonspillable MSF; § 6 describes backend checks and binary testing.

The VellSSLH workflow

Figure 1. The VellSSLH workflow.

Motivating Example

Figure 2 illustrates selective hardening using two LLVM IR functions. Both load a value after a public bounds check. Because %p points to public data, the loaded value is public during normal execution. However, a mispredicted branch may allow the load to access secret data, making the value Transient. In lookup, the loaded value %v reaches a public return. VellSSLH inserts a protect operation that preserves the value during normal execution and replaces it with a fixed public value during misspeculation.

Hardened Public-return example and source fragment with a Secret store

Figure 2. Hardened Public-return example (a); source fragment with a Secret store (b).

In compute, arithmetic and a store to Secret memory at a Public address need no payload protection for vv. Entry/address hardening is omitted in panel (b). Panel (a) shows all flag operations, the shared frozen guard and entry views before pruning.

Challenges of Selective Hardening in LLVM

The security lattice alone does not account for LLVM’s SSA representation, value semantics or automatic register allocation.

Flag flow at SSA joins. The flag must follow the incoming edge, including loop backedges:

left:  mL = set_msf(m,c,true);  br join
right: mR = set_msf(m,c,false); br join
join:  mJ = phi [mL,left], [0,right] ; incorrect
       r  = protect(x,mJ)

If cc is true but speculation takes the right edge, mR=−1m_R = -1. The PHI nevertheless selects zero and loses the protection. Replacing [0,right] with [mR,right] fixes it. LLVM’s verifier accepts both integer PHIs; VellSCT additionally checks predecessor-specific flag flow. The proof relates the saved predecessor environments, not sequential updates of PHI destinations.

Poison and unresolved choices. LLVM values can be poison, a placeholder for an invalid result. Most operations simply propagate poison: if either operand of an or is poison, the result is poison. This complicates implementing protection at the IR level. During misspeculation, integer protect must replace its input with a fixed value (−1-1), whatever that input is, including poison. If protect were an ordinary or, a poison input would stay poison instead of becoming the fixed value. We therefore give protect its own semantics, in which a set flag always produces −1-1. The Rocq security proof uses these semantics; machine lowering requires a separate backend argument. Poison also affects branches: branching on poison is undefined behavior. We use freeze to choose one concrete Boolean, and the checker ensures that the branch and its flag update both use that same frozen Public value.

Pointer identity and memory effects. Equal pointer bits need not grant equal access: permissions and allocation provenance also matter. Clean protection preserves the original pointer; set protection may construct a different pointer or fail. Both the security and architectural proofs account for these outcomes, rather than treating pointers as mathematical integers.

Automatic spills. Jasmin makes register and stack storage explicit [1]; LLVM introduces spills after IR checking. A Public value reloaded during misspeculation may be Transient. Worse, reloading a clean MSF would disable later protections. We tag the MSF as nonspillable through copies, PHIs and allocation. LLVM chooses its physical register; none is permanently reserved. Allocation rejects if this constraint cannot be met. At calls the active flag ends at a synchronization boundary, avoiding a new calling convention. Ordinary spills remain allowed, with late checks certifying Public reloads or protecting demanded Transient reloads. Other backend obligations remain conditional (§ 6).

LLVM with Speculative Observations

We model Spectre v1 by extending Vellvm’s denotations, event interface, and handlers [9, 20] with attacker-directed forward speculation and leakage observations, reusing its AST and value domains. The attacker observes branch decisions, memory addresses, public results, and authorized disclosures.

Syntax of the checked LLVM IR fragment

Figure 3. Syntax of the checked LLVM IR fragment; TT includes array and structure layouts.

Syntax and LLVM values

Figure 3 gives the checked fragment. A module contains functions and supported globals; each function is a CFG of blocks containing PHIs, instructions, and a terminator.

The SSLH operations init_msf, set_msf, and protect abbreviate calls to llvm.sslh.init.msf, llvm.sslh.update.msf, and llvm.sslh.protect.*, represented by Vellvm’s existing call AST and interpreted by our extended semantics. Declassification abbreviates a marker call authorized by an explicit policy.

Loads, stores, and returns support integer values; returns may also be void. Ordinary calls return void. Pointer-valued loads, stores, and returns are unsupported. The checker validates CFG edges, incoming PHI operands, SSA definitions, and dominance.

Vellvm distinguishes dynamic values (dvalues) dv∈Vdv \in V—integers, pointers, and poison—from under-defined values (uvalues) uv∈Vuuv \in V_u, which can also retain symbolic expressions and unresolved choices. Concretization resolves choices when an operation requires them; a dvalue need not be defined in LLVM’s sense. The memory model tracks allocations, permissions, and provenance, so equal address bits need not imply equal memory behavior.

Speculative Execution Semantics

An interaction tree can return a result, take an internal step, or perform an event and continue. We add branch-selection and protection events, reusing Vellvm’s memory, environment, stack, and value operations. A configuration C=⟨t,σ⟩C = \langle t, \sigma\rangle pairs the remaining computation tt with state σ=(H,ρ,F,b)\sigma= (H, \rho, F, b): memory HH, local environment ρ\rho, saved environments FF, and semantic misspeculation bit bb. This bit records actual misspeculation; the program separately maintains the MSF.

Attacker control and observations. The attacker forces incorrect branches and redirects unsafe speculative memory accesses. Execution follows directives dd and produces observations oo. We write C→doC′C \xrightarrow{d}_o C' for a transition from configuration CC to C′C' under directive dd, producing observation oo:

d::=step⁡∣force⁡∣load⁡(a)∣store⁡(a),d ::= \operatorname{step} \mid\operatorname{force} \mid\operatorname{load}(a) \mid\operatorname{store}(a),
o::=ϵ∣read⁡(a)∣write⁡(a)∣branch⁡(c)∣return⁡(v?)∣fault⁡(r)∣declassify⁡(s,q).o ::= \epsilon\mid\operatorname{read}(a) \mid\operatorname{write}(a) \mid\operatorname{branch}(c) \mid\operatorname{return}(v?) \mid\operatorname{fault}(r) \mid\operatorname{declassify}(s,q).

Here, aa is a Vellvm memory address. Return values are observable only for public root returns. At an authorized site ss, declassification reveals the materialized outcome qq: a value or a failure of concretization. Fault observations include undefined behavior, out-of-memory, unsupported operations, and blocked speculation barriers.

Speculative branches. At a conditional branch, step follows the evaluated condition cc, while force follows the opposite branch. A forced branch sets bb to true, indicating misspeculation. Once set, bb remains true throughout the remaining execution. Both choices produce the observation branch(cc), which records the evaluated condition rather than the branch selected by the attacker.

Speculative memory accesses. During normal execution, loads and stores use their requested addresses. During misspeculation, if a load accesses an unreadable region, the attacker may redirect it to another readable address. Stores follow a similar rule when their requested address is not writable. The observation records the original requested address, not the redirected address or the accessed value. A valid memory access cannot be redirected simply because execution is speculative. However, an invalid speculative load may be redirected to a secret memory region, allowing a normally public load to return secret data. We therefore assign such a loaded value the Transient type. Readability and writability include provenance checks: landing in a different allocated object is not enough if the pointer lacks permission for that allocation. A pointer whose provenance does permit that writable access is not redirected. This is the chosen forward-speculation contract, not a model of all speculative stores.

Figure 4 gives representative event rules after operand evaluation and required concretization. Initialization sets the MSF to zero during normal execution and stops misspeculating execution, preventing a reset. Speculation proceeds forward without rollback (§ 9). The barrier fault represents a stopped speculative window, rather than an architectural trap. It is observable in both related executions because their semantic bits agree.

Selected speculative execution rules

Figure 4. Selected speculative execution rules; kk is the continuation.

Protection primitives

The program uses a misspeculation flag mm, encoded as 0 for clean and −1-1 (all ones) for set. The checker enforces flag-flow constraints that support the invariant b=true⇒m=−1b = \text{true} \Rightarrow m = -1: whenever execution is misspeculating, the current flag must be set. This implication suffices for protection; it does not require a set flag to imply misspeculation.

The SSLH operations behave as follows, where cc is the branch condition and tt is the branch taken:

init_msf⁡()=0if b=false,\operatorname{init\_msf}() = 0 \quad\text{if } b = \text{false},
set_msf⁡(m,c,t)=mOR{0if c=t,−1otherwise,protect⁡w(v,m)=(vORm) mod 2w.\operatorname{set\_msf}(m,c,t) = m \mathbin{\mathrm{OR}} \begin{cases} 0 & \text{if } c = t,\\ -1 & \text{otherwise,} \end{cases} \qquad \operatorname{protect}_{w}(v,m) = (v \mathbin{\mathrm{OR}} m) \bmod2^{w}.

These equations apply to defined integer payloads, a canonical 64-bit MSF, and defined Boolean update operands. A mismatched edge sets the flag permanently across updates. Protection with a clean flag preserves the original LLVM value, including poison, under-defined expressions, and pointer provenance. With a set flag, it ignores the payload and produces all ones (§ 2.1). For pointers it invokes Vellvm’s integer-to-pointer operation on 264−12^{64} - 1 with wildcard provenance; this can report out-of-memory, and success does not imply dereferenceability.

Contract-Guided Security Typing and Hardening

Source contracts classify normal-execution data; inference extends these classifications to speculation, guides insertion, and checks hardened IR.

Contracts and Security Types

Scalar inputs use SSLH_PUBLIC or SSLH_SECRET; return contracts classify outputs. Pointer contracts distinguish addresses from memory contents: for example, SSLH_SECRET_DATA marks the memory contents as secret, while the pointer itself may remain public. Callers must satisfy these contracts. Writes may change the inferred secrecy of memory contents. The checker validates instruction/SSA shapes, not general bounds, initialization or separation proofs. Recursive allocation-layout validity and admissible initial memory are theorem premises. Vellvm still models access failures; acceptance alone is not a memory-safety theorem.

We assign each value a security type that describes its behavior during normal and speculative execution. Let L≤HL \le H, where L means public and H means secret. A security type is a pair τ=(τn,τs)\tau= (\tau_n, \tau_s), with τn≤τs\tau_n \le\tau_s. This gives three security types:

P=(L,L),T=(L,H),S=(H,H).P = (L, L), \qquad T = (L, H), \qquad S = (H, H).

A P value is public in both executions. A T value is public during normal execution but may become secret during speculation. A S value is secret in both executions. The types form the ordering P≤T≤SP \le T \le S, with join operator ⊔\sqcup.

The semantic bit bb determines which component of the security type is used. We write public(τ,b)(\tau, b) for the normal component when bb is false and the speculative component when bb is true. Two scalar values are related at type τ\tau when they must be equal whenever the selected component is public: v1≈τbv2⟺public⁡(τ,b)=L⟹v1=v2v_1 \approx_{\tau}^{b} v_2 \Longleftrightarrow\operatorname{public}(\tau, b) = L \Longrightarrow v_1 = v_2. Its extension to LLVM values and memory accounts for valid accesses, under-defined expressions, and memory behavior.

The typing environment Γ\Gamma assigns each SSA variable an LLVM type κ\kappa and a security type τ\tau. For each tracked pointer qq, it also records the memory-content security type μq\mu_q. We write Ptr⁡(Γ)\operatorname{Ptr}(\Gamma) for the tracked pointer bindings. Each basic block ℓ\ell has a control-flow security type pcℓp_c^\ell. Integer and Boolean constants and null pointers are initially Public. Raw undef and poison operands are rejected. Public source annotations specify that inputs are public during normal execution, but do not automatically make them public during speculation. Secret inputs remain Secret.

During inference, the security type determines whether an unsafe use can be made safe through hardening. A transient value may be protected before a public observation, whereas a Secret value cannot be repaired this way. Architectural constant-time is an applicability requirement: insertion rejects unrepairable Secret observable uses, and VellSCT checks the final Public-use constraints. Soundness does not assume acceptance by a separate constant-time checker.

SSA and Memory Constraints

We write Γ;pc⊢e:τ\Gamma; p_c \vdash e : \tau to mean that expression ee has security type τ\tau under environment Γ\Gamma and control type pcp_c. For instructions with memory effects, Γ;pc⊢i+C\Gamma; p_c \vdash i + C produces a set of constraints CC.

Arithmetic joins operand and control types. PHIs join incoming types and the block’s control type; pointer results also track memory contents. Branches propagate guard types to successors. fixed point over the CFG jointly computes PHIs, control types, and memory constraints, including loop backedges.

Figure 5 shows representative rules for checking protected IR. Planning uses the normal-component criterion described below.

Selected typing rules for protected LLVM IR

Figure 5. Selected typing rules for protected LLVM IR.

Load and Store require Public addresses. Loads are at least Transient because an invalid speculative access can read Secret memory. Stores constrain every tracked pointer’s memory label to account for aliasing; the extension also tracks global-memory facts. Solving these constraints flow-insensitively means a store can also raise an earlier load’s label. This conservative treatment avoids aliasing assumptions that may fail during speculation.

At LLVM IR, fixed-size allocations produce abstract addresses whose security label is pcpc, hence Public in a Public control context. Their initial contents are conservatively classified Secret. Concrete stack layout is determined later; separate-allocation tracking could improve precision.

The Protect rule requires a ready, current MSF and joins the control label with the payload type transformed by protect. The Branch rule requires the branch condition and its control context to be Public. Thus every reachable checked block has Public control; non-Public control labels matter during planning, when they expose paths that require repair or rejection.

Partial operations can fail before their results are used, so relevant operands of division, GEP, and other supported partial operations must be Public. Secret select guards are rejected even if a target could implement the selection without branching.

Flag Typestate

Protection must use the current flag. Its typestate is Σ::=unknown∣ready(m)∣pending(m,c,t)\Sigma::= \mathrm{unknown} \mid\mathrm{ready}(m) \mid\mathrm{pending}(m,c,t). unknown means that no valid MSF is available. ready(m)\mathrm{ready}(m) identifies the current flag and requires b⇒m=−1b \Rightarrow m = -1. pending(m,c,t)\mathrm{pending}(m,c,t) records that edge tt of branch condition cc was selected but its update is outstanding. Protection requires a ready flag; an update must use the current flag, guard, and actual edge, making the result ready again.

LLVM branch conditions may be poison or undefined. We use a restricted freeze i1 instruction so that the branch and its MSF update use the same defined Boolean. The checker verifies this exact pattern; arbitrary uses of freeze are not accepted through this exception.

Flag PHIs must select the current MSF from every incoming edge, including loop backedges, preventing stale flags and resets to zero.

The main typestate transitions are:

unknown→m=init_msf⁡()ready(m),ready(m)→br c to tpending(m,c,t),\mathrm{unknown} \xrightarrow{m=\operatorname{init\_msf}()} \mathrm{ready}(m), \qquad\mathrm{ready}(m) \xrightarrow{\mathrm{br}\ c\ \mathrm{to}\ t} \mathrm{pending}(m,c,t),
pending(m,c,t)→m′=set_msf⁡(m,c,t)ready(m′),∀p∈pred⁡(ℓ). ep=out⁡(p)m=Φ[p:ep]p∈pred⁡(ℓ) valid.\mathrm{pending}(m,c,t) \xrightarrow{m'=\operatorname{set\_msf}(m,c,t)} \mathrm{ready}(m'), \qquad\frac{\forall p \in\operatorname{pred}(\ell).\ e_p=\operatorname{out}(p)}{m=\Phi[p:e_p]_{p\in\operatorname{pred}(\ell)}}\ \mathrm{valid}.

Here out⁡(p)\operatorname{out}(p) is predecessor pp’s current MSF. The checker restricts initialization and update placement in the CFG (§ 2.1). MSF values cannot be stored, returned, passed as ordinary arguments, or used in unrelated arithmetic.

Protecting Transient Uses

Protection is needed when a Transient value reaches a Public use: protect⁡(P)=P\operatorname{protect}(\mathrm{P}) = \mathrm{P}, protect⁡(T)=P\operatorname{protect}(\mathrm{T}) = \mathrm{P}, and protect⁡(S)=S\operatorname{protect}(\mathrm{S}) = \mathrm{S}.

Masking repairs speculative secrecy, so Transient becomes Public, whereas Secret remains Secret. Planning allows an observable operand whose normal component is public; checking requires both components to be public:

Γ;pc⊢plane usable⟺(pc⊔Γ(e))n=L,\Gamma; pc \vdash_{\mathrm{plan}} e\ \mathrm{usable} \Longleftrightarrow(pc \sqcup\Gamma(e))_n = \mathrm{L},
Γ;pc⊢checkede usable⟺pc⊔Γ(e)=P.\Gamma; pc \vdash_{\mathrm{checked}} e\ \mathrm{usable} \Longleftrightarrow pc \sqcup\Gamma(e) = \mathrm{P}.

Thus Transient operands can be repaired, but Secret observable operands are rejected. Secret additions, shifts, and bitwise operations need no mask when they do not reach an observation; a Transient address does.

Insertion, Checking, and Explicit Declassification

VellSCT first checks the input, returning accepted programs unchanged. Otherwise, inference guides insertion of MSF initializations at required entries, updates along conditional branches, flag PHIs at joins, and protections before observable uses.

The insertion algorithm reuses already protected Public values when possible. For ordinary SSA uses, the protected definition must dominate the use. For PHI nodes, the protected value must be available along the corresponding incoming edge.

After insertion, inference is recomputed under the declassification policy and masks of already-Public inputs are removed. VellSCT independently checks the result’s types and MSF constraints; failed checks and unsupported cases reject the transformation. Placement is heuristic: we claim no minimum number of masks or optimality relative to Blade’s min-cut formulation.

Declassification. Declassification lets a program intentionally reveal a Secret value. For example, Secretbox open reveals whether authentication succeeded. A declassification policy authorizes the value and type disclosed at each site, such as an authentication result. The checker also requires pc=Ppc = \mathrm{P}. For concrete scalars the value is preserved and its normal component becomes public:

declassify⁡(P)=P,declassify⁡(T)=T,declassify⁡(S)=T.\operatorname{declassify}(\mathrm{P}) = \mathrm{P}, \qquad\operatorname{declassify}(\mathrm{T}) = \mathrm{T}, \qquad\operatorname{declassify}(\mathrm{S}) = \mathrm{T}.

However, declassification makes the value Public only during normal execution. During misspeculation, the program may be running with wrong values, so the result can still depend on secrets. We therefore give a declassified value type Transient, not Public. If the program later branches on the authentication result, VellSLLH still protects it before the branch. In normal execution, declassification reveals the value to the attacker. During misspeculation, it reveals nothing. VellSLLH checks that values are declassified only at authorized sites, but it does not decide whether revealing them is safe; the programmer who writes the policy must justify each release.

Formal Verification

In extended Vellvm, we prove VellSCT soundness, including declassification and trusted services, and architectural preservation of the reference inserter, under the stated program checks and runtime assumptions.

Speculative constant-time

An attacker strategy A:Obs∗→DirA : Obs^{*} \to Dir chooses the next directive based on previous observations. A fixed directive sequence makes these choices in advance; a strategy also permits adaptive choices. Both executions use the same strategy, so equal observation histories receive the same next directive. Silent steps do not produce observations. Let Tr⁡A(P,σ)\operatorname{Tr}_{A}(P, \sigma) denote all possible finite observable prefixes of program PP starting from state σ\sigma under strategy AA. Prefixes may have any finite length, including prefixes of nonterminating executions.

We adapt SCT to LLVM’s nondeterministic semantics. We compare sets of possible observation prefixes because allocation and concretization may produce different results without leaking secrets. Requiring observations to agree for every pair of independently chosen executions would reject harmless nondeterminism. Instead, each execution must have a counterpart with the same observations.

Let σ1≈Iσ2\sigma_1 \approx_I \sigma_2 denote two initial states related by the entry contract II. Both executions start outside speculation, with empty local environments and frame stacks. Public arguments must be the same, while Secret arguments may differ. Their heaps must agree on the declared public memory and have compatible allocations and permissions. Public pointer contracts also cover accessible memory bytes through pointer provenance. Initial values and memory must satisfy Vellvm’s admissibility requirements.

Definition 1 (Speculative constant-time (SCT)). A program PP is SCT with respect to II if, for indistinguishable worlds, σ1≈Iσ2⟹∀A. Tr⁡A(P,σ1)=Tr⁡A(P,σ2)\sigma_1 \approx_I \sigma_2 \Longrightarrow\forall A.\ \operatorname{Tr}_{A}(P,\sigma_1)=\operatorname{Tr}_{A}(P,\sigma_2).

We first consider VellSCT’s core fragment, without declassifications or trusted external services.

Theorem 1 (VellSCT soundness). If VellSCT accepts PP in this fragment, the entry contracts hold, and the allocation layouts and linking environment satisfy the runtime assumptions, then PP is SCT.

In other words, changing only Secret inputs does not change the possible observations available to the same adaptive attacker. The proof assumes valid allocation layouts and unambiguous addresses for linked names. It matches nondeterministic choices between executions to establish equality of observable prefixes.

Proof sketch. The proof maintains a relation between the two executions, covering program counters, remaining computation trees, SSA environments, heaps, and semantic bits. SSA values satisfy the relation of § 4.1, while the heap relation tracks memory domains, permissions, and public bytes. The runtime invariant also matches observable faults. A ready flag satisfies the coverage invariant for the common semantic bit, while a pending edge records the guard and successor until the corresponding update is executed.

We prove that each checked instruction preserves this relation under Vellvm semantics. Public operands produce matching branches and memory addresses. A load from normally public memory may return different secret values after an unsafe speculative access. Its Transient classification prevents an unprotected observable use. Protection makes related Transient values equal: a clean flag preserves their normal equality, while a set flag produces the same fixed result or matching failure. Stores preserve the heap relation. At a join, all PHIs read the saved predecessor environment before any destination is written. On a loop backedge ℓ\ell, x=Φ[…,ℓ:y]x = \Phi[\ldots,\ell: y] and y=Φ[…,ℓ:x]y = \Phi[\ldots,\ell: x] exchange the previous iteration’s values; sequential updates would incorrectly set both to the old yy. The invariant therefore relates the two snapshots and proves every selected incoming operand related before constructing either successor environment. The flag PHI additionally carries the token associated with that predecessor’s pending edge. This connects SSA value transport to the speculation bit, rather than merely checking an integer PHI’s shape. Call and frame lemmas preserve the invariant across function boundaries; definedness constraints match enabled operations and observable failures.

A weak simulation matches each observable event, allowing silent allocation, environment, and concretization steps. Composing these simulations gives matching finite prefixes. Applying the argument in both directions establishes trace-set equality. The invariant, instruction cases, and trace composition are detailed in Appendix § 11.§ 2–§ 11.§ 4.

LLVM values and nondeterminism. LLVM may leave value choices unresolved, and computations may produce poison. Our proof follows these values through evaluation and accounts for any observable failures (§ 2.1). VellSCT rejects explicit undef and poison operands, but these restrictions do not prevent such values from arising during execution. It permits freeze i1 only immediately before a conditional branch, with a Public operand. This captures one defined Boolean for both the branch and its MSF update.

Two executions may also make different choices without leaking secrets. For example, allocation may choose different public addresses even when the secret inputs are unchanged. SCT allows these differences as long as changing the secrets does not change which observations are possible. The backend must preserve this independence when resolving under-defined values at observable uses (§ 9). Architectural refinement alone is insufficient: resolving a nondeterministic choice can shrink the two sets of traces differently and break SCT. Security preservation therefore needs secret-independent choice resolution in addition to functional refinement.

Declassification and trusted external calls

Cryptographic programs sometimes intentionally disclose information, such as whether authentication succeeded. This result may depend on Secret data, so two executions with different secrets can legitimately reveal different results at that point. A declassification policy R\mathcal{R} specifies which values may be disclosed and where. We extend the security guarantee to account for these declared disclosures.

We also support calls to a trusted external service, such as randombytes, whose body lies outside the checked IR. The supported interface takes a Public output-buffer address and length; its output bytes are classified Secret. The declarations ρ\rho identify these calls, and SS denotes the service implementation. We treat each call as an atomic effect whose security contract is an explicit assumption.

Theorem 2 (Declassification-aware VellSCT soundness). Suppose VellSCT accepts PP under policy R\mathcal{R} and service declarations ρ\rho. Assume related initial states satisfying the entry and global-memory contracts, valid layouts and linking, and that SS satisfies its relational service contract. For every finite execution from either initial state, there is an execution from the other state under the same attacker strategy such that:

  1. both executions produce the same observations and reach related configurations; or

  2. their observations first differ at the same authorized declassification site.

Thus, matching observations are guaranteed up to the first differing intentional disclosure. When the disclosed outcomes agree, the resulting states remain related and the guarantee continues. Outcomes include materialization failures as well as concrete values. Without declassifications, the second case disappears and we recover SCT.

Proof idea. We construct a matching execution under the same attacker strategy, reusing Theorem 1’s invariant and ordinary-instruction lemmas. Public data and control agree; Secret values may differ. Declassification needs a separate argument because it can make Secret information observable. Its typing rule requires Public control, so the matching execution reaches the same authorized site. If the disclosed outcomes agree, the newly disclosed information agrees in both executions, and the state relation is preserved. If they differ, this is the first permitted difference because all earlier observations have already been matched. During misspeculation, declassification reveals nothing and retains the value’s speculative classification, so matching continues without authorizing a new disclosure.

At an external call, the buffer address and length are Public, so both executions make the same request. The assumed service contract guarantees that each response in the first execution has a matching response in the second. On success, the resulting states remain related even though the Secret output bytes may differ. On failure, both executions produce the same observable fault.

Induction gives matching observations until an authorized difference; exchanging initial states proves the reverse direction. Appendix § 11.§ 5 expands these proof cases, and Appendix § 11.§ 1 gives the complete statement and premises.

Architectural insertion refinement

Hardening must prevent speculative leakage without changing normal program behavior. During normal execution, initialization produces a clean flag, matching control-flow edges keep it clean, and protection leaves values unchanged.

Let Harden⁡R,ρ(P)=P′\operatorname{Harden}_{\mathcal{R},\rho}(P) = P' denote a successful execution of the reference hardening entry point. Let EE be an admissible context and observer, and let Beh⁡(P⊕E,σ,O,σ′,v)\operatorname{Beh}(P \oplus E, \sigma, O, \sigma', v) denote a complete finite architectural execution, ending in a concrete observer result or an observed fault. The optional result vv is absent in the fault case.

Theorem 3 (Architectural insertion preservation). Assume Harden⁡R,ρ(P)=P′\operatorname{Harden}_{\mathcal{R},\rho}(P) = P' and that SS satisfies the architectural service contract.

For every admitted source entry, context, observer, and initial world, every complete target behavior Beh⁡(P′⊕E,σ,O,σt′,v)\operatorname{Beh}(P' \oplus E, \sigma, O, \sigma'_t, v) has either:

(1) a source behavior Beh⁡(P⊕E,σ,O,σs′,v)\operatorname{Beh}(P \oplus E, \sigma, O, \sigma'_s, v) with the same observations and returned result, and final-state refinement σs′⪯vσt′\sigma'_s \preceq_v \sigma'_t; or

(2) a source execution that encounters undefined behavior at a common observation prefix of OO.

Thus, when the source has no undefined behavior in the admitted context, every target behavior is permitted by the source. This result covers completed finite behaviors; it does not establish divergence preservation. The phase ranking below rules out unbounded bookkeeping within a simulated fragment, not every possible whole-program divergence.

Here σs′⪯vσt′\sigma'_s \preceq_v \sigma'_t preserves memory metadata and requires every concrete typed-load outcome of the target heap to be permitted by the source heap. Semantic bits agree; on successful return, restored environments and frame stacks also agree. Symbolic expressions may differ, and target execution may resolve nondeterministic choices of the source. The architectural service contract uses this behavioral heap relation; it is distinct from the relational security contract in Theorem 2.

Table 6 explains the initial-world and service premises; Appendix § 11 states them in full.

PremiseMeaning
RuntimeAddresses, provenance, layouts, bytes, and concretization satisfy the Vellvm interfaces.
Check/PrepareThe executable checker accepts, and the entry contracts and input kinds are decoded successfully.
InitExecution starts normally in related states, with readable arguments, admissible bytes, and agreement on declared public memory.
LayoutEvery allocated LLVM type has a valid nonvoid layout.
LinkFunction addresses identify names unambiguously and agree with global lookup.
GlobalViewTracked globals are bound to addresses and satisfy their public-memory contracts.
Safe/ArchThe external service satisfies its security or architectural-refinement contract, respectively.
WorldThe entry, observer, calling convention, and global addresses satisfy the architectural execution requirements.

Table 6. Assumptions of the main theorems.

Proof sketch. The constructor first checks the source CFG and SSA structure before generating fresh names. The simulation relates each source instruction to its generated sequence of operand protection, original operations, and bookkeeping. The invariant tracks original SSA values, generated Public values, the clean flag, memory, suspended frames, and the current phase of the generated sequence. The proof uses LLVM’s behavioral relations for operands, including poison, undefined choices, pointer provenance, and failures. A finite phase ranking ensures progress through inserted instructions. Separate invariants handle data and flag PHI nodes, ensuring that each uses values from the correct predecessor. The simulation extends across calls, returns, and the observer. It also handles identity protection, source undefined-behavior prefixes, pruning, and the linked context. Appendix § 11.§ 6 gives the detailed fragment-simulation argument.

LLVM Implementation

Frontend and extraction

Clang transports scalar, initial-pointee and return confidentiality contracts to LLVM. Programmers need not annotate Transient values or write flag operations. Normalization inlines selected helpers, promotes stack variables, lowers switches and supported memory intrinsics, and simplifies fixed layouts. Matched comparisons use the same normalized input.

The OCaml driver parses LLVM into Vellvm’s AST and invokes extracted inference, insertion and VellSCT checking. The checker recomputes constraints and validates the fixed point, operands, CFG/SSA structure, primitive signatures and flag protocol. Emitted LLVM is verified, serialized, parsed again and freshly checked.

An entry Public view vP=protect⁡(v,m0)v_P = \operatorname{protect}(v,m_0) gives a Public replacement name dependent on initialization, retaining its pointee contract. The original argument remains Transient under flow-insensitive typing. For example, consumers use the new pointer name after the fence. The three cores each have three such views. The backend can remove zero-mask arithmetic while retaining an opaque ordering dependency until entry certification.

Function calls and the MSF

An ordinary call may overwrite the MSF register. Before calling, the caller protects required Public arguments and executes init_msf to stop misspeculation. It initializes a fresh flag after return. The checker rejects missing initialization and reuse of the old flag, so the calling convention need not preserve an MSF register. Ordinary calls are restricted to non-exported helpers in the same module. They must return void, contain no ordinary calls, and take at most six Public integer or pointer arguments with normally Public pointee contracts. Their stores require Public addresses and normally Public values. Calls to trusted external services, such as randombytes, are handled separately. The checker requires the output buffer’s address and length to be Public, so both executions make the same request, and relies on the service contract of § 5.2 for the service’s behavior. Unlike ordinary calls, no extra initialization is needed immediately before the call, because the service is assumed not to leak secrets even when reached during misspeculation. After the call returns, the caller initializes a fresh flag, since the old flag cannot be relied on across the call. Each such initialization adds a barrier cost to the call.

Generating machine code

Implementing the MSF operations. init_msf emits LFENCE followed by a move of zero on x86-64. LFENCE stops later speculative execution until prior instructions complete locally [13]. AArch64 uses SB, a speculation barrier, followed by zeroing. Without SB, DSB SY completes earlier memory accesses and ISB synchronizes instruction execution [4].

set_msf computes a zero mask for a matching branch edge and all ones for a mismatch, then ORs it with the old flag. The general x86 sequence copies the condition (MOV), subtracts or negates it (SUB/NEG), then applies OR; AArch64 uses SUB and OR. When existing x86 branch flags can be reused safely, a conditional move (CMOV) instead selects the old flag or all ones without recomputing the condition.

protect copies its input and ORs in the flag: zero preserves the value, while all ones forces the fixed result. The instructions are MOV; OR on x86 and ORR on AArch64. Default AArch64 lowering adds CSDB after updates and protection. This barrier restricts use of predicted data without stopping branch speculation [4]. x86 updates and protection need no LFENCE.

Keeping the MSF in a register. LLVM allocates a nonspillable virtual MSF register and propagates its tag through copies. No physical register is permanently reserved; an attempted spill rejects compilation. All 24 measured objects compile, but no general failure rate is measured. LLVM SLH already uses a virtual predicate; we add mandatory spill rejection.

Handling ordinary stack spills. Ordinary spills introduce reloads after IR checking. A Public stack address alone does not certify their contents. The x86 backend certifies supported Public store/reload paths; otherwise it masks Transient reloads feeding Public uses with the current MSF, rejecting unsupported cases. AArch64 uses a barrier fallback or optional GPR masks. Appendix § 12 gives the store-width, initialization and aliasing conditions, including overlapping writes.

Security after code generation. The Rocq proofs stop at LLVM IR; MSF/reload checks do not discharge all backend obligations. Later passes must preserve protection dependencies and resolve under-defined values independently of secrets at observable uses, under the compiler and hardware conditions in Appendix § 12. The evaluated pipeline disables select optimization and x86 conditional-move conversion to avoid new branches.

Evaluation

Experimental setup. We evaluate 24 cryptographic operations from TweetNaCl, libsodium, HACL*, and Kyber. They include MACs, stream ciphers, Secretbox, SHA/SHAKE, X25519, Kyber512/768, and Salsa/ChaCha-family cores. For each operation, we compare four versions: unprotected code, LLVM SLH, Ultimate SLH, and VellSSLH. Each comparison uses the same cryptographic implementation, inputs, and test driver. Appendix § 13 gives the source-preparation and compilation details.

We measure native runtime on a bare-metal Linux machine with an Intel Core Ultra 5 335, using the same performance core (CPU 2). Unprotected code, LLVM SLH, and VellSSLH use our LLVM 23.0.0git build. We compare these three versions in nine trials, varying their code layout and measurement order in each trial to reduce sensitivity to layout and frequency changes. Ultimate SLH uses LLVM 16 and is measured in a separate set of nine trials on the same core.

Before timing, we warm up the code and run functional checks. We time repeated function calls, including the common test loop and output checksum; calibration, reference computations, and full-output checks are excluded. We take the median time in each trial, then report the median across the nine trials. For unprotected code and LLVM SLH, percentage changes use ratios from matching trials, combined with a geometric mean. For Ultimate SLH, they use the ratio of the two reported medians. The 95% confidence intervals use whole trials as samples, and we retain every trial.

RQ1: Applicability to Cryptographic C

All 24 hardened modules pass VellSCT and the functional output checks. Table 2 reports results for 16 KiB messages where the operation accepts variable-length input. X25519 uses 32-byte scalars, the fixed cores use 16-byte inputs, and KEM measurements cover complete operations. SHAKE produces 64 output bytes. The artifact includes tested message sizes from 16 bytes to 64 KiB. Whole-library support remains limited by source preparation, unsupported instructions, dispatch code, and Secret select guards.

OperationBareLLVM SLHUltimate SLHVellSSLHΔ vs bare (%)Δ vs SLH (%)Δ vs Ultimate (%)Spec.
Poly13057.4298.4208.4527.775+4.93-7.49-8.01✓
SipHash-2-45.3695.4395.4225.373+0.08-1.18-0.91✓
SipHash1285.3815.4515.4295.325-1.04-2.27-1.91✓
ChaCha2024.42923.89624.20623.543-3.52-1.11-2.74✓
Salsa2038.85252.14667.62045.689+17.95-12.24-32.43B
XSalsa2039.81252.60572.44044.612+12.58-15.01-38.42B
Secretbox encrypt341.196402.309819.762362.844+6.34-9.81-55.74M
Secretbox open159.631240.762535.922223.031+40.79-7.56-58.38✓
SHA3-25625.67026.18227.70726.497+3.32+1.22-4.37M
SHA3-51247.90048.69050.49249.184+2.68+1.11-2.59M
SHA-51231.28936.47742.78433.644+7.63-7.78-21.36M
SHAKE12821.07121.71522.98221.750+3.49+0.19-5.36M
SHAKE25625.73526.53028.29126.664+3.82+0.67-5.75M
X25519 scalar589.145776.418844.987600.199+1.86-22.69-28.97M
X25519 base589.276776.151844.236601.333+2.03-22.56-28.77M
Kyber512 keygen15.79118.36023.53118.869+19.71+2.83-19.81M
Kyber512 encap.18.88122.61628.50122.351+18.28-1.24-21.58M
Kyber512 decap.21.00525.31833.57224.382+16.22-3.53-27.38M
Kyber768 keygen26.25331.19940.69731.159+18.59-0.01-23.44M
Kyber768 encap.29.47635.19546.37535.868+21.57+1.80-22.66M
Kyber768 decap.32.43739.50152.82339.374+21.05-0.44-25.46M
Salsa20 core0.0810.0830.0840.087+6.86+3.83+3.25✓
HSalsa20 core0.0810.0770.0780.084+3.24+8.02+7.73✓
HChaCha20 core0.0830.0820.0830.088+6.38+6.95+6.09✓

Table 2. Representative bare-metal runtime (μ\mus/call). Negative changes mean faster. Bounded checks: ✓ passed; M model-limited; B budget-limited.

InputIR (KiB)Check (s)RSS (MiB)Insert (s)RSS (MiB)
Salsa20 core23.50.5520.03.9520.0
HSalsa20 core16.80.2219.91.5619.9
HChaCha20 core16.80.4019.94.5620.0
Poly130558.54.5520.426.8720.3
SHA3-25640.20.9120.26.5820.2
X25519 scalar160.470.65145.8≥180\ge180153.2
Kyber512 decapsulation343.9≥180\ge18031.1≥180\ge180122.3

caption: Analysis time and peak memory on an Apple M4 (16 GiB); ≥180\ge180 denotes a timeout.

:::

Analysis cost. Table 1 measures analysis time and peak memory on an Apple M4 with 16 GiB RAM. Each entry uses a fresh process and includes parsing and LLVM validation. Check runs VellSCT on hardened IR; Insert includes inference and protection removal, starting from prepared IR. The table gives its size in KiB and peak resident memory (RSS).

The table uses a 180-second limit. The runs that produced the binaries allowed 1,200 seconds for Kyber and 1,800 for the broader suite. X25519 took 409 seconds for insertion and 127 seconds for rechecking; Kyber512 decapsulation took 769 and 339 seconds. These modules passed with larger limits despite the table’s timeouts. Inlining enlarges the IR, over which the checker repeatedly processes constraints. We have not timed this separately from parsing and validation.

Annotation effort. Programmers specify Public and Secret contracts. VellSSLH infers Transient types and inserts the MSF operations. The Poly1305 wrapper uses five annotations; SHA3-256 and X25519 scalar multiplication each use seven, including unused test-interface parameters. Kyber512 decapsulation uses four annotations and two sampler declassification expressions, which become four sites after inlining. We did not measure programmer time.

Our Kyber implementation is Round 3 v3.0, rather than FIPS 203 ML-KEM. Its policy makes matrix-sampler values public while keeping noise seeds, keys, and shared secrets Secret. The conservative memory analysis may require some releases; we have not measured which separate tracking of each allocation would avoid. Secretbox open also declassifies whether authentication succeeded. Security depends on these declared policies and the external-service contracts. Key generation and encapsulation use the operating-system random-number generator.

RQ2: Performance Compared with Existing SLH

Table 2 compares unprotected code, LLVM SLH, full Ultimate SLH, and VellSSLH on the same host and core.

Comparison with LLVM SLH. VellSSLH is 4.03% faster across the 24 operations, using the geometric mean of runtime ratios. Excluding the two X25519 operations gives a 2.13% improvement. The measured ratios favor VellSSLH in 15 operations. The 95% confidence intervals support an improvement in 13 and a slowdown in eight. Three comparisons remain inconclusive: SHAKE128 and Kyber768 key generation and decapsulation. These intervals describe variation on this machine; we have not repeated the study on other processors.

X25519 scalar multiplication and base multiplication are 22.69% and 22.56% faster than LLVM SLH, with 1.86% and 2.03% overhead over unprotected code. Salsa20 and XSalsa20 are 12.24% and 15.01% faster, and SHA-512 is 7.78% faster. The three fixed cores are 3.83–8.02% slower. Secretbox open is 7.56% faster than LLVM SLH but still 40.79% slower than unprotected code. Some measurements, including ChaCha20, are faster than the unprotected version; code layout can affect these timings, so this does not show that hardening has no cost. § 7.4 reports a separate experiment in which backend settings also improve SHA3-256 and Kyber768 encapsulation.

Comparison with Ultimate SLH. We build Ultimate SLH [21] with LLVM 16 and all published protection options enabled, using equivalent prepared IR and the same test drivers. VellSSLH is faster in 21 operations, with a 19.65% lower geometric-mean runtime. All 21 confidence intervals support an improvement. The three fixed cores remain slower.

Ultimate SLH also protects instructions whose execution time can depend on their operands. Our checker requires division operands to be Public: a Transient divisor needs protection, and a Secret divisor is rejected. This addresses part of that concern, but our security guarantee does not cover all variable-time instructions. To check whether Ultimate’s extra protection affects this comparison, we compile all 24 routines with that option disabled. Every resulting object is byte-for-byte identical to its fully protected version. The timings use the fully protected versions.

The tools use different LLVM versions and available options, and their timings come from separate runs. The difference in runtime therefore cannot be attributed entirely to the hardening algorithm. Appendix § 16 gives the confidence intervals; the artifact includes measurements at additional input sizes. We have not validated the Ultimate binaries with Spectector.

RQ3: Benefit of Selective Protection

To measure the benefit of selectivity, we compare two ways of inserting protection within VellSSLH. Conservative placement protects potentially sensitive uses based on the instruction form. Selective placement uses inferred types to remove unnecessary protections. Both use the same prepared IR, MSF operations, one entry fence, nonspillable flag, and backend checks. We disable entry-view reuse for this experiment; the main performance table uses the default configuration.

For the Salsa20, HSalsa20, and HChaCha20 cores, selective placement reduces the number of IR protection calls from 149, 85, and 85 to three per core. The function sizes fall from 2,387, 1,388, and 1,299 bytes to 1,268, 874, and 808 bytes. Table 3 reports runtime. Bare is the unprotected version; Same flags is unprotected code compiled with VellSSLH’s backend restrictions.

CoreBareSame flagsLLVM SLHConsv.SelectiveRatio [95% interval]
Salsa200.0810.0810.0840.0950.0900.947 [0.943, 0.950]
HSalsa200.0810.0810.0770.0900.0860.954 [0.951, 0.957]
HChaCha200.0830.0830.0820.0910.0890.977 [0.970, 0.983]

Table 3. Protection-placement comparison (μ\mus/call); ratios compare Selective with Conservative placement.

After functional checks, we run nine trials with randomized layouts. The 95% intervals use 10,000 resamples of whole trials, with none discarded. Selective placement is faster by 5.34%, 4.59%, and 2.26%, respectively, and wins in all nine trials. The two unprotected controls have identical function bytes, so their timing differences show the effect of layout and measurement variation.

With these settings, selective VellSSLH remains 7.47%, 10.22%, and 7.61% slower than LLVM SLH. Selectivity reduces code size and runtime, but both VellSSLH versions still pay for the entry barrier. These cores take roughly 80 ns, so that fixed cost is a large part of each call. We have not repeated this experiment on X25519, full Salsa20, or SHA-512; their improvements over LLVM SLH may also come from other differences between the compilers.

RQ4: Backend Costs and Configuration

Protection and flag costs. Table 4 counts three kinds of VellSSLH operations: protection calls in the checked IR, protection added for stack reloads, and initialization fences. The LLVM SLH column counts the register results it hardens after loads. We obtain those counts by replaying its pass and checking that it reproduces the measured assembly, so ordinary cryptographic AND/OR instructions are excluded. The LLVM SLH objects contain no LFENCE. These counts refer to places in the code; a protection inside a loop can execute many times.

OperationLLVM SLH post-load regsVellSSLH IR protectsVellSSLH late reloadsVellSSLH LFENCEs
Poly130563431
SipHash-2-410401
SipHash12810401
ChaCha20281301
Salsa2032661
XSalsa2032641
Secretbox encrypt765361
Secretbox open74147571
SHA3-25663961
SHA3-51267161
SHA-512252511
SHAKE1281013121
SHAKE2561013121
X25519 scalar1291131
X25519 base129931
Kyber512 keygen11987503
Kyber512 encap.21151622
Kyber512 decap.30688531
Kyber768 keygen11189493
Kyber768 encap.20052702
Kyber768 decap.29991651
Salsa20 core12301
HSalsa20 core12301
HChaCha20 core12301

Table 4. Static protection and initialization sites for the default objects.

The counts come from different compilation stages: VellSSLH’s IR calls may still be optimized during code generation. Its memory analysis also uses conservative labels that do not change at each program point. This can cause additional protections in Secretbox open and SHA3/SHAKE. SHA3/SHAKE are slower than LLVM SLH, while Secretbox open remains faster despite its high overhead over unprotected code. Tracking changes in memory labels more precisely could reduce unnecessary protection.

Small messages do little computation, so fixed costs make up a larger fraction of runtime. An added cost δ\delta gives (100δ)/Tbare(n)(100\delta)/T_{\mathrm{bare}}(n) percent overhead at message length nn. VellSSLH executes an entry LFENCE even when it needs few masks; LLVM SLH instead carries its poison state through the stack pointer. Register pressure, register saves, and protection of stack reloads can also reduce the benefit of selective insertion.

X25519 scalar/base use 11/9 IR protections and three added reload protections, compared with 129 hardened load results in LLVM SLH. Salsa20/XSalsa20 use six IR protections and six/four reload protections, compared with 32; SHA-512 uses 25 and one, compared with 25. Each of these VellSSLH routines uses one fence, while the LLVM SLH versions use none. The counts show how the generated code differs, but we have no hardware counter measurements that isolate the causes of the X25519 speedup.

Backend configuration experiment. Table 5 tests two compiler options on four hash and three KEM operations, using nine trials with randomized layouts. The IR, checker, insertion algorithm, compiler sources, and proofs stay the same. One option separates loads from the instructions using them, allowing the backend to check whether spilled Public values remain Public when reloaded. This can reduce masks but add instructions. The other releases a scratch register for other uses. We rerun the unprotected and LLVM SLH controls in each trial; their times can differ from the main table, as for Kyber768 key generation. The initialization and call protocols remain unchanged, and all backend and functional checks pass. Appendix § 14 shows that releasing the register helps SHA3-256; separating loads alone gives no clear improvement.

OperationLLVM SLHVellSSLH defaultVellSSLH tunedΔ vs default (%) 95% intervalΔ vs SLH (%) 95% intervalLate masks
SHA3-25626.21626.43525.967−1.76 [−2.15, −1.37]−0.73 [−1.03, −0.42]6 → 0
SHA3-51248.57349.32348.654−1.10 [−1.45, −0.67]+0.38 [+0.12, +0.64]6 → 0
SHAKE12821.74521.79321.831+0.04 [−0.47, +0.48]+0.36 [−0.08, +0.77]12 → 3
SHAKE25626.44626.80226.757−0.45 [−0.82, −0.06]+0.96 [+0.66, +1.24]12 → 3
Kyber512 keygen18.43918.88818.784−0.55 [−0.81, −0.30]+1.98 [+1.62, +2.35]50 → 22
Kyber768 keygen31.17731.17731.147−0.14 [−0.24, −0.06]0.00 [−0.13, +0.12]49 → 24
Kyber768 encap.35.42936.00834.832−3.19 [−3.40, −2.99]−1.69 [−2.01, −1.34]70 → 30

Table 5. Backend tuning: runtime (μs/call\mu\mathrm{s}/\mathrm{call}), paired changes with 95% intervals, and late reload masks.

Six operations improve over default VellSSLH. SHA3-256 and Kyber768 encapsulation become 0.73% and 1.69% faster than LLVM SLH; SHAKE128 and Kyber768 key generation remain inconclusive. SHA3-512, SHAKE256, and Kyber512 key generation remain slower. SHA3-512 is still 0.38% slower despite having no added reload masks. We have not tested every option combination or checked these changed binaries with Spectector; RQ5 covers the default binaries.

RQ5: Functional and Binary Security Validation

We test the generated binaries for functional correctness and use Spectector to check security within a fixed exploration bound.

Functional correctness. Before timing, we compare outputs with reference implementations or other versions. Tests cover known vectors, boundary inputs, alignment, buffer guard bytes, input preservation, and supported overlapping buffers. Each trial runs 59,436 checks across 72 default objects: 534,924 passing cases across 648 linked binaries. Kyber tests check KEM consistency and boundaries, without independent known-answer validation. Object and function hashes link tests, timings, and binary analysis to the same code.

Bounded binary analysis. We use Spectector [11] with our x86 translation adapter and separately tested extensions to its instruction model (Appendix § 15). Each query allows a speculation window of 64, 20,000 execution steps, and 20 seconds. Selected retries allow up to 50,000 steps and 15 minutes. Eight VellSSLH binaries pass all selected queries: Poly1305, SipHash-2-4, SipHash128, ChaCha20, Secretbox open, and the Salsa20, HSalsa20, and HChaCha20 fixed cores. The three LLVM SLH fixed cores also pass. These results apply to the tested binaries and configurations, not to every input or execution.

The remaining 16 binaries have no verdict. Full Salsa20 and XSalsa20 exceed the resource limits. The other 14 contain instructions that the adapter does not fully model, including XMM operations, word-width operands, rotations in memory, and carry/borrow operations. LLVM can generate XMM instructions even from scalar IR. Appendix § 15 lists the obstacle for each binary. These are limits of the binary analysis, not VellSCT rejections or detected leaks. The binary checks also do not establish the validity of declassification policies or external-service contracts.

Related Work

Speculative security and selective hardening. Cauligi et al. [10] formulate SCT for directed speculative and out-of-order execution in Pitchfork. Barthe et al. [7] combine speculative memory safety and constant-time reasoning in Jasmin. Our LLVM model compares possible prefixes to accommodate nondeterminism.

Spectre Declassified [2] introduces selective SLH and explains how intentional disclosure interacts with speculation. Typing High-Speed Cryptography against Spectre v1 [3] provides normal/speculative labels, MSF typestate and three hardening primitives. VellSSLH addresses C-derived SSA, predecessor-sensitive flag PHIs and LLVM’s symbolic values, poison, provenance and faults.

Patrignani and Guarnieri [17] develop secure-compilation criteria for Spectre v1 mitigations and analyze strong SLH. Ultimate SLH [21] also protects variable-time arithmetic. FSLH [8] generalizes selective and ultimate hardening with mechanized relative-security guarantees and SCT corollaries. We prove checker soundness and architectural refinement for the LLVM/Vellvm fragment, observing branches, addresses and failures.

Automatic placement and LLVM implementations. Blade [19] uses transient/stable types and minimum dataflow cuts to synthesize protections in Cranelift/WebAssembly. VellSSLH uses inferred labels, reusable Public views and checked pruning, with an independent checker validating placement. LightSLH [24] uses abstract interpretation and a hardening-aware fixed point; its compiler-inserted-load examples motivate our late reload treatment. Serberus/LLSCT [15] protects constant-time crypto against broader speculation primitives under hardware control-flow assumptions. LLVM SLH [14] supplies our production performance baseline. Broader comparisons with LightSLH under matched LLVM settings and with optimized libjade on shared primitives remain future work.

Preserving security through compilation. CompCertCT [6] proves constant-time preservation using leakage-preserving, erasing and transforming simulations. Jasmin’s original compiler paper [1] gives a manual pass-wise constant-time argument. For speculation, Arranz Olmos et al. [5] exhibit spill/memory-reuse counterexamples and mechanize preservation for nine passes of a Jasmin-inspired compiler. SNIP [18] develops speculative non-interference preservation with directive-adapting simulations, including a register-allocation counterexample and repair. Hardware–software contracts [12] provide a framework for stating the barrier and dependency assumptions we require. Jasmin’s Spectre-RSB protection [16] treats return prediction and broader variants; our post-call fences do not constitute an RSB security claim. Our backend schema identifies the corresponding LLVM flag, reload, frame, rewrite and choice-selection obligations.

LLVM semantics and independent checking. The original Vellvm development and Zhao’s thesis establish SSA and verified transformation foundations [22, 23]. Modern Vellvm uses interaction trees and modular handlers for effects, under-defined values and nondeterminism [9, 20]. We add speculative directives and observations while preserving those value/memory interfaces. Spectector [11] independently analyzes bounded speculative information flow in assembly. Its instruction model and exploration bounds determine which of our objects it can decide.

Limitations and Trust Boundaries

The scalar fragment excludes SIMD, inline assembly, pointer-valued memory, atomics, volatile effects and unrestricted calls. Conservative memory and select rules limit acceptance; resource exhaustion yields unknown. Contracts, declassifications and external-service specifications are trusted policies, not proofs of cryptographic correctness or disclosure safety. Annotation transport, normalization, extraction, parsing and printing are also trusted. Backend checks cover specific MSF/reload conditions, not all LLVM rewrites, stack/ABI behavior, directive adaptation or hardware contracts. In particular, resolving IMPLICIT_DEF from stale Secret register contents could leak despite passing the MSF checks.

The forward sticky-bit model excludes rollback, indirect-branch attacks, store bypass and other timing channels. Bounded binary analysis establishes no verdict for unsupported or exhausted queries. Performance covers selected portable implementations on one Intel host with randomized layouts, not whole libraries, optimized production crypto or other microarchitectures. AArch64 lowering is implemented but unmeasured. Other LLVM frontends, including Rust, could reuse the analysis after transporting secrecy contracts; panics, aggregates and overflow intrinsics may require new rules and proofs.

AI Use. We used OpenAI’s Codex and Anthropic’s Claude for implementation assistance, proof repair, experiment automation, artifact preparation, consistency checks, data analysis, and drafting and editing prose. Formal guarantees rely on Rocq-checked proofs. We take full responsibility for the correctness and content of this work.

Data-Availability Statement

The research artifact will be made publicly available after acceptance of this paper. It will include the Rocq proof development and dependencies, compiler modifications, extraction scripts, benchmark harnesses and objects, raw measurements, and validation reports, together with build and reproduction instructions.

IR Proof Structure

We first state the IR theorems and their assumptions, then describe the state relations and instruction lemmas used to prove them.

Formal statements and assumptions

The three main theorems use compatible implementations of Vellvm’s LLVM parameters, memory, bytes, concretization, and shared runtime, together with the CFG and source interfaces. The statements below include their outer assumptions and use Vellvm’s call semantics.

Executions and initial indistinguishability. Write C⟹A,hOC′C \mathrel{\overset{O}{\underset{A,h}{\Longrightarrow}}} C' for an execution from CC to C′C' with finite trace O=o1⋯onO = o_1 \cdots o_n. The silent steps preceding oio_i and the step producing it use directive A(h⋅o1⋯oi−1)A(h \cdot o_1 \cdots o_{i-1}), chosen from the observation history. The possible traces from CC are

Tr⁡A(C)={O∣∃C′. C⟹A,COC′}.\operatorname{Tr}_{A}(C) = \{O \mid\exists C'.\ C \mathrel{\overset{O}{\underset{A,C}{\Longrightarrow}}} C'\}.

The relation Init⁡(I,V,σ1,σ2,a⃗)\operatorname{Init}(I,V,\sigma_1,\sigma_2,\vec{a}) requires both states to start outside speculation with empty local environments and frame stacks. Their heaps have matching metadata, agree on store identifiers and bytes at visible addresses V(p)V(p), and match byte reads in both directions. All readable heap bytes must be admissible.

The pairs in a⃗\vec{a} list the prepared inputs in order. Each pair satisfies ≈τ0\approx^{0}_{\tau}, and both values are readable at the expected kind. For a normally Public memory input, VV includes every allocated byte reachable through any concretization of the pointer’s provenance in either heap.

A readable scalar is correctly typed and yields an integer under nondeferred concretization. A readable pointer is an address or a correctly typed deferred value. An admissible byte comes from an in-bounds position of a concrete integer, an address, or a correctly typed deferred parent value.

The premise Layout⁡(P)\operatorname{Layout}(P) checks recursive nonvoid validity of every allocated LLVM type in PP. Let TT be the function-address table and gg the global environment. Link⁡(T,g)\operatorname{Link}(T,g) requires (n,p),(n′,p)∈T⇒n=n′(n,p),(n',p) \in T \Rightarrow n=n' and g(n)=Addr⁡(p)⇒(n,p)∈Tg(n)=\operatorname{Addr}(p) \Rightarrow(n,p) \in T. The configuration Run⁡P,T,g(f,v⃗,σ)\operatorname{Run}_{P,T,g}(f,\vec{v},\sigma) executes the normalized meaning of ff with the module’s linked callees. The prepared return contract determines which returned values the observer can see.

Soundness of accepted IR. For every PP, ff, mm, rr, II, TT, gg, VV, σ1\sigma_1, σ2\sigma_2, a⃗\vec{a},

Check⁡(P)=true⁡∧f∈Defs⁡(P)∧Layout⁡(P)∧Link⁡(T,g)\operatorname{Check}(P) = \operatorname{true} \land f \in\operatorname{Defs}(P) \land\operatorname{Layout}(P) \land\operatorname{Link}(T,g)
∧ Mode⁡(m,P,f)=Some⁡(r)∧Prepare⁡(m,P,f)=Some⁡(I)∧Init⁡(I,V,σ1,σ2,a⃗)⇒ ∀A. Tr⁡A(Run⁡(f,π1a⃗,σ1))=Tr⁡A(Run⁡(f,π2a⃗,σ2)).\begin{aligned} \land\ \operatorname{Mode}(m,P,f) = \operatorname{Some}(r) \land\operatorname{Prepare}(m,P,f) = \operatorname{Some}(I) \land\operatorname{Init}(I,V,\sigma_1,\sigma_2,\vec{a}) \\ &\Rightarrow\ \forall A.\ \operatorname{Tr}_{A}(\operatorname{Run}(f,\pi_1\vec{a},\sigma_1)) = \operatorname{Tr}_{A}(\operatorname{Run}(f,\pi_2\vec{a},\sigma_2)). \end{aligned}

Mode checking and preparation read the module’s attribute groups. The projection πj\pi_j selects the jjth value from each argument pair. The premises require acceptance and valid initial conditions; the theorem proves that the function bodies have matching observable behavior.

Declassification-aware soundness. For policy RR, designated-service names ρ\rho, and service ss, Safe⁡(s)\operatorname{Safe}(s) is the atomic security contract. The service receives only the heap and request. On success, it writes only the writable, consecutive output range and preserves other bytes, metadata, and saved caller frames. Equal public requests in related states have matching responses: success with related states and Secret output bytes, or the same failure. For every ss, RR, ρ\rho, PP, DD, ff, II, TT, gg, VV, σ1\sigma_1, σ2\sigma_2, a⃗\vec{a},

Safe⁡(s)∧Check⁡R,ρ(P)=true⁡∧Readonly⁡(P)=Some⁡(D)∧f∈Defs⁡(P)\operatorname{Safe}(s) \land\operatorname{Check}_{R,\rho}(P) = \operatorname{true} \land\operatorname{Readonly}(P) = \operatorname{Some}(D) \land f \in\operatorname{Defs}(P)
∧ PrepareExt⁡(P,f)=Some⁡(I)∧Layout⁡(P)∧Link⁡(T,g)∧Init⁡(I,V,σ1,σ2,a⃗)\land\ \operatorname{PrepareExt}(P,f) = \operatorname{Some}(I) \land\operatorname{Layout}(P) \land\operatorname{Link}(T,g) \land\operatorname{Init}(I,V,\sigma_1,\sigma_2,\vec{a})
∧ GlobalView⁡(D,V,g,σ1)∧GlobalView⁡(D,V,g,σ2)⇒Coupled⁡(C1,C2).\land\ \operatorname{GlobalView}(D,V,g,\sigma_1) \land\operatorname{GlobalView}(D,V,g,\sigma_2) \Rightarrow\operatorname{Coupled}(C_1,C_2).

CjC_j uses the declassification-aware semantics on πja⃗\pi_j\vec{a}, with the module’s functions and designated service linked in. GlobalView requires address bindings for tracked globals; the provenance-accessible bytes of normally Public memory must lie in the visible region. Coupled supplies a relation containing (C1,C2)(C_1,C_2) that matches silent and ordinary steps in both directions, preserves equal semantic bits, and matches declassification sites. At related sites, every pair of actual steps with equal declassification outcomes must leave related states.

The trace corollary holds in both directions. For all AA, hh, OO, C1′C'_1,

C1⇒A,hOC1′⇒(∃C2′. C2⇒OC2′∧Coupled⁡(C1′,C2′))∨Diff⁡A,h(C1,C2,O).C_1 \xRightarrow[ A,h]{O} C'_1 \Rightarrow(\exists C'_2.\ C_2 \xRightarrow[ O]{ } C'_2 \land\operatorname{Coupled}(C'_1,C'_2)) \lor\operatorname{Diff}_{A,h}(C_1,C_2,O).

In Diff, the first difference is an authorized release: declass⁡(ℓ,u)\operatorname{declass}(\ell,u) and declass⁡(ℓ,u′)\operatorname{declass}(\ell,u'), with u≠u′u \ne u'. The left trace includes this release and any later observations. Earlier observations must agree. A release outcome is a concrete value or a materialization failure.

Architectural behavior and insertion refinement. Beh⁡s,R,ρ,T,g(P,K,f,v⃗,o,e⃗,σ,O,σ′,z)\operatorname{Beh}_{s,R,\rho,T,g}(P,K,f,\vec{v},o,\vec{e},\sigma,O,\sigma',z) describes a completed finite execution using only step. It executes ff linked with P+KP+K, passes any nonvoid return value and extra arguments e⃗\vec{e} to observer oo, then materializes the observer’s result. The optional result is zz. Observing poison produces undefined behavior; out-of-memory and other faults remain observable.

The final-state relation σ⪯zσ′\sigma\preceq_z \sigma' requires equal memory metadata and semantic bits. Every concrete result of a typed load from the target heap must also be possible from the source heap. If zz is present, the restored local environments and frames must agree as well.

The architectural contract Arch⁡(s)\operatorname{Arch}(s) matches service responses on heaps related by coherent byte families and matching metadata. Success preserves admissible memory and saved caller frames. It compares source and target behavior; Safe⁡(s)\operatorname{Safe}(s) compares executions with different secrets.

For every ss, R\mathcal{R}, ρ\rho, PP, P′P', TT, nn, ff,

Arch⁡(s)∧Harden⁡R,ρ(P)=Some⁡(P′)∧Lookup⁡(n,P)=Some⁡(f)⟹∃f′. Lookup⁡(n,P′)=Some⁡(f′)∧∀g,v,σ,K,o,e⃗. World⁡⟹∀O,σt,z. Beh⁡(P′,K,f′,v,o,e⃗,σ,O,σt,z)⟹(∃σs. Beh⁡(P,K,f,v,o,e⃗,σ,O,σs,z)∧σs⪯zσt)∨SourceUB⁡(O).\begin{aligned} \operatorname{Arch}(s) \land\operatorname{Harden}_{\mathcal{R},\rho}(P) &= \operatorname{Some}(P') \land\operatorname{Lookup}(n,P) = \operatorname{Some}(f) \\ &\Longrightarrow\exists f'.\ \operatorname{Lookup}(n,P') = \operatorname{Some}(f') \land\forall g,v,\sigma,K,o,\vec{e}.\ \operatorname{World} \Longrightarrow\\ &\qquad\forall O,\sigma_t,z.\ \operatorname{Beh}(P',K,f',v,o,\vec{e},\sigma,O,\sigma_t,z) \Longrightarrow\\ &\qquad\left(\exists\sigma_s.\ \operatorname{Beh}(P,K,f,v,o,\vec{e},\sigma,O,\sigma_s,z) \land\sigma_s \preceq_z \sigma_t\right) \lor\operatorname{SourceUB}(O). \end{aligned}

The semantic parameters of Beh are fixed above. The premise World requires all of the following:

  • A state outside speculation with empty locals and frames, an admissible heap, and correctly typed, readable nonvariadic arguments to ff.

  • An observer defined in KK and accepted by inference for P+KP+K, with nonvariadic arguments and the source return type prepended when needed.

  • Successful context ABI checking: resolved calls use a supported checked interface, and callers have valid C-ABI annotations.

  • No context definition overriding ρ\rho, valid layouts for P+KP+K, address bindings for every global that is present, and Link⁡(T,g)\operatorname{Link}(T,g).

Finally, SourceUB(OO) means that O=p⋅qO = p \cdot q and a source execution has trace p⋅[UB]p \cdot[\mathrm{UB}], a failed final state, and no result: undefined behavior occurs after a prefix shared with the target.

Concrete instance and validation status. The supplement constructs the hardened lookup program using Vellvm’s finite 64-bit addresses, provenance, layouts, bytes, memory, and concretization. It starts with empty heaps, null pointers, and i=n=0i = n = 0, so normal execution takes the branch without a load. Rocq compilation accepts the base initial-state, layout, and linking premises, as well as the architectural entry, observer, and service-contract premises. The unused service always reports out-of-memory. The example exercises no successful load, allocation, declassification, or RNG response.

Independent rechecking fails with a module-typing error that also occurs when instantiating Vellvm’s unchanged concretization factory without SSLH. The instance therefore remains unvalidated and neither instantiates all three theorems nor covers a cryptographic core. Checker acceptance alone does not establish the runtime premises. The generic theorems’ assumption lists contain no admitted lemmas from vendored Vellvm. Their inherited logical principles, runtime interfaces, and explicit service premises are described in Appendix § 11.§ 7.

The proofs share one runtime module to keep memory and event types consistent. Instruction lemmas are separate from trace composition and can be reused across programs.

The security invariant

The proof starts from valid states with equal public inputs and possibly different secrets. At corresponding control points, the executions have the same semantic speculation bit. Their current and saved SSA environments contain related values: Public values agree, Transient values agree outside speculation, and Secret values may differ. The heap relation tracks allocations, permissions, pointer provenance, and public bytes. It also accounts for readability and the possible concrete outcomes of LLVM values.

The invariant connects the MSF to the semantic speculation state. A ready flag is all ones during misspeculation. After a branch, the invariant records the chosen edge until the MSF update completes. Protection cannot use the old flag in this intermediate phase: it may not yet reflect the misprediction.

Local steps preserve the relation

For arithmetic that cannot fail, related Public operands produce equal results. Public branch conditions give matching observations, and the invariant records the chosen edge for the next MSF update.

Loads motivate the Transient type. A load from Public memory returns equal values during normal execution, but misspeculation may redirect it to secret memory. The resulting values can differ and are typed Transient. Before an observable use, protection preserves their normal values or replaces both speculative values with all ones. The pointer case also accounts for pointer construction and its possible failure.

The store rules preserve the heap relation. Partial operations require enough operand agreement to match both successful results and faults. All PHIs read the saved predecessor environment before writing any destination. Flag PHIs also preserve the flag’s origin and pending edge.

At a call, the checked interface and fence protocol establish the argument and memory relations, preserve the suspended caller, and end the old flag’s lifetime. Return restores related caller frames. External services use their assumed relational contracts.

From local steps to observable executions

An LLVM instruction may take several semantic steps to read operands, choose concrete values, or access memory. We match these steps up to the next observation, allowing different numbers of silent steps. The matching segments produce the same ordinary observation and preserve the invariant.

Induction gives a matching execution for every finite observation prefix. Applying the argument in both directions proves equality of the possible prefixes under the same attacker strategy. The proof matches public nondeterministic choices, including allocation addresses; it does not assume that independent choices agree.

Declassification and trusted-service cases

The declassification rule requires Public control and an authorized site, so related executions reach the same site. During normal execution, each side materializes its operand as a value or a failure. Every pair of steps with equal outcomes must leave related states. Unequal outcomes mark the first authorized difference, after matching all preceding observations.

During misspeculation, declassification returns the operand without revealing it or changing its speculative type. A value that may differ between executions still needs protection before an observable use.

Public buffer addresses and lengths ensure that both executions make the same service request. The assumed contract supplies a matching response in the other execution: success preserves the state relation, memory metadata, and saved frames; failure produces the same observation. Secret output bytes may differ. The service implementation lies outside the proof.

Induction in both directions gives the trace property of Appendix § 11.§ 1, up to the first authorized difference.

Relating source and inserted fragments

Architectural preservation compares the original and hardened programs from the same state and arguments. The source may stay at one instruction while the target computes masks or updates the MSF. The subsequent original operation must produce related results and effects.

For example, protection before a load leaves its operand unchanged when the flag is clean, so both programs access the same address. After the load, the invariant relates the source destination to the generated SSA names. The remaining instruction cases follow the same structure, tracking the CFG edge and the current phase of each inserted sequence.

A decreasing measure bounds the bookkeeping before the next original operation. Composing the instruction cases restores caller frames and relates the final observer result. Concrete results and memory satisfy the refinement relation even when symbolic expression trees differ. The theorem also allows source undefined behavior after a shared observation prefix.

Proof assumptions

The proofs use Vellvm’s address, provenance, layout, concretization, and byte interfaces. Appendix § 11.§ 1 gives the input, memory, linking, context, and service requirements for each theorem. These requirements constrain the initial state and available operations; the simulation is proved. Compiler, hardware, and policy limits are discussed in § 9.

The final assumption audits contain no admitted Vellvm lemmas or added security or preservation axioms. They use Vellvm’s classical reasoning, functional extensionality, and equality principles. The final theorems were kernel-checked using precompiled dependencies; the full dependency tree has not been validated by a clean rebuild.

Backend Preservation Obligations

The Rocq proofs establish security at LLVM IR. Carrying this result to assembly requires each later pass to preserve the relation below, including observations from compiler-generated instructions. We consider the configured SelectionDAG backends for x86-64 Linux and AArch64 Linux/Darwin. Our implementation checks some of these conditions; the rest are assumptions about LLVM passes, calling conventions, and hardware.

Execution domain and required invariant

The target model observes attempted memory addresses, conditional control transfers, public results, and failures (§ 3); register-only operations are silent. We assume that barriers stop an existing speculative window and that masks take effect before protected values are used. These hardware–software contracts [12] are assumptions about the target processor.

The initial target states agree on stack bases, argument locations, code and global addresses, and relevant permissions. Spill and saved-register storage is separate from source objects, which may occupy other parts of the frame. We assume enough stack space and source executions without architectural undefined behavior. Defined nondeterministic operations, including freeze, require the additional condition below.

At corresponding program points, a proof-only map JJ locates each live value in a virtual register, physical register, or private stack slot. The relation requires:

  1. Live values keep their normal and speculative classifications. Public observable operands agree, and pointer representations preserve the correspondence between addresses and provenance.

  2. A ready MSF occupies a whole register and equals enc⁡(b)\operatorname{enc}(b), where enc⁡(false⁡)=0\operatorname{enc}(\operatorname{false}) = 0 and enc⁡(true⁡)=264−1\operatorname{enc}(\operatorname{true}) = 2^{64} - 1. Until an update finishes, a pending flag retains the old state, captured condition, and chosen edge.

  3. An active MSF never resides in memory. Register assignments respect overlapping live ranges and register aliases. The flag’s lifetime ends at the checked call boundary.

  4. Added stack locations have public addresses and are private to the compiler. Before a reload reaches a Public use, it must be shown Public by a store/reload check, protected by a ready mask, or covered by a full barrier.

The flag must also be correct during normal execution: an all-ones mask would otherwise change an architectural value.

Local matching requirement. Write q1≡Jq2q_1 \equiv_J q_2 for this relation, including agreement on control position, primitive-expansion phase, and semantic speculation bit. From related configurations, each finite segment ending at the next observation must have a matching segment with that observation and related final configurations. This holds in both directions, including possible failures, except for a first authorized difference at normal declassification. During primitive expansion, JJ also tracks temporary values and the remaining steps.

Conditional implication. If local matching holds at every reachable phase, induction extends matching histories one observation at a time. Equal histories select the same attacker directive. The argument in both directions gives equality of possible finite prefixes up to authorized releases. Each compilation stage must establish local matching for its output.

A conditional backend guarantee

Suppose the initial calling-convention and loader states satisfy the invariant, every compiler stage preserves local matching, nondeterministic choices are resolved safely, and the hardware contracts hold. The two resulting assembly executions then have matching finite observation prefixes up to the same authorized declassifications. This includes accesses added for the stack and constant pool. Preservation of normal results and memory additionally requires the ordinary passes’ architectural correctness contracts.

The implementation checks the following conditions; each item also identifies what remains assumed.

  1. IR and flag protocol. The extracted checker recomputes labels and validates SSA/CFG structure, primitive signatures, and uses of the current flag. The driver also rechecks serialized IR. Correct transport through the frontend, extraction, and parser remains trusted.

  1. MSF and masks. Register tags and checks enforce the supported nonspill, call-lifetime, flag, and dependency rules. On x86, a certificate checks the condition, edge, and live flags used when reusing branch flags. If reuse cannot be justified early, the scalar MSF update is kept. If a later check finds that the flags changed or no longer identify the edge, compilation is rejected. These checks do not reconstruct JJ for every ordinary value. The optional AArch64 vector representation uses the same nonspill and call-lifetime checks. Removing unused MSF operations also requires final validation; if register allocation invalidates that removal, the driver can retry while retaining the flag state.

  1. Ordinary rewrites and value choices. Disabling select optimization and x86 CMOV conversion prevents known control-flow changes. LLVM’s machine verifier checks structural invariants. Other rewrites must still preserve the relation between executions, resolve Public choices independently of secrets, and preserve the required dependencies.

  1. Frames and reloads. The x86 reload checks validate supported Public store/reload paths or masking patterns. AArch64 uses the stated barrier or mask policies. Separation of source and compiler storage, matching argument locations, and surrounding frame transformations remain assumptions.

  1. Final machine execution. Barrier effectiveness, dependencies at protected uses, matching calling-convention and loader behavior, and preservation through assembly and linking remain target contracts. Bounded binary tests provide evidence only for the tested objects and configurations.

Passes that change instruction boundaries also need a translation of directives between levels. The two executions at each level use the same adaptive strategy, but compilation can change the directive sequence. Added stack observations must match between the compiled executions; they cannot be erased from the argument.

IR preparation, selection and nondeterminism

Loop simplification, induction-variable rewriting, strength reduction, constant hoisting, code-generation preparation, and lowering must preserve values, definedness, Public observable operands, and the association between captured conditions and CFG edges. New conditionals need an MSF update or barrier before sensitive uses, even when the condition is Public. Analyses of dominance, aliases, loops, liveness, and frequency introduce no instructions and need no execution argument.

Instruction selection and legalization must avoid Secret-indexed tables, unsupported helper calls, and Secret-dependent branches. New temporaries receive the join of their operands’ classifications. Concrete word operations preserve the value relation; partial operations must also preserve possible faults. Passes for atomics, vectors or tiles, garbage collection, exceptions, thread-local storage, profiling, sanitizers, and thunks need separate arguments when their features are enabled.

Choosing concrete values safely. At IR level, the proof can match nondeterministic choices between executions. When compilation resolves a choice, the chosen Public result must depend only on matching public state and compilation constants, or have another justification in the state relation. For example, freeze undef permits every word in either IR execution. Lowering it to IMPLICIT_DEF could reuse a register containing an old Secret value. The compiled executions could then choose different observable addresses. Each could still refine its own IR execution while the pair violates SCT. Requiring defined source behavior does not rule out this example.

An under-defined value must either have no effect on a Public observation or be resolved independently of secrets before that use. This condition also applies to register reuse and partial-register writes. The MSF and reload checks do not establish it globally. Local rejection of undefined operands, including restrictions on freeze, is not sufficient.

Selection must also preserve flag and data dependencies of the primitives. Normal declassification keeps the declared concrete outcome; speculative declassification keeps the speculative type and produces no disclosure. If lowering erases a marker, the proof must still track its logical site and release policy.

Machine SSA, CFG transformations and scheduling

PHI optimization, copy propagation, common-subexpression elimination, peephole rewrites, dead-instruction removal, and loop motion must preserve each value’s representation. Flag copies retain their origin and ready or pending phase. CFG rewrites—tail duplication, branch folding, unreachable-block removal, placement, and relaxation—must preserve the incoming-edge mapping. Branch inversion changes both the successor interpretation and the flag update. Edge splitting adds an intermediate phase; a new join must select its predecessor’s flag. The implemented checks cover supported flag transfers, not all ordinary value rewrites or concrete-value choices.

Scheduling must preserve initialization, update, and protection dependencies, together with memory and definedness conditions. A Public view can leave its input bits unchanged but must preserve these dependencies. The x86 implementation retains an opaque, tied pseudo until final certification. Side-effect chains, operand constraints, and instruction bundles enforce local ordering rules; the scheduling stage must preserve the full security relation.

PHI elimination, coalescing, allocation and calls

PHI elimination inserts copies on incoming edges. Temporaries used to resolve cycles must preserve the state relation and remain nonspillable when they hold an MSF. Two-address conversion, coalescing, allocation, live-range splitting, and cloning must respect overlapping live ranges, register aliases, and early-clobber constraints for every live MSF copy. Unsupported transfers or allocation failure must reject compilation.

Register reuse also needs the concrete-value condition above: the bits already in a register do not make an undefined value Public. At an ordinary checked call, the caller ends the flag’s lifetime, synchronizes, and initializes a fresh flag after return. Trusted services use their separate protocol and contract. Argument moves and saved registers obey the public calling-convention and frame conditions. Carrying a live flag across calls would require a different interprocedural proof.

Ordinary spills and frame construction

A spill adds an address observation, which agrees between executions when the frame bases and fixed offset agree, even for Secret contents. Separate compiler storage keeps the spill from changing source memory. An uncertified reload is Transient when its architectural value is Public, and Secret otherwise. Its public stack address does not establish the value’s speculative classification.

A ready mask must protect a Transient reload before any Public use, preserving equal normal values and replacing speculative values with all ones. Placement and dependencies prevent use of the raw reload; a full barrier permits only a normal continuation. The x86 store/reload checks account for reaching full-width stores, overlapping or intervening writes, aliases, and folded loads. A source annotation is insufficient. The counter rule accepts recognized immediate increments only when every incoming path reaches the same constant initializer; it cannot make a Secret architectural value Public.

The conservative AArch64 profile uses full barriers for ordinary stack traffic. Its optional masked-reload profile requires a locally live GPR flag, a mask, and a consumption barrier at the use. Removing duplicate barriers must preserve coverage of every entry path. Stack and slot coloring, frame allocation, prologue and epilogue insertion, shrink wrapping, and frame-index elimination must preserve disjoint live lifetimes, public stack adjustments, and register saves and restores. Accesses before MSF initialization require the same frame conditions.

Primitive expansion and final rewrites

For concrete words, primitive expansion obeys the following equations. Initialization combines a target barrier with zeroing the flag. Let cc be the Boolean branch condition and tt the chosen edge. A true-edge update computes c−1c - 1, and a false-edge update computes −c-c, modulo 2642^{64}. Each is zero exactly when c=tc = t and all ones otherwise. OR with the old flag therefore represents b∨(c≠t)b \lor(c \ne t). When an update reuses branch flags, checking must establish that those bits represent this condition and that other flag uses remain valid. Reasoning about the whole flag register can miss bits preserved by a partial update.

Protection copies the input and ORs in the mask truncated to its width. It preserves a concrete normal word and returns 2w−12^w - 1 when the MSF is poisoned. Dependencies and scratch-register alias conditions must ensure that the consumer uses this protected result. This word-level equation does not by itself justify LLVM poison, under-defined values, or pointer provenance. Initialization uses LFENCE on x86 and SB or DSB SY; ISB on AArch64. AArch64 uses of masks and updates also require the stated consumption-barrier contract. Its optional vector representation must preserve the low-word bits and satisfy the alias, scratch, nonspill, and lifetime conditions. After allocation, the obligations also cover copy removal, scheduling, LEA and addressing rewrites, width and execution-dependency fixes, branch and layout changes, and load/store pairing. Every component of a paired access needs a public address. Debug and unwind metadata are silent; instrumentation that emits instructions needs its own argument. Final x86 checking covers supported spill and flag patterns. AArch64 expansion runs after branch relaxation. Bundle unpacking, printing, assembly, relocation, and linking must preserve operands, ordering, branch targets, and the loader mapping.

Benchmark Preparation and Measurement Details

Streams, Secretbox, X25519, and SHA-512 include TweetNaCl implementations; the other routines use fixed versions of libsodium, HACL*, or Kyber. Some of the 24 operations share code and are not independent algorithm families. Every compared ChaCha20 wrapper omits the outer context cleanup.

The default comparison uses the same prepared IR, instruction-set features, drivers, and inputs. Preparation uses inlining, stack-variable promotion, and loop settings that expose supported scalar instructions. X25519 keeps its arithmetic sel25519 until a later inlining step. We expand selects with proved-defined operands and Kyber’s integer selects with constant alternatives. Poly1305 retains its branchless arithmetic; remaining Secret select guards are rejected. Select optimization and x86 CMOV-to-branch conversion are disabled in all three versions. VellSSLH also uses the backend restrictions of § 6.

All 24 modules pass VellSCT, so Theorems 1–2 apply under their entry, runtime, declassification, and service assumptions, regardless of the insertion algorithm. Theorem 3 covers the reference inserter. Fourteen benchmarks use other selective or read-only variants; ten use a release path without an established correspondence to the proved source version. Preparation and Public-view rewrites are also outside that theorem. Functional tests check normal behavior but do not establish architectural preservation for these variants.

The nine matched trials run on CPU 2, identified by CPUID as a performance core. We randomize code padding, link order, and measurement order while keeping the cryptographic objects and driver sources unchanged. Timing includes the common test loop and output checksum, but excludes calibration, warmup, reference computations, and full-output checks. Comparisons with unprotected code and LLVM SLH use the geometric mean of within-trial ratios. Ultimate SLH was measured separately and uses ratios of medians. The percentages can therefore differ from ratios of rounded table entries. Confidence intervals resample whole trials, including layout variation; no trials are discarded.

Matched Backend Configuration Controls

Table 7 compares unprotected code and LLVM SLH with loads separated from their consuming instructions. For hashes, it also compares reserving and releasing the reload scratch register. The input IR and paired, randomized-layout trials match Table 5. These controls separate the effects of ordinary memory-instruction choices from protection costs.

For SHA3-256, separating loads while keeping the scratch register changes runtime by +0.26% (95% interval [-0.002, +0.54]%). Releasing that register in the same configuration improves runtime by 2.01% (change [-2.52, −1.62]%). For SHA3-512, the first change is an inconclusive +0.07%, and releasing the register gives a 1.17% improvement (change [-1.46, −0.81]%).

Releasing the register changes allocation and instruction selection as well as removing masks. For SHA3-512, the instruction count rises from 1,649 to 1,726 and the MOV count from 801 to 882, despite eliminating late masks. The timings measure these effects together. All MSF initializations

OperationBare: no fusion vs normal (%)SLH: no fusion vs normal (%)Tuned vs no-fusion SLH (%)Scratch off vs on within no fusion (%)
SHA3-256−0.53 [−0.87, −0.17]+0.01 [−0.23, +0.26]−0.74 [−1.07, −0.40]−2.01 [−2.52, −1.62]
SHA3-512+0.21 [−0.02, +0.44]+0.59 [+0.44, +0.74]−0.21 [−0.50, +0.11]−1.17 [−1.46, −0.81]
SHAKE128−0.14 [−0.39, +0.09]−0.09 [−0.36, +0.18]+0.46 [+0.09, +0.78]−0.28 [−0.63, +0.04]
SHAKE256+0.99 [+0.52, +1.49]+0.35 [−0.06, +0.73]+0.61 [+0.09, +1.18]−0.39 [−0.82, +0.07]
Kyber512 keygen+1.80 [+1.42, +2.20]+1.79 [+1.50, +2.13]+0.19 [−0.02, +0.45]–
Kyber768 keygen+2.03 [+1.79, +2.25]+0.45 [+0.27, +0.63]−0.45 [−0.69, −0.21]–
Kyber768 encap.+1.67 [+1.51, +1.82]+1.87 [+1.70, +2.04]−3.50 [−3.81, −3.16]–

caption: tbl:7. Backend-option controls: paired percentage changes with 95% intervals.

:::

OperationInstructionsMOVsFunction bytesINIT
SHA3-2561,499 → 1,566707 → 7786,227 → 6,4041
SHA3-5121,649 → 1,726801 → 8826,677 → 6,9441
SHAKE1282,169 → 2,2571,012 → 1,1079,380 → 9,5531
SHAKE2562,171 → 2,2591,013 → 1,1089,396 → 9,5531
Kyber512 keygen7,940 → 8,1883,830 → 4,09834,917 → 35,2513
Kyber768 keygen6,763 → 6,9783,279 → 3,51129,761 → 30,0263
Kyber768 encap.10,948 → 11,4005,201 → 5,68548,702 → 49,6442

Table 8. Static code counts and function sizes before and after tuning; INIT counts initialization sites.

and call protocols remain, and the strict backend and functional checks pass. These changed binaries have not received new security queries.

Bounded Binary Analysis Coverage

All selected configurations complete for eight binaries; the other 16 remain inconclusive (Table 9). A successful check covers the tested configurations and speculation window. The instruction model supports separately tested, restricted forms of rotates and SHLD, dead-flag intervals, and zero-extending word-register reads. It rejects other forms.

BinariesCountReason the analysis is inconclusive
Salsa20/XSalsa20 streams2Some nonempty-input queries exceed resource limits. Zero-length queries and Salsa20’s one-byte query finish.
Secretbox encrypt, SHA3/SHAKE, Kyber768 keygen6The model lacks XMM zeroing and transfers. Kyber also uses unsupported word-width operands.
Kyber512 keygen1The model supports rotates into registers, but this binary rotates a value in memory.
SHA-512, X25519 scalar/base3Carry and borrow handling for ADC/SBB is incomplete. X25519 also uses bit-test flags.
Kyber encapsulation/decapsulation4The model does not fully handle 32-bit SBB.

Table 9. Instruction-model and resource limits for 16 inconclusive binary checks.

These limits belong to the pinned Spectector version, translator, or adapter; the IR checker can accept the corresponding scalar program. Register allocation may introduce xorps and movaps/movups to zero or copy stack data. Their model must account for 128-bit contents and memory effects. Similarly, adc/sbb require width-correct carry, borrow, and flag semantics, including their effects on later arithmetic and branches. Kyber512 key generation contains rolq \$27,-88(%rbp), a rotate in an ordinary stack slot; the restricted model accepts only general-purpose register destinations. This operation does not spill the MSF.

Unsupported instructions leave binary security undecided. Longer time limits can help an exhausted search, but cannot supply missing semantics. The queries fix public inputs and memory regions; they do not model declassification or trusted services. The seven tuned binaries have not been rechecked, so the default verdicts and diagnostics do not transfer.

Ultimate SLH Comparison

We compare all 24 default VellSSLH operations with Ultimate SLH [21] on the same Intel core. Ultimate uses LLVM 16, post-load hardening, and all four published options: sbhAll, fixed, store, and vtInstr. We adapt one API spelling to the upstream version without changing the algorithm. Ten inputs use older attribute spellings, which we check normalize to the same attributes. The IR, instruction-set profile, test drivers, and reference inputs are otherwise the same. Upstream LLVM lacks our project-specific load-narrowing option.

Scope of the additional protections. Ultimate SLH also protects variable-time instructions, a channel our observation model does not explicitly cover. None of the 24 measured cryptographic objects contains integer division, floating-point arithmetic, or REP instructions; shared runtime-library code is excluded from this claim. Recompiling every input with the same Ultimate compiler and settings, changing only vtInstr to false, produces 24 byte-identical ELF objects. The option adds no code in these workloads and remains enabled in all reported timings.

Both tools protect branch conditions and memory addresses. The variable-time option adds no code here, but the tools still differ in their security models and supported programs.

Ultimate uses nine fixed-layout trials; VellSSLH uses nine randomized-layout trials. Confidence intervals resample each set’s trial medians independently. The geometric mean of the runtime ratios is 0.80349; 21 intervals are below one, while the three cores remain slower. The different compilers and measurement procedures prevent attributing the result solely to hardening policy.

Functional tests cover 19,812 cases per Ultimate or control version. Kyber has consistency tests but no independent known-answer validation. The audit covers 24 linked routines, 1,944 timed batches, and 2,555 logs. Ultimate has not been checked with Spector, and this comparison excludes the separately tuned binaries.

OperationBytesUltimateVellSSLH defaultΔ\Delta vs Ultimate (%)Ratio 95% interval
Poly130516,3848.4527.775-8.01[0.9165, 0.9279]
SipHash-2-416,3845.4225.373-0.91[0.9875, 0.9944]
SipHash12816,3845.4295.325-1.91[0.9798, 0.9841]
ChaCha2016,38424.20623.543-2.74[0.9639, 0.9774]
Salsa2016,38467.62045.689-32.43[0.6700, 0.6843]
XSalsa2016,38472.44044.612-38.42[0.6134, 0.6267]
Secretbox encrypt16,384819.762362.844-55.74[0.4414, 0.4435]
Secretbox open16,384535.922223.031-58.38[0.4126, 0.4296]
SHA3-25616,38427.70726.497-4.37[0.9521, 0.9589]
SHA3-51216,38450.49249.184-2.59[0.9728, 0.9762]
SHA-51216,38442.78433.644-21.36[0.7850, 0.7892]
SHAKE12816,38422.98221.750-5.36[0.9415, 0.9544]
SHAKE25616,38428.29126.664-5.75[0.9415, 0.9488]
X25519 scalar32844.987600.199-28.97[0.7082, 0.7127]
X25519 base32844.236601.333-28.77[0.7109, 0.7147]
Kyber512 keygen–23.53118.869-19.81[0.8005, 0.8048]
Kyber512 encap.–28.50122.351-21.58[0.7781, 0.7887]
Kyber512 decap.–33.57224.382-27.38[0.7218, 0.7320]
Kyber768 keygen–40.69731.159-23.44[0.7636, 0.7700]
Kyber768 encap.–46.37535.868-22.66[0.7701, 0.7766]
Kyber768 decap.–52.82339.374-25.46[0.7405, 0.7490]
Salsa20 core160.0840.087+3.25[1.0234, 1.0370]
HSalsa20 core160.0780.084+7.73[1.0718, 1.0814]
HChaCha20 core160.0830.088+6.09[1.0525, 1.0639]

Table 10. Ultimate SLH comparison (μ\mus/call); ratio intervals independently resample trials from each campaign.

References

  1. [1]José Bacelar Almeida, Manuel Barbosa, Gilles Barthe, Arthur Blot, Benjamin Grégoire, Vincent Laporte, Tiago Oliveira, Hugo Pacheco, Benedikt Schmidt, and Pierre-Yves Strub. 2017. Jasmin: High-Assurance and High-Speed Cryptography. In Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security. ACM, 1807–1823. doi:10.1145/3133956.3134078DOI
  2. [2]Basavesh Ammanaghatta Shivakumar, Jack Barnes, Gilles Barthe, Sunjay Cauligi, Chitchanok Chuengsatiansup, Daniel Genkin, Sioli O’Connell, Peter Schwabe, Rui Qi Sim, and Yuval Yarom. 2023. Spectre Declassified: Reading from the Right Place at the Wrong Time. In 2023 IEEE Symposium on Security and Privacy (SP). IEEE, 1753–1770. doi:10.1109/SP46215.2023.10179355DOI
  3. [3]Basavesh Ammanaghatta Shivakumar, Gilles Barthe, Benjamin Grégoire, Vincent Laporte, Tiago Oliveira, Swarn Priya, Peter Schwabe, and Lucas Tabary-Maujean. 2023. Typing High-Speed Cryptography against Spectre v1. In 2023 IEEE Symposium on Security and Privacy (SP). IEEE. doi:10.1109/SP46215.2023.10179418DOI
  4. [4]Arm. 2020. Cache Speculation Side-channels. https://developer.arm.com/-/media/Arm%20Developer%20Community/PDF/Security%20Update%2008%20June%202020/Cache_Speculation_Side-channels-v2.5.pdf Version 2.5.
  5. [5]Santiago Arranz Olmos, Gilles Barthe, Lionel Blatter, Benjamin Grégoire, and Vincent Laporte. 2025. Preservation of Speculative Constant-Time by Compilation. Proceedings of the ACM on Programming Languages 9, POPL, Article 44 (2025). doi:10.1145/3704880
  6. [6]Gilles Barthe, Sandrine Blazy, Benjamin Grégoire, Rémi Hutin, Vincent Laporte, David Pichardie, and Alix Trieu. 2020. Formal Verification of a Constant-Time Preserving C Compiler. Proceedings of the ACM on Programming Languages 4, POPL, Article 7 (2020), 30 pages. doi:10.1145/3371075DOI
  7. [7]Gilles Barthe, Sunjay Cauligi, Benjamin Grégoire, Adrien Koutsos, Kevin Liao, Tiago Oliveira, Swarn Priya, Tamara Rezk, and Peter Schwabe. 2021. High-Assurance Cryptography in the Spectre Era. In 2021 IEEE Symposium on Security and Privacy (SP). IEEE, 1884–1901. doi:10.1109/SP40001.2021.00046DOI
  8. [8]Jonathan Baumann, Roberto Blanco, Léon Ducrot, Sebastian Harwig, and Cătălin Hrițcu. 2025. FSLH: Flexible Mechanized Speculative Load Hardening. In 2025 IEEE 38th Computer Security Foundations Symposium (CSF). IEEE. https://arxiv.org/abs/2502.03203
  9. [9]Calvin Beck, Hanxi Chen, and Steve Zdancewic. 2025. Vellvm: Formalizing the Informal LLVM (Experience Report). In NASA Formal Methods. Springer, 91–99. doi:10.1007/978-3-031-93706-4_6DOI
  10. [10]Sunjay Cauligi, Craig Disselkoen, Klaus von Gleissenthall, Dean Tullsen, Deian Stefan, Tamara Rezk, and Gilles Barthe. 2020. Constant-Time Foundations for the New Spectre Era. In Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation. ACM, 913–926. doi:10.1145/3385412.3385970DOI
  11. [11]Marco Guarnieri, Boris Kopf, José Francisco Morales, Jan Reineke, and Andrés Sánchez. 2020. Spectector: Principled Detection of Speculative Information Flows. In 2020 IEEE Symposium on Security and Privacy (SP). IEEE. https://spectector.github.io/papers/spectector.pdfarxiv.org/abs/1812.08639
  12. [12]Marco Guarnieri, Boris Kopf, Jan Reineke, and Pepe Vila. 2021. Hardware-Software Contracts for Secure Speculation. In IEEE Symposium on Security and Privacy. doi:10.1109/SP40001.2021.00036DOI
  13. [13]Intel. 2026. Hardware Features and Behavior Related to Speculative Execution. https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/technical-documentation/hardware-behavior-related-to-speculative-execution.html
  14. [14]LLVM Project. [n. d.]. Speculative Load Hardening. LLVM documentation. https://llvm.org/docs/SpeculativeLoadHardening.html Accessed October 31, 2026.
  15. [15]Nicholas Mosier, Hamed Nemati, John C. Mitchell, and Caroline Trippel. 2024. Serberus: Protecting Cryptographic Code from Spectres at Compile-Time. In 2024 IEEE Symposium on Security and Privacy (SP). IEEE. doi:10.1109/SP54263.2024.00048DOI
  16. [16]Santiago Arranz Olmos, Gilles Barthe, Chitchanok Chuengsatiansup, Benjamin Grégoire, Vincent Laporte, Tiago Oliveira, Peter Schwabe, Yuval Yarom, and Zhiyuan Zhang. 2025. Protecting Cryptographic Code Against Spectre-RSB (and, in Fact, All Known Spectre Variants). In Proceedings of the 30th ACM International Conference on Architectural Support for Programming Languages and Operating Systems. 933–948. doi:10.1145/3676641.3676015
  17. [17]Marco Potlapally and Marco Guarnieri. 2021. Exorcising Spectres with Compilers. In Proceedings of the 2021 ACM SIGSAC Conference on Computer and Communications Security. ACM, 445–461. doi:10.1145/3460120.3484534
  18. [18]Sören van der Wall and Roland Meyer. 2025. SNIP: Speculative Execution and Non-Interference Preservation for Compiler Transformations. Proceedings of the ACM on Programming Languages 9, POPL, Article 51 (2025). doi:10.1145/3704887DOI
  19. [19]Marco Vassena, Craig Disselkoen, Klaus von Gleissenthall, Sunjay Cauligi, Rami Gökhan Kıcı, Ranit Ihaia, Dean Tullsen, and Deian Stefan. 2021. Automatically Eliminating Speculative Leaks from Cryptographic Code with Blade. Proceedings of the ACM on Programming Languages 5, POPL, Article 49 (2021), 30 pages. doi:10.1145/3434330
  20. [20]Yannick Zakowski, Calvin Beck, Irene Yoon, Ilia Zaichuk, Vadim Zaliva, and Steve Zdancewic. 2021. Modular, Compositional, and Executable Formal Semantics for LLVM IR. Proceedings of the ACM on Programming Languages 5, ICFP, Article 67 (2021), 30 pages. doi:10.1145/3473572DOI
  21. [21]Zhiyuan Zhang, Gilles Barthe, Chitchanok Chuengsatiansup, Peter Schwabe, and Yuval Yarom. 2023. Ultimate SLH: Taking Speculative Load Hardening to the Next Level. In 32nd USENIX Security Symposium (USENIX Security 23). USENIX Association, 7125–7142. https://www.usenix.org/conference/usenixsecurity23/presentation/zhang-zhiyuan-slh
  22. [22]Jianzhou Zhao. 2013. Formalizing an SSA-based Compiler for Verified Advanced Program Transformations. Ph. D. Dissertation. University of Pennsylvania.
  23. [23]Jianzhou Zhao, Saoston Nagarakatte, Milo M. K. Martin, and Steve Zdancewic. 2012. Formalizing the LLVM Intermediate Representation for Verified Program Transformations. In Proceedings of the 39th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. Association for Computing Machinery.
  24. [24]Yiming Zhu, Wenchao Huang, and Yan Xiong. 2025. Place Protections at the Right Place: Targeted Hardening for Cryptographic Code against Spectre v1. In 34th USENIX Security Symposium (USENIX Security 25). USENIX Association, 2557–2576. https://www.usenix.org/conference/usenixsecurity25/presentation/zhu-yimingarxiv.org/abs/2408.16220

Paper details

vlnc:W_cukfmssq
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents