Compilation Techniques for Efficient Encrypted Computation

Christopher W. Fletcher, Marten van Dijk, Srinivas DevadasIACR ePrint 2012

Abstract

Fully Homomorphic Encryption (FHE) allows for computation on encrypted data but faces significant performance hurdles with general-purpose programs containing complex control flows. This paper presents a compiler-driven approach utilizing path levelization and conditional fixed-point computation to mitigate computational overhead and noise growth. By transforming high-level programs into optimized structures, the authors demonstrate efficient execution of algorithms like GCD and 3SAT under FHE.

Introduction

Fully Homomorphic Encryption (FHE) is often considered the "holy grail" of cryptography, enabling servers to process data without ever decrypting it. However, FHE is primarily optimized for static Boolean circuits. Real-world software relies on complex control flows, such as data-dependent loops and recursive calls. In an encrypted environment, a server cannot determine which branch of a conditional statement to execute or when a loop should terminate. Consequently, the server must execute every possible path, leading to extreme inefficiencies and the accumulation of mathematical "noise" that eventually corrupts the ciphertext.

Proposed Compilation Techniques

To address these challenges, the authors propose several transformation techniques that adapt general-purpose code for FHE:

Path Levelization

The compiler organizes a program's basic blocks into discrete "levels" based on their topological distance from the entry point. This structure ensures that at any execution step, the server only evaluates a small subset of potential blocks. This significantly reduces "Program Counter (PC) ambiguity," preventing the exponential explosion of paths typically seen in naive FHE implementations.

Path levelization applied to the GCD algorithm, organizing basic blocks into levels to reduce PC ambiguity.

Conditional Fixed-Point Computation

For loops with secret exit conditions, the compiler transforms them into fixed-point iterations. The loop executes for a predetermined, public number of steps ($I$) using an encrypted "done" flag. Once the termination condition is met, the system ensures that subsequent "dummy" iterations do not alter the final state.

Hierarchical Phases

Complex programs are decomposed into a hierarchy of phases, where each phase represents a fixed-point computation. This modular approach allows the system to handle nested loops and sophisticated program structures efficiently.

Hierarchical phases allow the system to handle nested loops and modular code by decomposing complex programs.

Decoupled Call Stacks

To support recursion, the authors decouple the call stack from the operations within each frame. This allows recursive logic to be flattened into a predictable sequence of state updates, making it compatible with FHE's circuit-based nature.

Evaluation and Key Results

The techniques were evaluated using two primary benchmarks: the Greatest Common Divisor (GCD) via Euclid’s algorithm and 3-Satisfiability (3SAT) via recursive backtracking.

  • Efficiency Gains: In the GCD benchmark, the levelized approach required evaluating only 6 basic blocks per iteration, a significant improvement over the 15 blocks required by a naive implementation.
  • Noise Management: Levelization drastically reduced the number of multiplications needed for the encrypted Program Counter. In the GCD loop, multiplications dropped from 6 per iteration to just 1 or 2, which is vital for maintaining ciphertext integrity.
  • Dominator Optimization: The authors utilized "dominator" blocks—nodes that every path must pass through—to reset the encrypted PC to a known constant. This acts as an "implicit refresh," clearing noise without the high cost of standard cryptographic bootstrapping.

Conclusion

This work demonstrates that even NP-complete problems like 3SAT can be structured for efficient execution under FHE. While current transformations require some manual effort, they provide a roadmap for future optimizing compilers. By focusing on path levelization and hierarchical phases, the overhead of encrypted computation can be brought within practical limits for complex, general-purpose algorithms.

Summary updated

BibTeX
@article{fletcher2012compilation,
  author = {Christopher W. Fletcher and Marten van Dijk and Srinivas Devadas},
  title = {{Compilation Techniques for Efficient Encrypted Computation}},
  journal = {IACR Cryptol. ePrint Arch.},
  year = {2012},
}
Figure