X-Git-Url: https://git.cryptolib.org/?p=avr-crypto-lib.git;a=blobdiff_plain;f=noekeon_omac.S;h=d3d7c143c678b9a0c0f3d4fc879f7afc7c00bd46;hp=f3330f7d1f0a5cac3c8a8881412ec4534714156b;hb=6bd58d7909b89a3e05003a63cdc642638fa653e6;hpb=36101d05fdd3f660375301ca9f017d2e16c228b7 diff --git a/noekeon_omac.S b/noekeon_omac.S index f3330f7..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 @@ -108,10 +65,10 @@ noekeon_omac: 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