Abstract
Elliptic curve cryptosystems (ECCs) are becoming more popular because of the reduced number of key bits required in comparison to other cryptosystems (for example, a 160 bit ECC has roughly the same security as 1024 bit RSA). ECCs are especially suited to smart cards because of the limited memory and computational power available on these devices. This paper discusses an optimized implementation of the elliptic curve Digital Signature Algorithm implemented over the field $GF(p)$ on a Motorola smart card. Algorithms for point addition, point doubling and scalar multiplication are compared according to their timings. The effects of different memory usage, code size and speed tradeoffs which were considered during the implementation are discussed. Also, optimized point addition and doubling algorithms are presented.
1. Introduction
Smart cards represent the ultimate "constrained environment" for cryptographic applications, typically featuring minimal RAM (often just a few kilobytes), restricted storage, and modest processing capabilities. While traditional public-key infrastructures like RSA have long been the standard, they require increasingly large keys (1024 bits or more) to maintain security, which places significant strain on these devices.
Elliptic Curve Cryptography (ECC) offers a compelling alternative, providing equivalent security levels with much smaller key sizes—for instance, a 160-bit ECC key offers security comparable to a 1024-bit RSA key. However, the mathematical complexity of ECC, particularly modular inversion, presents implementation challenges. This paper details an optimized implementation of the Elliptic Curve Digital Signature Algorithm (ECDSA) over prime fields ($GF(p)$) on a Motorola M-Smart Jupiter card, balancing performance, code size, and memory constraints.
2. Optimized Field Arithmetic
The implementation leverages a hardware modular arithmetic accelerator for multiplication and reduction. A key finding was that "special" primes, such as NIST or pseudo-Mersenne primes—which are typically used to accelerate software-only implementations—offered no performance advantage in this hardware-assisted environment. In fact, the software overhead required to handle these specific primes made them slower than general modular multiplication performed directly by the coprocessor.
For modular inversion, the authors opted for the exponentiation method based on Fermat’s Little Theorem ($a^{p-2} \pmod p$) rather than the Binary Extended GCD algorithm. Since the hardware already supported efficient modular exponentiation, this approach significantly reduced code size without compromising execution speed.
3. Coordinate Systems and Point Operations
To minimize the need for computationally expensive modular inversions, the study explored various coordinate systems, including Affine, Projective, Jacobian, and their variants. The authors concluded that using mixed coordinates provided the highest efficiency. By storing the base point in Affine coordinates while performing intermediate calculations in Jacobian variants (specifically Mixed Jacobian/Modified Jacobian), the implementation successfully eliminated modular inversions from the main scalar multiplication loop.
4. Scalar Multiplication and Verification
The core of the ECDSA implementation utilizes the Binary Method with Non-Adjacent Form (NAF) representation for scalars. By representing the scalar using digits $\{0, 1, -1\}$, the number of required point additions is reduced by approximately 10% compared to standard binary representations.
For ECDSA verification, which involves calculating $k_1P + k_2Q$, the authors implemented a "two-in-one" simultaneous multiplication algorithm. This approach is significantly more efficient than performing two independent scalar multiplications and then adding the results.
5. Performance Evaluation
The implementation was evaluated on a Motorola M-Smart Jupiter smart card (ARM-based, 32-bit, 3KB RAM) and validated against the MIRACL library on a Pentium III platform.
Key Results:
- ECC vs. RSA: A 160-bit ECDSA signature was substantially faster than a 1024-bit RSA signature; the RSA operation required approximately 236% of the time taken by the ECC operation.
- Verification Efficiency: While RSA verification is typically faster due to small public exponents, the optimized ECC "two-in-one" verification was highly competitive, requiring only 1.2x the time of an ECC signature.
- Resource Footprint: The entire implementation was optimized to fit within a 5KB to 6KB code space. To address the RAM bottleneck, the authors provided optimized versions of standard algorithms (detailed in Appendix B) specifically rewritten to overwrite input variables and use the absolute minimum number of registers.
6. Conclusion
The research demonstrates that through strategic selection of coordinate systems and the effective use of hardware accelerators, ECC can be implemented highly efficiently on resource-constrained smart cards. While challenges remain—such as the complexity of point uncompression when $p \equiv 1 \pmod 4$ and the need for side-channel resistance—the 160-bit ECDSA implementation provides a robust and performant alternative to traditional RSA-based systems.
Summary updated