TL;DR
This paper challenges the conventional wisdom in cryptography that projective coordinates are always superior for pairing-based protocols. By optimizing field inversion on ARM and x86 architectures, the researchers demonstrate that affine coordinates actually provide a 10-20% performance boost, delivering high-speed cryptographic pairings suitable for modern mobile and embedded devices.
What Problem Does This Paper Address?
Bilinear pairings are the "secret sauce" behind advanced cryptographic features like identity-based encryption, attribute-based encryption, and short digital signatures. However, pairings are computationally expensive.
On resource-constrained ARM processors (found in almost all smartphones), efficiency is critical. Traditionally, developers avoid affine coordinates because they require "inversion" (modular division), which is historically much slower than multiplication. To dodge this, most implementations use projective coordinates, which replace inversions with a larger number of multiplications.
The authors ask: If we can make inversion fast enough, does the "multiplication tax" of projective coordinates still make sense? They specifically target Barreto-Naehrig (BN) curves, which are the gold standard for achieving 128-bit security and beyond.
Methods
The researchers implemented the optimal ate pairing on three platforms: ARM (Cortex A9), x86, and x86-64. Their approach combined high-level algorithmic choices with low-level hardware "hacks":
- Fast Inversion: They used a "norm map" technique to perform inversions in high-degree extension fields by reducing them to simpler inversions in smaller base fields.
- Montgomery Multiplication: They optimized the core multiplication routine using platform-specific assembly and intrinsics. On ARM, they leveraged specific 32-bit instructions (
umull,umaal,umlal) to handle 64-bit products and accumulations efficiently. - Tower of Extensions: They organized the complex field math (up to $F_{p^{12}}$) into a "tower" ($F_p \to F_{p^2} \to F_{p^6} \to F_{p^{12}}$), which allows for more efficient recursive operations.
- Algorithm 1 (Miller’s Algorithm): They utilized a version of Miller’s algorithm that exploits the sparse Non-Adjacent Form (NAF) of the loop scalar to minimize operations.
Datasets
As a performance-focused paper, the "datasets" are the specific elliptic curves and hardware used for benchmarking:
- Curves: Four Barreto-Naehrig (BN) curves providing different security levels: bn254 (128-bit security), bn256, bn446, and bn638 (~192-bit security).
- Hardware:
- ARM: Nvidia Tegra 2 (Dual-core Cortex A9 @ 1GHz).
- x86/x86-64: Intel Core2 E6600 @ 2.4GHz.
Key Insights and Ideas
- The I/M Ratio is King: The choice between affine and projective coordinates depends entirely on the Inversion-to-Multiplication (I/M) cost ratio. The authors found that on ARM, the I/M ratio is significantly lower (approx. 10.7) than on x86-64 (approx. 25). This lower ratio strongly favors affine coordinates.
- The Cross-over Point: As security requirements (and thus field sizes) grow, the relative cost of inversion drops compared to the massive number of multiplications required by projective math. They found the "cross-over point" where affine becomes faster happens very early—at the $F_{p^2}$ level.
- Final Exponentiation Bottleneck: A surprising amount of time—between 48% and 63% of the total pairing computation—is spent on the "final exponentiation" step. This suggests that future optimization efforts should focus here rather than just on the Miller loop.
Key Results
- Affine Wins: Across all platforms and all security levels, affine pairings outperformed projective ones. At 192-bit security (bn638), the affine version was roughly 20% faster than the projective version.
- ARM Performance: On a 1GHz Cortex A9, a single 128-bit security pairing (bn254) takes 51 milliseconds. While x86-64 is about 10x faster in raw time, the authors note that after adjusting for clock speed and architecture (SSE2 instructions), the ARM implementation is highly competitive.
- Batching Benefits: Using "Montgomery’s inversion-sharing trick" to compute 20 pairings at once reduced the average time per pairing on ARM from 51ms to roughly 17ms (when computing a product of pairings).
Limitations and Future Work
- SIMD/NEON: The current implementation uses the core ARM instruction set but does not yet utilize NEON (SIMD) instructions, which could provide significant additional speedups for parallel field operations.
- Cycle Counts: The authors could not provide precise CPU cycle counts for the ARM platform due to limitations in their development environment (Windows on Tegra 2), relying instead on microsecond timings.
- Generality vs. Optimization: The authors prioritized "product-quality," general-purpose code over "hand-optimized" assembly for one specific curve. They acknowledge that further manual tuning for specific architectures could yield even faster results.
Summary updated