A Hybrid Approach to Formal Verification of Higher-Order Masked Arithmetic Programs

Pengfei Gao, Hongyi Xie, Fu Song, Taolue Chen

Abstract

Formal verification of higher-order masking in arithmetic programs is a critical yet computationally intensive task. This paper introduces HOME (Higher-Order Masking vErifier), a hybrid framework that integrates a sound type system with GPU-accelerated model counting. By leveraging automated CUDA kernel synthesis and structural pattern matching, HOME addresses the scalability issues inherent in traditional bit-blasting techniques. Experimental results demonstrate up to a 110x speedup over state-of-the-art tools, enabling the verification of 5th-order masked Sboxes for the first time.

Introduction

In the field of cryptography, even mathematically secure algorithms can be compromised by side-channel attacks (SCAs). These attacks exploit physical signals, such as power consumption or electromagnetic radiation, to leak secret keys. Masking—a technique that splits secret data into multiple random "shares"—is the standard defense against SCAs. However, implementing masking correctly is notoriously difficult, particularly as the "order" of masking increases to defend against more sophisticated adversaries.

The Challenge of Arithmetic Masking

While Boolean masking (using XOR operations) is well-understood, arithmetic masking (involving addition, multiplication, and finite-field operations) presents significant verification challenges. Existing tools often rely on "bit-blasting," which converts arithmetic programs into Boolean ones. This process leads to a massive explosion in variables, causing verification performance to degrade rapidly. Researchers have historically faced a trade-off between fast but imprecise type systems, which yield many false alarms, and accurate but prohibitively slow model counters.

The HOME Framework

To overcome these limitations, the authors propose HOME, a multi-stage hybrid framework designed to provide both speed and precision. The architecture of HOME is designed to filter out simple cases quickly while reserving heavy computational resources for the most complex parts of the program.

Overview of the HOME framework architecture.

As illustrated in Figure 1, the HOME workflow consists of several key components:

  1. Pre-processor: Converts the masked program into Static Single Assignment (SSA) form.
  2. Sound Type System: This stage utilizes the concept of "dominant variables"—random variables that ensure secret data remains statistically independent of observable signals. This step rapidly clears the majority of the program's operations.
  3. Pattern Matching: The framework identifies structural similarities (isomorphisms) between code blocks. If a block is structurally identical to one previously verified, the result is reused, significantly reducing redundant computations.
  4. GPU-Accelerated Model Counting: For cases the type system cannot resolve, HOME employs model counting. The breakthrough here is automated CUDA kernel synthesis, where HOME generates custom GPU programs tailored to specific mathematical expressions. This allows for massive parallelization of the search for potential leaks.

Experimental Evaluation

HOME was evaluated against a wide range of cryptographic benchmarks, including standard ciphers like AES and MAC-Keccak, lightweight ciphers such as Simon, and complex masking conversions (A2B and B2A). The evaluation specifically targeted high-order Sboxes (4th and 5th order), which are traditionally the most difficult components to verify.

Key Results

  • Performance Gains: HOME achieved a 110x speedup on the AES Key Schedule and a 31x speedup on 4th-order Sboxes compared to the previous state-of-the-art BBDFGS algorithm.
  • Extended Capabilities: The framework successfully verified a 5th-order Sbox, a task that was previously computationally infeasible for existing tools.
  • Precision and Accuracy: HOME effectively resolved spurious leaks. In one benchmark, it identified 98,176 potential leaks in a 4th-order Sbox as genuine in just 4 minutes, demonstrating its ability to provide definitive proofs where other tools might only report potential vulnerabilities.

Conclusion and Future Work

HOME represents a significant advancement in the formal verification of masked programs by treating arithmetic operations as first-class citizens and leveraging GPU parallelism. While currently optimized for straight-line code, future work aims to extend these techniques to handle programs with dynamic control flow, hardware glitches, and stronger leakage models such as d-Strong Non-Interference (d-SNI).

Summary updated

BibTeX
@article{gao2021hybrid,
  author = {Pengfei Gao and Hongyi Xie and Fu Song and Taolue Chen},
  title = {{A Hybrid Approach to Formal Verification of Higher-Order Masked Arithmetic Programs}},
  journal = {ACM Trans. Softw. Eng. Methodol.},
  year = {2021},
  doi = {10.1145/3428015},
}
Figure