]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
crypto: ghash-intel - Add PSHUFB macros
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 3 Nov 2009 14:11:15 +0000 (09:11 -0500)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 3 Nov 2009 14:11:15 +0000 (09:11 -0500)
Add PSHUFB macros instead of repeating byte sequences, suggested
by Ingo.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Ingo Molnar <mingo@elte.hu>
arch/x86/crypto/ghash-clmulni-intel_asm.S
arch/x86/include/asm/i387.h

index 71768d543dbb4f3fc6de5a6e97cea5de83900f05..59584982fb75ea4bd230f5b63701175eeb989b35 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include <linux/linkage.h>
+#include <asm/i387.h>
 
 .align 16
 .Lbswap_mask:
@@ -101,7 +102,7 @@ ENTRY(clmul_ghash_mul)
        movups (%rsi), SHASH
        movaps .Lbswap_mask, BSWAP
        # pshufb BSWAP, DATA
-       .byte 0x66, 0x0f, 0x38, 0x00, 0xc5
+       PSHUFB_XMM5_XMM0
        call __clmul_gf128mul_ble
        # pshufb BSWAP, DATA
        .byte 0x66, 0x0f, 0x38, 0x00, 0xc5
@@ -119,12 +120,12 @@ ENTRY(clmul_ghash_update)
        movups (%rdi), DATA
        movups (%rcx), SHASH
        # pshufb BSWAP, DATA
-       .byte 0x66, 0x0f, 0x38, 0x00, 0xc5
+       PSHUFB_XMM5_XMM0
 .align 4
 .Lupdate_loop:
        movups (%rsi), IN1
        # pshufb BSWAP, IN1
-       .byte 0x66, 0x0f, 0x38, 0x00, 0xf5
+       PSHUFB_XMM5_XMM6
        pxor IN1, DATA
        call __clmul_gf128mul_ble
        sub $16, %rdx
@@ -132,7 +133,7 @@ ENTRY(clmul_ghash_update)
        cmp $16, %rdx
        jge .Lupdate_loop
        # pshufb BSWAP, DATA
-       .byte 0x66, 0x0f, 0x38, 0x00, 0xc5
+       PSHUFB_XMM5_XMM0
        movups DATA, (%rdi)
 .Lupdate_just_ret:
        ret
@@ -146,7 +147,7 @@ ENTRY(clmul_ghash_setkey)
        movaps .Lbswap_mask, BSWAP
        movups (%rsi), %xmm0
        # pshufb BSWAP, %xmm0
-       .byte 0x66, 0x0f, 0x38, 0x00, 0xc5
+       PSHUFB_XMM5_XMM0
        movaps %xmm0, %xmm1
        psllq $1, %xmm0
        psrlq $63, %xmm1
index 0b20bbb758f26594358f55c8ceb827dc2d35bdaf..ebfb8a9e11f7eaef0e6896dd1dcfc7f3bdd74aae 100644 (file)
@@ -10,6 +10,8 @@
 #ifndef _ASM_X86_I387_H
 #define _ASM_X86_I387_H
 
+#ifndef __ASSEMBLY__
+
 #include <linux/sched.h>
 #include <linux/kernel_stat.h>
 #include <linux/regset.h>
@@ -411,4 +413,9 @@ static inline unsigned short get_fpu_mxcsr(struct task_struct *tsk)
        }
 }
 
+#endif /* __ASSEMBLY__ */
+
+#define PSHUFB_XMM5_XMM0 .byte 0x66, 0x0f, 0x38, 0x00, 0xc5
+#define PSHUFB_XMM5_XMM6 .byte 0x66, 0x0f, 0x38, 0x00, 0xf5
+
 #endif /* _ASM_X86_I387_H */