Quantitative Verification of Masked Arithmetic Programs Against Side-Channel Attacks

Pengfei Gao, Hongyi Xie, Jun Zhang, Fu Song, Taolue Chen

Abstract

Side-channel attacks (SCA) pose a significant threat to cryptographic implementations by exploiting physical leakages such as power consumption. Masking is a primary countermeasure, yet verifying its correctness—especially for complex arithmetic operations—remains computationally expensive. This paper presents QMVerif, a hybrid verification tool that integrates lightweight type inference with rigorous model-counting. By utilizing a "fast-to-slow" hierarchy and a novel brute-force approach for finite field arithmetic, QMVerif achieves significant speedups over existing tools and provides a Quantitative Masking Strength (QMS) metric to measure information leakage precisely.

Introduction

Cryptographic security is often undermined not by mathematical flaws in algorithms, but by physical vulnerabilities in their implementation. Side-channel attacks allow adversaries to deduce secret keys by observing physical observables like electromagnetic radiation or power usage. Masking defenses mitigate this by splitting secrets into multiple random shares, ensuring that no single intermediate value correlates with the secret.

However, designing secure masking schemes is notoriously difficult, particularly for non-linear arithmetic operations found in AES S-boxes or SHA-3. Existing verification tools typically face a trade-off: type-based systems are fast but often produce false positives (incompleteness), while model-counting or SMT-based systems are precise but fail to scale with the complex math of arithmetic programs. QMVerif is designed to bridge this gap, providing a tool that is both mathematically complete and computationally efficient for arithmetic-heavy code.

The QMVerif Framework

QMVerif employs a multi-stage hybrid framework to verify programs against first-order side-channel attacks. The workflow is structured to resolve easy cases quickly before committing to intensive computation:

  1. Type Inference: The tool first applies a custom type system to categorize variables (e.g., Uniformly Distributed, Statistically Independent). If a variable can be proven "perfectly masked" at this stage, it is cleared immediately.
  2. Reduction Heuristics: To minimize the problem size, QMVerif applies algebraic laws (such as $x \oplus x = 0$) and "dominated subexpression elimination" to simplify the program logic.
  3. Model-Counting and Brute-Force: For variables labeled as "Unknown" by the type system, the tool employs model-counting. Interestingly, the authors found that for 8-bit finite field multiplication, a specialized brute-force enumeration often outperformed standard SMT solvers like Z3, which frequently timed out on complex arithmetic structures.
  4. Quantitative Analysis: Unlike binary "secure/insecure" tools, QMVerif calculates the Quantitative Masking Strength (QMS). This metric quantifies the exact amount of information leaked, which correlates directly to the number of power traces an attacker would require to extract a key.

Experimental Evaluation

The authors evaluated QMVerif against two primary benchmarks: Boolean programs from the MAC-Keccak reference code and a suite of non-linear arithmetic components, including secure multiplication (SecMult), S-boxes, and Boolean-to-Arithmetic (B2A) conversions.

Performance and Scalability

In comparisons with the previous state-of-the-art tool, SCInfer, QMVerif demonstrated a speed increase of 16 to 69 times on Boolean benchmarks. More importantly, QMVerif successfully verified complex arithmetic fragments (such as exponentiation $k^{254}$) that caused existing SMT-based tools to crash or run indefinitely.

Precision

While previous quantitative tools relied on approximations of leakage, QMVerif utilizes a binary search approach on model-counting to determine the exact QMS value. This precision allows developers to make informed trade-offs between performance and security, identifying whether a minor leak is acceptable in a specific deployment context.

Discussion and Limitations

A key insight from this research is the efficacy of the hybrid approach. By using a type system to filter out simple cases, the tool preserves its heavy computational resources for truly ambiguous code segments. Furthermore, the discovery that brute-force enumeration can outperform SMT solvers for specific cryptographic bit-widths (8-bit) challenges the standard reliance on general-purpose solvers for all formal verification tasks.

Despite these successes, QMVerif is currently limited to first-order attacks, where an attacker observes only one variable at a time. Extending this framework to higher-order attacks—where multiple variables are observed simultaneously—remains a significant challenge. Additionally, the tool is currently optimized for "straight-line" code, and future iterations will need to address more complex program structures involving loops and branching.

Conclusion

QMVerif represents a significant step forward in the automated verification of cryptographic software. By combining the speed of type inference with the precision of model-counting and the predictability of brute-force enumeration, it provides a scalable solution for securing arithmetic-heavy programs against side-channel vulnerabilities.

Summary updated

BibTeX
@inproceedings{gao2019quantitative,
  author = {Pengfei Gao and Hongyi Xie and Jun Zhang and Fu Song and Taolue Chen},
  title = {{Quantitative Verification of Masked Arithmetic Programs Against Side-Channel Attacks}},
  booktitle = {TACAS},
  year = {2019},
  doi = {10.1007/978-3-030-17462-0\_9},
}
Figure