Efficient Implementation of the SHA-512 Hash Function for 8-bit AVR Microcontrollers
English
Cheng, Hao[University of Luxembourg > Interdisciplinary Centre for Security, Reliability and Trust (SNT) > Computer Science and Communications Research Unit (CSC) >]
Dinu, Dumitru-Daniel[Virginia Tech > Bradley Department of Electrical and Computer Engineering]
Groszschädl, Johann[University of Luxembourg > Faculty of Science, Technology and Communication (FSTC) > Computer Science and Communications Research Unit (CSC) >]
Nov-2018
Innovative Security Solutions for Information Technology and Communications, 11th International Conference, SecITC 2018, Bucharest, Romania, November 8-9, 2018, Revised Selected Papers
Lanet, Jean-Louis
Toma, Cristian
Springer Verlag
Lecture Notes in Computer Science, volume 11359
273-287
Yes
International
978-3-030-12941-5
11th International Conference on Security for Information Technology and Communications (SecITC 2018)
from 08-11-2018 to 09-11-2018
Bucharest
Romania
[en] Internet of Things (IoT) ; Lightweight Cryptography ; AVR Microcontroller ; Software Optimization ; Performance Evaluation
[en] SHA-512 is a member of the SHA-2 family of cryptographic hash algorithms that is based on a Davies-Mayer compression function operating on eight 64-bit words to produce a 512-bit digest. It provides strong resistance to collision and preimage attacks, and is assumed to remain secure in the dawning era of quantum computers. However, the compression function of SHA-512 is challenging to implement on small 8 and 16-bit microcontrollers because of their limited register space and the fact that 64-bit rotations are generally slow on such devices. In this paper, we present the first highly-optimized Assembler implementation of SHA-512 for the ATmega family of 8-bit AVR microcontrollers. We introduce a special optimization technique for the compression function based on a duplication of the eight working variables so that they can be more efficiently loaded from RAM via the indirect addressing mode with displacement (using the ldd and std instruction). In this way, we were able to achieve high performance without unrolling the main loop of the compression function, thereby keeping the code size small. When executed on an 8-bit AVR ATmega128 microcontroller, the compression function takes slightly less than 60k clock cycles, which corresponds to a compression rate of roughly 467 cycles per byte. The binary code size of the full SHA-512 implementation providing a standard Init-Update-Final (IUF) interface amounts to approximately 3.5 kB.