symm/rijndael-arm-crypto.S (rijndael_setup_arm_crypto): Renumber labels.
[catacomb] / symm / rijndael-x86ish-aesni.S
index 0b295e5..f938654 100644 (file)
@@ -30,9 +30,6 @@
 #include "config.h"
 #include "asm-common.h"
 
-///--------------------------------------------------------------------------
-/// External definitions.
-
        .globl  F(abort)
        .globl  F(rijndael_rcon)
 
@@ -197,7 +194,7 @@ FUNC(rijndael_setup_x86ish_aesni)
 
        // Find the round constants.
        ldgot   ecx
-       leaext  RCON, rijndael_rcon, ecx
+       leaext  RCON, F(rijndael_rcon), ecx
 
        // Prepare for the main loop.
        lea     SI, [CTX + w]
@@ -377,12 +374,10 @@ FUNC(rijndael_setup_x86ish_aesni)
 #endif
 
        // End-swap the encryption keys.
-       mov     ecx, NKW
        lea     SI, [CTX + w]
        call    endswap_block
 
        // And the decryption keys.
-       mov     ecx, NKW
        lea     SI, [CTX + wi]
        call    endswap_block
 
@@ -401,14 +396,15 @@ FUNC(rijndael_setup_x86ish_aesni)
 
        .align  16
 endswap_block:
-       // End-swap ECX words starting at SI.  The end-swapping table is
+       // End-swap NKW words starting at SI.  The end-swapping table is
        // already loaded into XMM5; and it's OK to work in 16-byte chunks.
-       movdqu  xmm1, [SI]
+       mov     ecx, NKW
+0:     movdqu  xmm1, [SI]
        pshufb  xmm1, xmm5
        movdqu  [SI], xmm1
        add     SI, 16
        sub     ecx, 4
-       ja      endswap_block
+       ja      0b
        ret
 
 #undef CTX
@@ -431,8 +427,8 @@ ENDFUNC
 ///--------------------------------------------------------------------------
 /// Encrypting and decrypting blocks.
 
-       .macro  encdec op, aes, koff
-FUNC(rijndael_\op\()_x86ish_aesni)
+.macro encdec  op, aes, koff
+  FUNC(rijndael_\op\()_x86ish_aesni)
 
        // Find the magic endianness-swapping table.
        ldgot   ecx
@@ -569,8 +565,8 @@ FUNC(rijndael_\op\()_x86ish_aesni)
 #undef DST
 #undef NR
 
-ENDFUNC
-       .endm
+  ENDFUNC
+.endm
 
        encdec  eblk, aesenc, w
        encdec  dblk, aesdec, wi