symm/*.S: Symbolic names for shuffles.
[catacomb] / symm / rijndael-x86-aesni.S
index d9aa9dc..eba7b05 100644 (file)
        .globl  F(rijndael_rcon)
 
 ///--------------------------------------------------------------------------
+/// Local utilities.
+
+// Magic constants for shuffling.
+#define ROTL 0x93
+#define ROT2 0x4e
+#define ROTR 0x39
+
+///--------------------------------------------------------------------------
 /// Main code.
 
        .arch   .aes
@@ -119,9 +127,9 @@ FUNC(rijndael_setup_x86_aesni)
        // open-coding the whole thing.  It's much easier to leave that as
        // zero and XOR in the round constant by hand.
 9:     movd    xmm0, eax
-       pshufd  xmm0, xmm0, 0x39
+       pshufd  xmm0, xmm0, ROTR
        aeskeygenassist xmm1, xmm0, 0
-       pshufd  xmm1, xmm1, 0x93
+       pshufd  xmm1, xmm1, ROTL
        movd    eax, xmm1
        xor     eax, [esi]
        xor     al, [ecx]
@@ -159,7 +167,7 @@ FUNC(rijndael_setup_x86_aesni)
        cmp     ebx, 7
        jb      0f
        movd    xmm0, eax
-       pshufd  xmm0, xmm0, 0x93
+       pshufd  xmm0, xmm0, ROTL
        aeskeygenassist xmm1, xmm0, 0
        movd    eax, xmm1
 0:     xor     eax, [esi]