summaryrefslogtreecommitdiff
path: root/cipher/salsa20-amd64.S
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@iki.fi>2015-05-14 12:37:21 +0300
committerJussi Kivilinna <jussi.kivilinna@iki.fi>2015-05-14 14:10:28 +0300
commit12bc93ca8187b8061c2e705427ef22f5a71d29b0 (patch)
tree6f13fd580e6a6a67630207a9e126ff6deca01e06 /cipher/salsa20-amd64.S
parent8d7de4dbf7732c6eb9e9853ad7c19c89075ace6f (diff)
downloadlibgcrypt-12bc93ca8187b8061c2e705427ef22f5a71d29b0.tar.gz
Enable AMD64 Salsa20 implementation on WIN64
* cipher/salsa20-amd64.S: Enable when HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined. (ELF): New macro to mask lines with ELF specific commands. * cipher/salsa20.c (USE_AMD64): Enable when HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined. [USE_AMD64] (ASM_FUNC_ABI, ASM_EXTRA_STACK): New. (_gcry_salsa20_amd64_keysetup, _gcry_salsa20_amd64_ivsetup) (_gcry_salsa20_amd64_encrypt_blocks): Add ASM_FUNC_ABI. [USE_AMD64] (salsa20_core): Add ASM_EXTRA_STACK. (salsa20_do_encrypt_stream) [USE_AMD64]: Add ASM_EXTRA_STACK. -- Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'cipher/salsa20-amd64.S')
-rw-r--r--cipher/salsa20-amd64.S17
1 files changed, 12 insertions, 5 deletions
diff --git a/cipher/salsa20-amd64.S b/cipher/salsa20-amd64.S
index 7046dbbb..470c32aa 100644
--- a/cipher/salsa20-amd64.S
+++ b/cipher/salsa20-amd64.S
@@ -25,13 +25,20 @@
#ifdef __x86_64
#include <config.h>
-#if defined(HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS) && defined(USE_SALSA20)
+#if (defined(HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS) || \
+ defined(HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS)) && defined(USE_SALSA20)
+
+#ifdef HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS
+# define ELF(...) __VA_ARGS__
+#else
+# define ELF(...) /*_*/
+#endif
.text
.align 8
.globl _gcry_salsa20_amd64_keysetup
-.type _gcry_salsa20_amd64_keysetup,@function;
+ELF(.type _gcry_salsa20_amd64_keysetup,@function;)
_gcry_salsa20_amd64_keysetup:
movl 0(%rsi),%r8d
movl 4(%rsi),%r9d
@@ -83,7 +90,7 @@ _gcry_salsa20_amd64_keysetup:
.align 8
.globl _gcry_salsa20_amd64_ivsetup
-.type _gcry_salsa20_amd64_ivsetup,@function;
+ELF(.type _gcry_salsa20_amd64_ivsetup,@function;)
_gcry_salsa20_amd64_ivsetup:
movl 0(%rsi),%r8d
movl 4(%rsi),%esi
@@ -97,7 +104,7 @@ _gcry_salsa20_amd64_ivsetup:
.align 8
.globl _gcry_salsa20_amd64_encrypt_blocks
-.type _gcry_salsa20_amd64_encrypt_blocks,@function;
+ELF(.type _gcry_salsa20_amd64_encrypt_blocks,@function;)
_gcry_salsa20_amd64_encrypt_blocks:
/*
* Modifications to original implementation:
@@ -918,7 +925,7 @@ _gcry_salsa20_amd64_encrypt_blocks:
add $64,%rdi
add $64,%rsi
jmp .L_bytes_are_64_128_or_192
-.size _gcry_salsa20_amd64_encrypt_blocks,.-_gcry_salsa20_amd64_encrypt_blocks;
+ELF(.size _gcry_salsa20_amd64_encrypt_blocks,.-_gcry_salsa20_amd64_encrypt_blocks;)
#endif /*defined(USE_SALSA20)*/
#endif /*__x86_64*/