Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: libcrypto: Illegal instruction ``pshufb'' on non-sse3 CPU



On Tue, May 19, 2015 at 03:45:10AM +0200, Timo Buhrmester wrote:
> As of late, when building (and installing) -head I end up with a
> libcrypto causing SIGILL, apparently due to using the ``pshufb''
> instruction (which I believe is part of the SSE3 extension).

Please try the attached patch.

Joerg
Index: arch/x86_64/sha1-x86_64.S
===================================================================
RCS file: /home/joerg/repo/netbsd/src/crypto/external/bsd/openssl/lib/libcrypto/arch/x86_64/sha1-x86_64.S,v
retrieving revision 1.6
diff -u -p -r1.6 sha1-x86_64.S
--- arch/x86_64/sha1-x86_64.S	16 May 2015 19:08:37 -0000	1.6
+++ arch/x86_64/sha1-x86_64.S	20 May 2015 12:39:56 -0000
@@ -6,15 +6,12 @@
 .type	sha1_block_data_order,@function
 .align	16
 sha1_block_data_order:
-	movl	OPENSSL_ia32cap_P+0@GOTPCREL(%rip),%r9d
-	movl	OPENSSL_ia32cap_P+4@GOTPCREL(%rip),%r8d
-	testl	$512,%r8d
-	jz	.Lialu
-	andl	$268435456,%r8d
-	andl	$1073741824,%r9d
-	orl	%r9d,%r8d
-	cmpl	$1342177280,%r8d
-	je	_avx_shortcut
+	movq	OPENSSL_ia32cap_P@GOTPCREL(%rip),%r8
+	movq	(%r8), %r8
+	btq	$41, %r8
+	jnc	.Lialu
+	btq	$60, %r8
+	jc	_avx_shortcut
 	jmp	_ssse3_shortcut
 
 .align	16


Home | Main Index | Thread Index | Old Index