# Fast Implementation of NIST P-256 Elliptic Curve Cryptography on 8-Bit AVR Processor
## 3 Range Shifted Representation for Modular Multiplication
### Modular Multiplication on RSR
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Implementation** & **Curve** & **SPA Resistance** & **Clock Cycles** & **Code Size (bytes)** \\ \hline [PERSON] et al.[2] & NIST P-192 & No & 21.38 & 19,000 \({}^{a}\) \\ [PERSON] et al. [3] & NIST P-192 & Yes & 8.62 & 26,000 \({}^{a}\) \\ [PERSON] et al. [1] & NIST P-224 & No & 17.52 & 4812 \\ [PERSON] et al. [27] & NIST P-256 & Yes & 34.93 & 16,112 \\ [PERSON] et al. [6] & NIST P-256 & Yes & 25.38 & 13,980 \\ This paper & NIST P-256 & Yes & 20.98 & 17,776 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: A comparison of various implementations of scalar multiplication over NIST curves on ATmega128 processor in \(10^{6}\) clock cycles

## 7 Conclusions

In this paper, we introduce the fast ECC implementation over NIST P-256 curve on an 8-bit AVR ATmega128 processor. We focus on applying RSR to all of the field operations in order to improve the performance of ECC. Firstly, we propose 256-bit modular multiplication over \(\mathbb{F}_{P_{256}\cdot W^{-16}}\), while taking advantage of the optimization technique in [8]. Secondly, we propose a new modular squaring over NIST P-256 prime. This modular squaring achieves the speed record providing about 24% of improved performance when compared with the state-of-the-art. Besides, we also propose an efficient masking method for modular addition, which ensures constant execution time. Finally, we evaluate the impact of RSR-optimized field operations on the performance of scalar multiplication. When compared to the state-of-the-art, our ECC implementation achieves the best performance of scalar multiplication over NIST P-256 curve with 17.3% improvement. We focus on eliminating the conditional statements that SPA attack usually exploits in order to resist against SPA attack. Our implementation does not use any conditional statements throughout all field and group operations. Especially, we implement constant modular addition and regular scalar multiplication to prevent SPA attacks. Our optimized scheduling can be similarly applied to modular multiplication and squaring over other NIST primes. In the future, we will implement ECC over other NIST curves, such as P-384 and P-512. Conceptualization, S.H. ; Formal analysis, N.S.C. ; Project administration, D.-w.P. ; Software, S.L. ; Writing--original draft, D.-w.P. ; Writing--review & editing, S.L. All authors have read and agreed to the published version of the manuscript. This work was supported by the National Research Foundation of Korea (NRF) grant funded by the Korea government (MSIT) (No. NRF-2020R1A2C1011769). The authors declare no conflict of interest. ## References

* [PERSON] et al. (2004) [PERSON]; [PERSON]; [PERSON]; [PERSON]; [PERSON] Comparing elliptic curve cryptography and RSA on 8-bit CPUs. In _Lecture Notes in Computer Science, Proceedings of the Cryptographic Hardware and Embedded Systems, Cambridge, MA, USA, 11-13 August 2004_; Springer: Berlin/Heidelberg, Germany, 2004; Volume 3156, pp. 119-132. * [PERSON] and [PERSON] (2008) [PERSON]; [PERSON] TinyECC: A configurable library for elliptic curve cryptography in wireless sensor networks. In Proceedings of the 2008 International Conference on Information Processing in Sensor Networks (IPSN 2008), St. Louis, MO, USA, 22-24 April 2008; pp. 245-256. * [PERSON] et al. (2016) [PERSON]; [PERSON]; [PERSON]; [PERSON] Efficient Implementation of NIST-Compliant Elliptic Curve Cryptography for 8-bit AVR-Based Sensor Nodes. _IEEE Trans. Inf. Forensics Secur._**2016**, _11_, 1385-1397. [CrossRef]
* [PERSON] and [PERSON] (2018) [PERSON]; [PERSON] Highly Efficient Implementation of NIST-Compliant Koblitz Curve for 8-bit AVR-Based Sensor Nodes. _IEEE Access_**2018**, \(6\), 67637-67652. [CrossRef]
* [PERSON] et al. (2009) [PERSON]; [PERSON] [PERSON]; [PERSON] [PERSON]; [PERSON] [PERSON]; [PERSON]; [PERSON] Energy-efficient implementation of ECDH key exchange for wireless sensor networks. In _Lecture Notes in Computer Science, Proceedings of the Information Security Theory and Practice.