lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091103141234.GA8609@gondor.apana.org.au>
Date:	Tue, 3 Nov 2009 09:12:34 -0500
From:	Herbert Xu <herbert@...dor.apana.org.au>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Huang Ying <ying.huang@...el.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
	Daniel Walker <dwalker@...o99.com>,
	"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH -v4] crypto: Add PCLMULQDQ accelerated GHASH
	implementation

On Mon, Nov 02, 2009 at 04:46:04PM +0100, Ingo Molnar wrote:
> 
> Yeah. Or just a single block of:
> 
> 
>   #ifndef __ASSEMBLY__
>   ...
>   #endif /* __ASSEMBLY__ */
> 
> around the C bits - anything outside that is good for assembly as well. 

OK I'll throw this into cryptodev:

commit 3b0d65969b549b796abc6f0230f6142fed365d49
Author: Herbert Xu <herbert@...dor.apana.org.au>
Date:   Tue Nov 3 09:11:15 2009 -0500

    crypto: ghash-intel - Add PSHUFB macros
    
    Add PSHUFB macros instead of repeating byte sequences, suggested
    by Ingo.
    
    Signed-off-by: Herbert Xu <herbert@...dor.apana.org.au>
    Acked-by: Ingo Molnar <mingo@...e.hu>

diff --git a/arch/x86/crypto/ghash-clmulni-intel_asm.S b/arch/x86/crypto/ghash-clmulni-intel_asm.S
index 71768d5..5958498 100644
--- a/arch/x86/crypto/ghash-clmulni-intel_asm.S
+++ b/arch/x86/crypto/ghash-clmulni-intel_asm.S
@@ -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
diff --git a/arch/x86/include/asm/i387.h b/arch/x86/include/asm/i387.h
index 0b20bbb..ebfb8a9 100644
--- a/arch/x86/include/asm/i387.h
+++ b/arch/x86/include/asm/i387.h
@@ -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 */

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ