Binary field multiplication on ARMv8

Hwajeong Seo, Zhe Liu, Yasuyuki Nogami, Jongseok Choi, Howon Kim

TL;DR

This paper presents a high-performance implementation of binary field multiplication tailored for the 64-bit ARMv8 architecture. By leveraging the new PMULL instruction and optimized multi-level Karatsuba multiplication, the authors achieved a 5.5x speedup over previous ARMv7 techniques, completing a 251-bit multiplication in just 57 clock cycles.

What Problem Does This Paper Address?

Binary field multiplication is a fundamental building block for modern digital security, powering everything from Elliptic Curve Cryptography (ECC) to authenticated encryption like AES-GCM. As mobile and embedded devices handle increasingly sensitive data, there is a constant demand for math operations that are both faster and more energy-efficient.

The transition from the 32-bit ARMv7 to the 64-bit ARMv8 architecture opened up new possibilities for hardware acceleration. However, simply porting old code doesn't work; the "sweet spot" for optimization changes when your hardware multiplier jumps from 8 bits to 64 bits. The authors set out to find the most efficient way to perform these large-scale multiplications on the new ARMv8 hardware.

Methods

The authors introduce what they call the Karatsuba/NEON/PMULL (KNP) multiplier. Their approach combines three key elements:

  1. Hardware Acceleration: They utilize the ARMv8 PMULL (Polynomial Multiply Long) instruction. Unlike standard integer multiplication, this performs "carry-less" multiplication, which is exactly what's needed for binary fields. While ARMv7 had an 8-bit version, ARMv8 supports a full 64-bit multiplication in a single instruction.
  2. Algorithmic Optimization: They employ Karatsuba’s algorithm, a "divide and conquer" strategy that reduces the number of expensive multiplications required for large numbers at the cost of some extra additions (XORs in binary fields).
  3. Strategic Thresholding: A key contribution is determining when to use Karatsuba. They found that for 128-bit and 192-bit operands, "ordinary" multiplication is actually faster because the overhead of managing Karatsuba's extra logic instructions outweighs the savings. For 256-bit and larger operands, Karatsuba becomes the clear winner.
  4. Register Optimization: They carefully mapped their algorithms to the 32 available 128-bit NEON registers to keep intermediate results "on-chip," minimizing slow memory access.

Datasets

The researchers evaluated their implementation using:

  • Hardware: An iPad Mini 2 featuring the Apple A7 processor (the first 64-bit ARMv8 mobile chip) clocked at 1.3GHz.
  • Benchmarks: They targeted the NIST-recommended binary curve B-251 ($F_{2^{251}}$) and tested various polynomial lengths including 192, 256, 384, and 512 bits to demonstrate scalability.

Key Insights and Ideas

  • The 64-bit Shift: The jump to 64-bit hardware multipliers fundamentally changes optimization logic. Techniques that were state-of-the-art on ARMv7 (like the KNV method) are rendered obsolete by the efficiency of the 64-bit PMULL.
  • Karatsuba isn't always better: In a world of fast hardware multipliers, the "cost" of the extra XOR and shift operations needed for Karatsuba is significant. The paper identifies a clear crossover point where the algorithmic complexity finally pays off.
  • Instruction Parallelism: By using the NEON SIMD (Single Instruction, Multiple Data) engine, the authors could process multiple parts of the multiplication simultaneously, maximizing the throughput of the A7 processor.

Key Results

  • 5.5x Speedup: The proposed KNP method is over five times faster than the best previous techniques reported for ARMv7.
  • Extreme Efficiency: A full binary field multiplication for the B-251 curve (essential for ECC) takes only 57 clock cycles.
  • Performance Scaling:
  • 192-bit: 11 cycles
    • 256-bit: 21 cycles
    • 384-bit: 49 cycles
    • 512-bit: 75 cycles

Limitations and Future Work

  • Component vs. System: The paper focuses specifically on the multiplication and reduction steps. While these are the most computationally expensive parts, a full ECC system requires other operations like point addition and doubling.
  • Early Benchmarking: At the time of publication, this was one of the first implementations for ARMv8, meaning there were few direct competitors on the same architecture to compare against.
  • Next Steps: The authors intend to integrate these high-speed multipliers into a complete, optimized ECC library for ARMv8 devices, potentially setting a new standard for mobile cryptographic performance.

Summary updated

BibTeX
@inproceedings{seo2016binary,
  author = {Hwajeong Seo and Zhe Liu and Yasuyuki Nogami and Jongseok Choi and Howon Kim},
  title = {{Binary field multiplication on ARMv8}},
  booktitle = {Secur. Commun. Networks},
  year = {2016},
  url = {https://openreview.net/forum?id=05ykvWbw36},
}
Figure