From fc5e06a19c090d98620a735e33b57aee7c43107d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 22 Jun 2015 23:42:03 +0200 Subject: salsa20{,12}/xmm: avoid symbol conflicts with libnacl Also remove some dead code --- src/crypto/cipher/salsa20/xmm/salsa20_amd64_xmm6.s | 111 +-------------------- src/crypto/cipher/salsa20/xmm/salsa20_x86_xmm5.s | 101 +------------------ src/crypto/cipher/salsa20/xmm/salsa20_xmm.c | 13 +-- .../cipher/salsa2012/xmm/salsa2012_amd64_xmm6.s | 111 +-------------------- .../cipher/salsa2012/xmm/salsa2012_x86_xmm5.s | 101 +------------------ src/crypto/cipher/salsa2012/xmm/salsa2012_xmm.c | 13 +-- 6 files changed, 20 insertions(+), 430 deletions(-) (limited to 'src') diff --git a/src/crypto/cipher/salsa20/xmm/salsa20_amd64_xmm6.s b/src/crypto/cipher/salsa20/xmm/salsa20_amd64_xmm6.s index ce75445..b85b4f9 100644 --- a/src/crypto/cipher/salsa20/xmm/salsa20_amd64_xmm6.s +++ b/src/crypto/cipher/salsa20/xmm/salsa20_amd64_xmm6.s @@ -333,116 +333,13 @@ # qhasm: stack64 bytes_backup -# qhasm: enter crypto_stream_salsa20_amd64_xmm6 -.text -.p2align 5 -.globl _crypto_stream_salsa20_amd64_xmm6 -.globl crypto_stream_salsa20_amd64_xmm6 -_crypto_stream_salsa20_amd64_xmm6: -crypto_stream_salsa20_amd64_xmm6: -mov %rsp,%r11 -and $31,%r11 -add $480,%r11 -sub %r11,%rsp - -# qhasm: r11_stack = r11_caller -# asm 1: movq r11_stack=stack64#1 -# asm 2: movq r11_stack=352(%rsp) -movq %r11,352(%rsp) - -# qhasm: r12_stack = r12_caller -# asm 1: movq r12_stack=stack64#2 -# asm 2: movq r12_stack=360(%rsp) -movq %r12,360(%rsp) - -# qhasm: r13_stack = r13_caller -# asm 1: movq r13_stack=stack64#3 -# asm 2: movq r13_stack=368(%rsp) -movq %r13,368(%rsp) - -# qhasm: r14_stack = r14_caller -# asm 1: movq r14_stack=stack64#4 -# asm 2: movq r14_stack=376(%rsp) -movq %r14,376(%rsp) - -# qhasm: r15_stack = r15_caller -# asm 1: movq r15_stack=stack64#5 -# asm 2: movq r15_stack=384(%rsp) -movq %r15,384(%rsp) - -# qhasm: rbx_stack = rbx_caller -# asm 1: movq rbx_stack=stack64#6 -# asm 2: movq rbx_stack=392(%rsp) -movq %rbx,392(%rsp) - -# qhasm: rbp_stack = rbp_caller -# asm 1: movq rbp_stack=stack64#7 -# asm 2: movq rbp_stack=400(%rsp) -movq %rbp,400(%rsp) - -# qhasm: bytes = arg2 -# asm 1: mov bytes=int64#6 -# asm 2: mov bytes=%r9 -mov %rsi,%r9 - -# qhasm: out = arg1 -# asm 1: mov out=int64#1 -# asm 2: mov out=%rdi -mov %rdi,%rdi - -# qhasm: m = out -# asm 1: mov m=int64#2 -# asm 2: mov m=%rsi -mov %rdi,%rsi - -# qhasm: iv = arg3 -# asm 1: mov iv=int64#3 -# asm 2: mov iv=%rdx -mov %rdx,%rdx - -# qhasm: k = arg4 -# asm 1: mov k=int64#8 -# asm 2: mov k=%r10 -mov %rcx,%r10 - -# qhasm: unsigned>? bytes - 0 -# asm 1: cmp $0, -jbe ._done - -# qhasm: a = 0 -# asm 1: mov $0,>a=int64#7 -# asm 2: mov $0,>a=%rax -mov $0,%rax - -# qhasm: i = bytes -# asm 1: mov i=int64#4 -# asm 2: mov i=%rcx -mov %r9,%rcx - -# qhasm: while (i) { *out++ = a; --i } -rep stosb - -# qhasm: out -= bytes -# asm 1: sub eax_stack=stack32#1 -# asm 2: movl eax_stack=0(%esp) -movl %eax,0(%esp) - -# qhasm: ebx_stack = ebx -# asm 1: movl ebx_stack=stack32#2 -# asm 2: movl ebx_stack=4(%esp) -movl %ebx,4(%esp) - -# qhasm: esi_stack = esi -# asm 1: movl esi_stack=stack32#3 -# asm 2: movl esi_stack=8(%esp) -movl %esi,8(%esp) - -# qhasm: edi_stack = edi -# asm 1: movl edi_stack=stack32#4 -# asm 2: movl edi_stack=12(%esp) -movl %edi,12(%esp) - -# qhasm: ebp_stack = ebp -# asm 1: movl ebp_stack=stack32#5 -# asm 2: movl ebp_stack=16(%esp) -movl %ebp,16(%esp) - -# qhasm: bytes = arg2 -# asm 1: movl bytes=int32#3 -# asm 2: movl bytes=%edx -movl 8(%esp,%eax),%edx - -# qhasm: out = arg1 -# asm 1: movl out=int32#6 -# asm 2: movl out=%edi -movl 4(%esp,%eax),%edi - -# qhasm: m = out -# asm 1: mov m=int32#5 -# asm 2: mov m=%esi -mov %edi,%esi - -# qhasm: iv = arg4 -# asm 1: movl iv=int32#4 -# asm 2: movl iv=%ebx -movl 16(%esp,%eax),%ebx - -# qhasm: k = arg5 -# asm 1: movl k=int32#7 -# asm 2: movl k=%ebp -movl 20(%esp,%eax),%ebp - -# qhasm: unsigned>? bytes - 0 -# asm 1: cmp $0, -jbe ._done - -# qhasm: a = 0 -# asm 1: mov $0,>a=int32#1 -# asm 2: mov $0,>a=%eax -mov $0,%eax - -# qhasm: i = bytes -# asm 1: mov i=int32#2 -# asm 2: mov i=%ecx -mov %edx,%ecx - -# qhasm: while (i) { *out++ = a; --i } -rep stosb - -# qhasm: out -= bytes -# asm 1: subl b, in->b, len, iv, state->key); + fastd_salsa20_xmm_xor(out->b, in->b, len, iv, state->key); return true; } diff --git a/src/crypto/cipher/salsa2012/xmm/salsa2012_amd64_xmm6.s b/src/crypto/cipher/salsa2012/xmm/salsa2012_amd64_xmm6.s index 71249b7..1f39454 100644 --- a/src/crypto/cipher/salsa2012/xmm/salsa2012_amd64_xmm6.s +++ b/src/crypto/cipher/salsa2012/xmm/salsa2012_amd64_xmm6.s @@ -333,116 +333,13 @@ # qhasm: stack64 bytes_backup -# qhasm: enter crypto_stream_salsa2012_amd64_xmm6 -.text -.p2align 5 -.globl _crypto_stream_salsa2012_amd64_xmm6 -.globl crypto_stream_salsa2012_amd64_xmm6 -_crypto_stream_salsa2012_amd64_xmm6: -crypto_stream_salsa2012_amd64_xmm6: -mov %rsp,%r11 -and $31,%r11 -add $480,%r11 -sub %r11,%rsp - -# qhasm: r11_stack = r11_caller -# asm 1: movq r11_stack=stack64#1 -# asm 2: movq r11_stack=352(%rsp) -movq %r11,352(%rsp) - -# qhasm: r12_stack = r12_caller -# asm 1: movq r12_stack=stack64#2 -# asm 2: movq r12_stack=360(%rsp) -movq %r12,360(%rsp) - -# qhasm: r13_stack = r13_caller -# asm 1: movq r13_stack=stack64#3 -# asm 2: movq r13_stack=368(%rsp) -movq %r13,368(%rsp) - -# qhasm: r14_stack = r14_caller -# asm 1: movq r14_stack=stack64#4 -# asm 2: movq r14_stack=376(%rsp) -movq %r14,376(%rsp) - -# qhasm: r15_stack = r15_caller -# asm 1: movq r15_stack=stack64#5 -# asm 2: movq r15_stack=384(%rsp) -movq %r15,384(%rsp) - -# qhasm: rbx_stack = rbx_caller -# asm 1: movq rbx_stack=stack64#6 -# asm 2: movq rbx_stack=392(%rsp) -movq %rbx,392(%rsp) - -# qhasm: rbp_stack = rbp_caller -# asm 1: movq rbp_stack=stack64#7 -# asm 2: movq rbp_stack=400(%rsp) -movq %rbp,400(%rsp) - -# qhasm: bytes = arg2 -# asm 1: mov bytes=int64#6 -# asm 2: mov bytes=%r9 -mov %rsi,%r9 - -# qhasm: out = arg1 -# asm 1: mov out=int64#1 -# asm 2: mov out=%rdi -mov %rdi,%rdi - -# qhasm: m = out -# asm 1: mov m=int64#2 -# asm 2: mov m=%rsi -mov %rdi,%rsi - -# qhasm: iv = arg3 -# asm 1: mov iv=int64#3 -# asm 2: mov iv=%rdx -mov %rdx,%rdx - -# qhasm: k = arg4 -# asm 1: mov k=int64#8 -# asm 2: mov k=%r10 -mov %rcx,%r10 - -# qhasm: unsigned>? bytes - 0 -# asm 1: cmp $0, -jbe ._done - -# qhasm: a = 0 -# asm 1: mov $0,>a=int64#7 -# asm 2: mov $0,>a=%rax -mov $0,%rax - -# qhasm: i = bytes -# asm 1: mov i=int64#4 -# asm 2: mov i=%rcx -mov %r9,%rcx - -# qhasm: while (i) { *out++ = a; --i } -rep stosb - -# qhasm: out -= bytes -# asm 1: sub eax_stack=stack32#1 -# asm 2: movl eax_stack=0(%esp) -movl %eax,0(%esp) - -# qhasm: ebx_stack = ebx -# asm 1: movl ebx_stack=stack32#2 -# asm 2: movl ebx_stack=4(%esp) -movl %ebx,4(%esp) - -# qhasm: esi_stack = esi -# asm 1: movl esi_stack=stack32#3 -# asm 2: movl esi_stack=8(%esp) -movl %esi,8(%esp) - -# qhasm: edi_stack = edi -# asm 1: movl edi_stack=stack32#4 -# asm 2: movl edi_stack=12(%esp) -movl %edi,12(%esp) - -# qhasm: ebp_stack = ebp -# asm 1: movl ebp_stack=stack32#5 -# asm 2: movl ebp_stack=16(%esp) -movl %ebp,16(%esp) - -# qhasm: bytes = arg2 -# asm 1: movl bytes=int32#3 -# asm 2: movl bytes=%edx -movl 8(%esp,%eax),%edx - -# qhasm: out = arg1 -# asm 1: movl out=int32#6 -# asm 2: movl out=%edi -movl 4(%esp,%eax),%edi - -# qhasm: m = out -# asm 1: mov m=int32#5 -# asm 2: mov m=%esi -mov %edi,%esi - -# qhasm: iv = arg4 -# asm 1: movl iv=int32#4 -# asm 2: movl iv=%ebx -movl 16(%esp,%eax),%ebx - -# qhasm: k = arg5 -# asm 1: movl k=int32#7 -# asm 2: movl k=%ebp -movl 20(%esp,%eax),%ebp - -# qhasm: unsigned>? bytes - 0 -# asm 1: cmp $0, -jbe ._done - -# qhasm: a = 0 -# asm 1: mov $0,>a=int32#1 -# asm 2: mov $0,>a=%eax -mov $0,%eax - -# qhasm: i = bytes -# asm 1: mov i=int32#2 -# asm 2: mov i=%ecx -mov %edx,%ecx - -# qhasm: while (i) { *out++ = a; --i } -rep stosb - -# qhasm: out -= bytes -# asm 1: subl b, in->b, len, iv, state->key); + fastd_salsa2012_xmm_xor(out->b, in->b, len, iv, state->key); return true; } -- cgit v1.2.3