From 3f6c6252aa182e6e6244bbb591a58d494d24646a Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Tue, 13 Oct 2015 22:12:40 +0300 Subject: [PATCH] Remove sha256d implementation. --- src/crypto/sha2/asm/sha2-x86.S | 586 ---------------------------------------- 1 files changed, 0 insertions(+), 586 deletions(-) diff --git a/src/crypto/sha2/asm/sha2-x86.S b/src/crypto/sha2/asm/sha2-x86.S index c66ef09..ac64569 100644 --- a/src/crypto/sha2/asm/sha2-x86.S +++ b/src/crypto/sha2/asm/sha2-x86.S @@ -93,20 +93,6 @@ sha256_4k: .long 0xbef9a3f7, 0xbef9a3f7, 0xbef9a3f7, 0xbef9a3f7 .long 0xc67178f2, 0xc67178f2, 0xc67178f2, 0xc67178f2 - .data - .p2align 6 -sha256d_4preext2_15: - .long 0x00000100, 0x00000100, 0x00000100, 0x00000100 -sha256d_4preext2_17: - .long 0x00a00000, 0x00a00000, 0x00a00000, 0x00a00000 -sha256d_4preext2_23: - .long 0x11002000, 0x11002000, 0x11002000, 0x11002000 -sha256d_4preext2_24: - .long 0x80000000, 0x80000000, 0x80000000, 0x80000000 -sha256d_4preext2_30: - .long 0x00400022, 0x00400022, 0x00400022, 0x00400022 - - .text .p2align 5 .globl sha256_init_4way @@ -563,562 +549,6 @@ sha256_transform_4way_main_loop: popl %edi ret - - .text - .p2align 5 - .globl sha256d_ms_4way - .globl _sha256d_ms_4way -sha256d_ms_4way: -_sha256d_ms_4way: - pushl %edi - pushl %esi - pushl %ebp - movl 16(%esp), %edi - movl 20(%esp), %esi - movl 24(%esp), %edx - movl 28(%esp), %ecx - movl %esp, %ebp - subl $67*16, %esp - andl $-128, %esp - - leal 256(%esi), %eax - -sha256d_ms_4way_extend_loop1: - movdqa 3*16(%esi), %xmm0 - movdqa 2*16(%eax), %xmm3 - movdqa 3*16(%eax), %xmm7 - movdqa %xmm3, 5*16(%esp) - movdqa %xmm7, 6*16(%esp) - movdqa %xmm0, %xmm2 - paddd %xmm0, %xmm7 - psrld $3, %xmm0 - movdqa %xmm0, %xmm1 - pslld $14, %xmm2 - psrld $4, %xmm1 - pxor %xmm1, %xmm0 - pxor %xmm2, %xmm0 - psrld $11, %xmm1 - pslld $11, %xmm2 - pxor %xmm1, %xmm0 - pxor %xmm2, %xmm0 - paddd %xmm0, %xmm3 - movdqa %xmm3, 2*16(%eax) - movdqa %xmm7, 3*16(%eax) - - movdqa 4*16(%eax), %xmm0 - movdqa %xmm0, 7*16(%esp) - movdqa %xmm3, %xmm2 - movdqa %xmm7, %xmm6 - psrld $10, %xmm3 - psrld $10, %xmm7 - movdqa %xmm3, %xmm1 - movdqa %xmm7, %xmm5 - pslld $13, %xmm2 - pslld $13, %xmm6 - psrld $7, %xmm1 - psrld $7, %xmm5 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - psrld $2, %xmm1 - psrld $2, %xmm5 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - pslld $2, %xmm2 - pslld $2, %xmm6 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - paddd %xmm0, %xmm3 - movdqa %xmm3, 4*16(%eax) - movdqa %xmm7, 5*16(%eax) - - movdqa 6*16(%eax), %xmm0 - movdqa 7*16(%eax), %xmm4 - movdqa %xmm0, 9*16(%esp) - movdqa %xmm4, 10*16(%esp) - movdqa %xmm3, %xmm2 - movdqa %xmm7, %xmm6 - psrld $10, %xmm3 - psrld $10, %xmm7 - movdqa %xmm3, %xmm1 - movdqa %xmm7, %xmm5 - pslld $13, %xmm2 - pslld $13, %xmm6 - psrld $7, %xmm1 - psrld $7, %xmm5 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - psrld $2, %xmm1 - psrld $2, %xmm5 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - pslld $2, %xmm2 - pslld $2, %xmm6 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - paddd %xmm0, %xmm3 - paddd %xmm4, %xmm7 - movdqa %xmm3, 6*16(%eax) - movdqa %xmm7, 7*16(%eax) - - movdqa 8*16(%eax), %xmm0 - movdqa 2*16(%eax), %xmm4 - movdqa %xmm0, 11*16(%esp) - movdqa %xmm3, %xmm2 - movdqa %xmm7, %xmm6 - psrld $10, %xmm3 - psrld $10, %xmm7 - movdqa %xmm3, %xmm1 - movdqa %xmm7, %xmm5 - pslld $13, %xmm2 - pslld $13, %xmm6 - psrld $7, %xmm1 - psrld $7, %xmm5 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - psrld $2, %xmm1 - psrld $2, %xmm5 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - pslld $2, %xmm2 - pslld $2, %xmm6 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - paddd %xmm0, %xmm3 - paddd %xmm4, %xmm7 - movdqa %xmm3, 8*16(%eax) - movdqa %xmm7, 9*16(%eax) - - movdqa %xmm3, %xmm2 - movdqa %xmm7, %xmm6 - psrld $10, %xmm3 - psrld $10, %xmm7 - movdqa %xmm3, %xmm1 - movdqa %xmm7, %xmm5 - pslld $13, %xmm2 - pslld $13, %xmm6 - psrld $7, %xmm1 - psrld $7, %xmm5 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - psrld $2, %xmm1 - psrld $2, %xmm5 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - pslld $2, %xmm2 - pslld $2, %xmm6 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - paddd 3*16(%eax), %xmm3 - paddd 4*16(%eax), %xmm7 - movdqa %xmm3, 10*16(%eax) - movdqa %xmm7, 11*16(%eax) - - movdqa %xmm3, %xmm2 - movdqa %xmm7, %xmm6 - psrld $10, %xmm3 - psrld $10, %xmm7 - movdqa %xmm3, %xmm1 - movdqa %xmm7, %xmm5 - pslld $13, %xmm2 - pslld $13, %xmm6 - psrld $7, %xmm1 - psrld $7, %xmm5 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - psrld $2, %xmm1 - psrld $2, %xmm5 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - pslld $2, %xmm2 - pslld $2, %xmm6 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - paddd 5*16(%eax), %xmm3 - paddd 6*16(%eax), %xmm7 - movdqa %xmm3, 12*16(%eax) - movdqa %xmm7, 13*16(%eax) - - movdqa 14*16(%eax), %xmm0 - movdqa 15*16(%eax), %xmm4 - movdqa %xmm0, 17*16(%esp) - movdqa %xmm4, 18*16(%esp) - movdqa %xmm3, %xmm2 - movdqa %xmm7, %xmm6 - psrld $10, %xmm3 - psrld $10, %xmm7 - movdqa %xmm3, %xmm1 - movdqa %xmm7, %xmm5 - paddd 7*16(%eax), %xmm0 - paddd 8*16(%eax), %xmm4 - pslld $13, %xmm2 - pslld $13, %xmm6 - psrld $7, %xmm1 - psrld $7, %xmm5 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - psrld $2, %xmm1 - psrld $2, %xmm5 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - pslld $2, %xmm2 - pslld $2, %xmm6 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - paddd %xmm0, %xmm3 - paddd %xmm4, %xmm7 - movdqa %xmm3, 14*16(%eax) - movdqa %xmm7, 15*16(%eax) - -sha256d_ms_4way_extend_loop2: - sha256_sse2_extend_doubleround 16 - sha256_sse2_extend_doubleround 18 - sha256_sse2_extend_doubleround 20 - sha256_sse2_extend_doubleround 22 - sha256_sse2_extend_doubleround 24 - sha256_sse2_extend_doubleround 26 - sha256_sse2_extend_doubleround 28 - sha256_sse2_extend_doubleround 30 - sha256_sse2_extend_doubleround 32 - sha256_sse2_extend_doubleround 34 - sha256_sse2_extend_doubleround 36 - sha256_sse2_extend_doubleround 38 - sha256_sse2_extend_doubleround 40 - sha256_sse2_extend_doubleround 42 - jz sha256d_ms_4way_extend_coda2 - sha256_sse2_extend_doubleround 44 - sha256_sse2_extend_doubleround 46 - - movdqa 0(%ecx), %xmm3 - movdqa 16(%ecx), %xmm0 - movdqa 32(%ecx), %xmm1 - movdqa 48(%ecx), %xmm2 - movdqa 64(%ecx), %xmm6 - movdqa 80(%ecx), %xmm7 - movdqa 96(%ecx), %xmm5 - movdqa 112(%ecx), %xmm4 - movdqa %xmm1, 0(%esp) - movdqa %xmm2, 16(%esp) - movdqa %xmm6, 32(%esp) - - movl %esi, %eax - jmp sha256d_ms_4way_main_loop1 - -sha256d_ms_4way_main_loop2: - sha256_sse2_main_round 0 - sha256_sse2_main_round 1 - sha256_sse2_main_round 2 -sha256d_ms_4way_main_loop1: - sha256_sse2_main_round 3 - sha256_sse2_main_quadround 4 - sha256_sse2_main_quadround 8 - sha256_sse2_main_quadround 12 - sha256_sse2_main_quadround 16 - sha256_sse2_main_quadround 20 - sha256_sse2_main_quadround 24 - sha256_sse2_main_quadround 28 - sha256_sse2_main_quadround 32 - sha256_sse2_main_quadround 36 - sha256_sse2_main_quadround 40 - sha256_sse2_main_quadround 44 - sha256_sse2_main_quadround 48 - sha256_sse2_main_quadround 52 - sha256_sse2_main_round 56 - jz sha256d_ms_4way_finish - sha256_sse2_main_round 57 - sha256_sse2_main_round 58 - sha256_sse2_main_round 59 - sha256_sse2_main_quadround 60 - - movdqa 5*16(%esp), %xmm1 - movdqa 6*16(%esp), %xmm2 - movdqa 7*16(%esp), %xmm6 - movdqa %xmm1, 18*16(%esi) - movdqa %xmm2, 19*16(%esi) - movdqa %xmm6, 20*16(%esi) - movdqa 9*16(%esp), %xmm1 - movdqa 10*16(%esp), %xmm2 - movdqa 11*16(%esp), %xmm6 - movdqa %xmm1, 22*16(%esi) - movdqa %xmm2, 23*16(%esi) - movdqa %xmm6, 24*16(%esi) - movdqa 17*16(%esp), %xmm1 - movdqa 18*16(%esp), %xmm2 - movdqa %xmm1, 30*16(%esi) - movdqa %xmm2, 31*16(%esi) - - movdqa 0(%esp), %xmm1 - movdqa 16(%esp), %xmm2 - movdqa 32(%esp), %xmm6 - paddd 0(%edx), %xmm7 - paddd 16(%edx), %xmm5 - paddd 32(%edx), %xmm4 - paddd 48(%edx), %xmm3 - paddd 64(%edx), %xmm0 - paddd 80(%edx), %xmm1 - paddd 96(%edx), %xmm2 - paddd 112(%edx), %xmm6 - - movdqa %xmm7, 48+0(%esp) - movdqa %xmm5, 48+16(%esp) - movdqa %xmm4, 48+32(%esp) - movdqa %xmm3, 48+48(%esp) - movdqa %xmm0, 48+64(%esp) - movdqa %xmm1, 48+80(%esp) - movdqa %xmm2, 48+96(%esp) - movdqa %xmm6, 48+112(%esp) - - movdqa sha256d_4preext2_15, %xmm1 - movdqa sha256d_4preext2_24, %xmm2 - pxor %xmm0, %xmm0 - movdqa %xmm2, 48+128(%esp) - movdqa %xmm0, 48+144(%esp) - movdqa %xmm0, 48+160(%esp) - movdqa %xmm0, 48+176(%esp) - movdqa %xmm0, 48+192(%esp) - movdqa %xmm0, 48+208(%esp) - movdqa %xmm0, 48+224(%esp) - movdqa %xmm1, 48+240(%esp) - - leal 19*16(%esp), %eax - cmpl %eax, %eax - - movdqa -15*16(%eax), %xmm0 - movdqa -14*16(%eax), %xmm4 - movdqa %xmm0, %xmm2 - movdqa %xmm4, %xmm6 - psrld $3, %xmm0 - psrld $3, %xmm4 - movdqa %xmm0, %xmm1 - movdqa %xmm4, %xmm5 - pslld $14, %xmm2 - pslld $14, %xmm6 - psrld $4, %xmm1 - psrld $4, %xmm5 - pxor %xmm1, %xmm0 - pxor %xmm5, %xmm4 - psrld $11, %xmm1 - psrld $11, %xmm5 - pxor %xmm2, %xmm0 - pxor %xmm6, %xmm4 - pslld $11, %xmm2 - pslld $11, %xmm6 - pxor %xmm1, %xmm0 - pxor %xmm5, %xmm4 - pxor %xmm2, %xmm0 - pxor %xmm6, %xmm4 - paddd -16*16(%eax), %xmm0 - paddd -15*16(%eax), %xmm4 - paddd sha256d_4preext2_17, %xmm4 - movdqa %xmm0, %xmm3 - movdqa %xmm4, %xmm7 - movdqa %xmm3, 0*16(%eax) - movdqa %xmm7, 1*16(%eax) - - sha256_sse2_extend_doubleround 2 - sha256_sse2_extend_doubleround 4 - - movdqa -9*16(%eax), %xmm0 - movdqa sha256d_4preext2_23, %xmm4 - movdqa %xmm0, %xmm2 - psrld $3, %xmm0 - movdqa %xmm0, %xmm1 - pslld $14, %xmm2 - psrld $4, %xmm1 - pxor %xmm1, %xmm0 - pxor %xmm2, %xmm0 - psrld $11, %xmm1 - pslld $11, %xmm2 - pxor %xmm1, %xmm0 - pxor %xmm2, %xmm0 - paddd -10*16(%eax), %xmm0 - paddd -9*16(%eax), %xmm4 - movdqa %xmm3, %xmm2 - movdqa %xmm7, %xmm6 - psrld $10, %xmm3 - psrld $10, %xmm7 - movdqa %xmm3, %xmm1 - movdqa %xmm7, %xmm5 - paddd -1*16(%eax), %xmm0 - pslld $13, %xmm2 - pslld $13, %xmm6 - psrld $7, %xmm1 - psrld $7, %xmm5 - paddd 0*16(%eax), %xmm4 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - psrld $2, %xmm1 - psrld $2, %xmm5 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - pslld $2, %xmm2 - pslld $2, %xmm6 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - paddd %xmm0, %xmm3 - paddd %xmm4, %xmm7 - movdqa %xmm3, 6*16(%eax) - movdqa %xmm7, 7*16(%eax) - - movdqa sha256d_4preext2_24, %xmm0 - movdqa %xmm3, %xmm2 - movdqa %xmm7, %xmm6 - psrld $10, %xmm3 - psrld $10, %xmm7 - movdqa %xmm3, %xmm1 - movdqa %xmm7, %xmm5 - paddd 1*16(%eax), %xmm0 - pslld $13, %xmm2 - pslld $13, %xmm6 - psrld $7, %xmm1 - psrld $7, %xmm5 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - psrld $2, %xmm1 - psrld $2, %xmm5 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - pslld $2, %xmm2 - pslld $2, %xmm6 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - paddd %xmm0, %xmm3 - paddd 2*16(%eax), %xmm7 - movdqa %xmm3, 8*16(%eax) - movdqa %xmm7, 9*16(%eax) - - movdqa %xmm3, %xmm2 - movdqa %xmm7, %xmm6 - psrld $10, %xmm3 - psrld $10, %xmm7 - movdqa %xmm3, %xmm1 - movdqa %xmm7, %xmm5 - pslld $13, %xmm2 - pslld $13, %xmm6 - psrld $7, %xmm1 - psrld $7, %xmm5 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - psrld $2, %xmm1 - psrld $2, %xmm5 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - pslld $2, %xmm2 - pslld $2, %xmm6 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - paddd 3*16(%eax), %xmm3 - paddd 4*16(%eax), %xmm7 - movdqa %xmm3, 10*16(%eax) - movdqa %xmm7, 11*16(%eax) - - movdqa %xmm3, %xmm2 - movdqa %xmm7, %xmm6 - psrld $10, %xmm3 - psrld $10, %xmm7 - movdqa %xmm3, %xmm1 - movdqa %xmm7, %xmm5 - pslld $13, %xmm2 - pslld $13, %xmm6 - psrld $7, %xmm1 - psrld $7, %xmm5 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - psrld $2, %xmm1 - psrld $2, %xmm5 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - pslld $2, %xmm2 - pslld $2, %xmm6 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - paddd 5*16(%eax), %xmm3 - paddd 6*16(%eax), %xmm7 - movdqa %xmm3, 12*16(%eax) - movdqa %xmm7, 13*16(%eax) - - movdqa sha256d_4preext2_30, %xmm0 - movdqa 0*16(%eax), %xmm4 - movdqa %xmm4, %xmm6 - psrld $3, %xmm4 - movdqa %xmm4, %xmm5 - pslld $14, %xmm6 - psrld $4, %xmm5 - pxor %xmm5, %xmm4 - pxor %xmm6, %xmm4 - psrld $11, %xmm5 - pslld $11, %xmm6 - pxor %xmm5, %xmm4 - pxor %xmm6, %xmm4 - paddd -1*16(%eax), %xmm4 - movdqa %xmm3, %xmm2 - movdqa %xmm7, %xmm6 - psrld $10, %xmm3 - psrld $10, %xmm7 - movdqa %xmm3, %xmm1 - movdqa %xmm7, %xmm5 - paddd 7*16(%eax), %xmm0 - pslld $13, %xmm2 - pslld $13, %xmm6 - psrld $7, %xmm1 - psrld $7, %xmm5 - paddd 8*16(%eax), %xmm4 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - psrld $2, %xmm1 - psrld $2, %xmm5 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - pslld $2, %xmm2 - pslld $2, %xmm6 - pxor %xmm1, %xmm3 - pxor %xmm5, %xmm7 - pxor %xmm2, %xmm3 - pxor %xmm6, %xmm7 - paddd %xmm0, %xmm3 - paddd %xmm4, %xmm7 - movdqa %xmm3, 14*16(%eax) - movdqa %xmm7, 15*16(%eax) - - jmp sha256d_ms_4way_extend_loop2 - -sha256d_ms_4way_extend_coda2: - sha256_sse2_extend_round 44 - - movdqa sha256_4h+0, %xmm7 - movdqa sha256_4h+16, %xmm5 - movdqa sha256_4h+32, %xmm4 - movdqa sha256_4h+48, %xmm3 - movdqa sha256_4h+64, %xmm0 - movdqa sha256_4h+80, %xmm1 - movdqa sha256_4h+96, %xmm2 - movdqa sha256_4h+112, %xmm6 - movdqa %xmm1, 0(%esp) - movdqa %xmm2, 16(%esp) - movdqa %xmm6, 32(%esp) - - leal 48(%esp), %eax - jmp sha256d_ms_4way_main_loop2 - .macro sha256_sse2_main_round_red i, r7 movdqa 16*(\i)(%eax), %xmm6 paddd 16*(\i)+sha256_4k, %xmm6 @@ -1150,22 +580,6 @@ sha256d_ms_4way_extend_coda2: paddd %xmm6, %xmm0 .endm -sha256d_ms_4way_finish: - sha256_sse2_main_round_red 57, %xmm3 - sha256_sse2_main_round_red 58, %xmm4 - sha256_sse2_main_round_red 59, %xmm5 - sha256_sse2_main_round_red 60, %xmm7 - - paddd sha256_4h+112, %xmm0 - movdqa %xmm0, 112(%edi) - - movl %ebp, %esp - popl %ebp - popl %esi - popl %edi - ret - - .text .p2align 5 .globl sha256_use_4way -- 1.7.1