X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=noekeon_omac.S;h=d3d7c143c678b9a0c0f3d4fc879f7afc7c00bd46;hb=6bd58d7909b89a3e05003a63cdc642638fa653e6;hp=47b264ac5ae4a21552077117ac0a3aa5450f4dd8;hpb=b07fb998ba047b641edb843e73f5284fe5fff9af;p=avr-crypto-lib.git diff --git a/noekeon_omac.S b/noekeon_omac.S index 47b264a..d3d7c14 100644 --- a/noekeon_omac.S +++ b/noekeon_omac.S @@ -27,52 +27,9 @@ */ #include +#include "avr-asm-macros.S" -.macro push_ p1:req, p2:vararg - push \p1 -.ifnb \p2 - push_ \p2 -.endif -.endm - -.macro pop_ p1:req, p2:vararg - pop \p1 -.ifnb \p2 - pop_ \p2 -.endif -.endm - -.macro push_range from:req, to:req - push \from -.if \to-\from - push_range "(\from+1)",\to -.endif -.endm - -.macro pop_range from:req, to:req - pop \to -.if \to-\from - pop_range \from,"(\to-1)" -.endif -.endm - -.macro stack_alloc size:req, reg1=r30, reg2=r31 - in \reg1, _SFR_IO_ADDR(SPL) - in \reg2, _SFR_IO_ADDR(SPH) - sbiw r30, \size - out _SFR_IO_ADDR(SPH), \reg2 - out _SFR_IO_ADDR(SPL), \reg1 -.endm - -.macro stack_free size:req, reg1=r30, reg2=r31 - in \reg1, _SFR_IO_ADDR(SPL) - in \reg2, _SFR_IO_ADDR(SPH) - adiw r30, \size - out _SFR_IO_ADDR(SPH), \reg2 - out _SFR_IO_ADDR(SPL), \reg1 -.endm - push_r18_r27_func: pop r31 pop r30 @@ -101,16 +58,17 @@ pop_r18_r27_func: .global noekeon_omac noekeon_omac: stack_alloc 48 + adiw r30, 1 ldi r17, 48 1: st Z+, r1 dec r17 brne 1b sbiw r30, 48 - mov r26, r22 - mov r22, r18 - mov r18, r24 - mov r24, r30 + movw r26, r22 + movw r22, r18 + movw r18, r24 + movw r24, r30 cpi r16, 0xff breq 2f st Z, r16