Abstract
In the field of cryptography, conventional wisdom holds that projective coordinates are inherently superior to affine coordinates for pairing-based protocols. This preference stems from the high computational cost of modular inversion, which projective math seeks to avoid by substituting it with a larger number of multiplications. This paper challenges this orthodoxy by presenting optimized field inversion techniques for ARM and x86 architectures. By achieving a significantly lower Inversion-to-Multiplication (I/M) ratio, the researchers demonstrate that affine coordinates can provide a 10-20% performance boost for high-speed cryptographic pairings on modern mobile and embedded devices.
Introduction: The Role of Bilinear Pairings
Bilinear pairings serve as the foundational "secret sauce" for advanced cryptographic primitives, including identity-based encryption (IBE), attribute-based encryption (ABE), and compact digital signatures. Despite their versatility, pairings are computationally intensive, making their efficiency a critical concern for resource-constrained environments like ARM-based smartphones and IoT devices.
Historically, implementers have favored projective coordinates to bypass the "inversion tax"—the significant time required for modular division. However, this paper investigates whether modern optimization techniques can make inversion fast enough to render the "multiplication tax" of projective coordinates obsolete, particularly for Barreto-Naehrig (BN) curves, the industry standard for 128-bit security.
Implementation Methodology
The research focuses on implementing the optimal ate pairing across three primary platforms: ARM (Cortex A9), x86, and x86-64. The authors employed a multi-layered optimization strategy:
- Fast Inversion via Norm Maps: Inversions in high-degree extension fields were reduced to simpler inversions in smaller base fields using a "norm map" technique.
- Hardware-Specific Assembly: Core multiplication routines were optimized using platform-specific instructions. On ARM, the implementation leveraged 32-bit instructions such as
umull,umaal, andumlalto efficiently manage 64-bit products and accumulations. - Tower of Extensions: Field arithmetic was organized into a recursive "tower" ($F_p \to F_{p^2} \to F_{p^6} \to F_{p^{12}}$), streamlining complex operations.
- Optimized Miller’s Algorithm: The implementation utilized a version of Miller’s algorithm that exploits the sparse Non-Adjacent Form (NAF) of loop scalars to minimize the total operation count.
Benchmarking and Results
The performance of these optimizations was evaluated using four BN curves (bn254, bn256, bn446, and bn638) across different hardware configurations.
The Critical I/M Ratio
The viability of affine coordinates is primarily determined by the Inversion-to-Multiplication (I/M) cost ratio. As shown in the benchmarking data, ARM architectures exhibit a significantly lower I/M ratio compared to x86-64.
On the ARM Cortex A9, the I/M ratio for the base field $\mathbb{F}_p$ is approximately 10.67. In contrast, the x86-64 architecture shows a ratio of 25.00. This lower relative cost of inversion on ARM creates a strong performance incentive for using affine coordinates.
Performance Gains and Batching
The experimental results confirm that affine pairings consistently outperform projective ones across all tested security levels and platforms. For the bn254 curve at 128-bit security, a single pairing on a 1GHz ARM processor takes approximately 51 milliseconds using affine coordinates, compared to over 55 milliseconds for projective coordinates.
The benefits of affine math become even more pronounced when security requirements increase. At the 192-bit security level (bn638), the affine implementation was roughly 20% faster than its projective counterpart. Furthermore, the researchers utilized "Montgomery’s inversion-sharing trick" to batch pairing computations. By computing 20 pairings simultaneously, the average time per pairing on ARM was reduced from 51ms to just 17ms for product-of-pairings operations.
Conclusion
This research demonstrates that the traditional avoidance of affine coordinates in pairing-based cryptography is no longer justified on modern hardware. By optimizing the underlying field arithmetic, specifically inversion, affine coordinates emerge as the faster choice for both ARM and x86 platforms.
Future work may further enhance these results by utilizing NEON (SIMD) instructions on ARM for parallel field operations. Additionally, the discovery that the "final exponentiation" step accounts for up to 63% of total computation time suggests a new focal point for cryptographic optimization efforts.
Summary updated