Speed up over the Rainbow

Nir Drucker, Shay Gueron

This paper, authored by Nir Drucker and Shay Gueron, presents a significant performance optimization for Rainbow, a leading candidate in the NIST Post-Quantum Cryptography (PQC) standardization project. By leveraging specialized hardware instructions found in modern Intel processors, the authors demonstrate how to drastically reduce the computational overhead of this signature scheme.

TL;DR

The authors optimize the Rainbow post-quantum signature scheme by utilizing Intel’s Galois Field New Instructions (GF-NI) and AVX512 architecture. By strategically switching between finite field representations, they achieve speedups of up to 4.7x for signing and 2.4x for key generation, making Rainbow a much more competitive candidate for a post-quantum world.

What Problem Does This Paper Address?

As the era of large-scale quantum computing approaches, traditional public-key cryptography (like RSA and ECC) faces an existential threat. NIST is currently in the process of selecting "quantum-resistant" algorithms to replace them. One such candidate is Rainbow, a signature scheme based on the complexity of solving multivariate quadratic equations.

While Rainbow offers small signature sizes and relatively fast operations, its performance relies heavily on arithmetic in the finite field $GF(2^8)$. Existing implementations use software-based tricks (like AVX2 shuffle instructions) to perform this arithmetic in constant time. However, these methods still leave a performance gap on the table, especially as new hardware features emerge. The authors set out to bridge this gap by using dedicated hardware acceleration for Galois Field operations.

Methods

The researchers focused on the IIIc-Classic variant of Rainbow and implemented several optimizations:

  1. Hardware Acceleration (GF-NI): They utilized new instructions available on Intel "Ice Lake" processors, specifically VGF2P8MULB (vectorized multiplication), VGF2P8AFFINEQB (affine transformation), and VGF2P8AFFINEINVQB (inverse affine transformation).
  2. Field Representation Swap: Rainbow typically uses a "tower field" representation ($F_{Tower}$) for ease of software implementation. However, the GF-NI instructions are designed for the "AES field" representation ($F_{AES}$). The authors developed efficient 8x8 bit-matrix transformations to convert elements between these two representations.
  3. AVX512 Masking: Rainbow’s computations often involve 72-byte rows. Since AVX512 registers are 64 bytes wide, the authors used AVX512 masking to handle the "remainder" of these rows efficiently without needing extra buffers.
  4. Manual Pipelining: They found that while compilers can automatically unroll loops, hand-written assembly-level pipelining provided superior performance by better utilizing the processor's execution units.

Datasets

As a performance optimization paper in cryptography, the "dataset" consists of the official NIST Round-2 Rainbow submission code. The authors used the "Alternative" implementation (which already uses AVX2) as their baseline for comparison. Performance was measured in CPU cycles on an Intel Core i7-1065G7 (Ice Lake) processor.

Key Insights and Ideas

  • Mathematical Isomorphism as a Tool: The authors highlight that because all representations of $GF(2^8)$ are isomorphic, the choice of representation is purely an implementation detail. We can choose the representation that best fits the hardware without compromising security.
  • Hardware-Field Alignment: The "aha moment" is realizing that the overhead of converting between $F_{Tower}$ and $F_{AES}$ is negligible compared to the massive speedup gained by using hardware-native $F_{AES}$ instructions.
  • Inversion via Affine Instructions: A clever trick used is performing field inversion during the signing process using the AFFINEINVB instruction, which is significantly faster than traditional software-based inversion methods.
  • The Limits of Compilers: The results show that for cutting-edge SIMD (Single Instruction, Multiple Data) optimizations, human intuition in pipelining still outperforms standard compiler optimizations (like -funroll-loops).

Key Results

The authors compared their optimized versions (Impl1 through Impl4) against the original NIST baseline. The most optimized version (Impl4) yielded the following results:

  • Signing: Achieved a 4.7x speedup (reducing cycles from ~699k to ~143k).
  • Key Generation: Achieved a 2.44x speedup (reducing cycles from ~102M to ~41.8M).
  • Verification: Achieved a 2.13x speedup (reducing cycles from ~106k to ~50k).

Interestingly, they noted that if the public key is stored in the $F_{Tower}$ format, verification actually slows down due to conversion costs. However, by simply storing the public key in the $F_{AES}$ format, this bottleneck is eliminated.

Limitations and Future Work

  • Hardware Dependency: The primary limitation is that these speedups are currently specific to Intel's Ice Lake architecture and newer CPUs that support GF-NI. Older hardware or different architectures (like ARM) would not see these specific benefits.
  • Standardization Changes: The authors recommend that the Rainbow team consider adopting the $F_{AES}$ representation as part of the official Round-3 modifications to make the scheme natively faster on modern hardware.
  • Server-Side Performance: The tests were conducted on a laptop processor. The authors expect even more dramatic results on server-grade CPUs with higher throughput for AVX512 instructions.

Summary updated

BibTeX
@article{drucker2020speed,
  author = {Nir Drucker and Shay Gueron},
  title = {{Speed up over the Rainbow}},
  journal = {IACR Cryptol. ePrint Arch.},
  year = {2020},
  url = {https://openreview.net/forum?id=7vd3hHcShu},
}
Figure