summaryrefslogtreecommitdiff
path: root/cipher/des-amd64.S
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@iki.fi>2015-05-14 10:31:18 +0300
committerJussi Kivilinna <jussi.kivilinna@iki.fi>2015-05-14 14:10:28 +0300
commitb65e9e71d5ee992db5c96793c6af999545daad28 (patch)
treeea3ba289c53cb95567c6a42cc066567f62bf19ef /cipher/des-amd64.S
parent9597cfddf03c467825da152be5ca0d12a8c30d88 (diff)
downloadlibgcrypt-b65e9e71d5ee992db5c96793c6af999545daad28.tar.gz
Enable AMD64 3DES implementation on WIN64
* cipher/des-amd64.S: Enable when HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined. (ELF): New macro to mask lines with ELF specific commands. * cipher/des.c (USE_AMD64_ASM): Enable when HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS defined. [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS] (call_sysv_fn): New. (tripledes_ecb_crypt) [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS]: Call assembly function through 'call_sysv_fn'. (tripledes_amd64_ctr_enc, tripledes_amd64_cbc_dec) (tripledes_amd64_cfb_dec): New wrapper functions for bulk assembly functions. -- Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'cipher/des-amd64.S')
-rw-r--r--cipher/des-amd64.S29
1 files changed, 18 insertions, 11 deletions
diff --git a/cipher/des-amd64.S b/cipher/des-amd64.S
index e8b2c568..307d2112 100644
--- a/cipher/des-amd64.S
+++ b/cipher/des-amd64.S
@@ -20,7 +20,8 @@
#ifdef __x86_64
#include <config.h>
-#if defined(USE_DES) && defined(HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS)
+#if defined(USE_DES) && (defined(HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS) || \
+ defined(HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS))
#ifdef __PIC__
# define RIP (%rip)
@@ -28,6 +29,12 @@
# define RIP
#endif
+#ifdef HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS
+# define ELF(...) __VA_ARGS__
+#else
+# define ELF(...) /*_*/
+#endif
+
.text
#define s1 0
@@ -185,7 +192,7 @@
.align 8
.globl _gcry_3des_amd64_crypt_block
-.type _gcry_3des_amd64_crypt_block,@function;
+ELF(.type _gcry_3des_amd64_crypt_block,@function;)
_gcry_3des_amd64_crypt_block:
/* input:
@@ -271,7 +278,7 @@ _gcry_3des_amd64_crypt_block:
popq %rbp;
ret;
-.size _gcry_3des_amd64_crypt_block,.-_gcry_3des_amd64_crypt_block;
+ELF(.size _gcry_3des_amd64_crypt_block,.-_gcry_3des_amd64_crypt_block;)
/***********************************************************************
* 3-way 3DES
@@ -458,7 +465,7 @@ _gcry_3des_amd64_crypt_block:
movl right##d, 4(io);
.align 8
-.type _gcry_3des_amd64_crypt_blk3,@function;
+ELF(.type _gcry_3des_amd64_crypt_blk3,@function;)
_gcry_3des_amd64_crypt_blk3:
/* input:
* %rdi: round keys, CTX
@@ -528,11 +535,11 @@ _gcry_3des_amd64_crypt_blk3:
final_permutation3(RR, RL);
ret;
-.size _gcry_3des_amd64_crypt_blk3,.-_gcry_3des_amd64_crypt_blk3;
+ELF(.size _gcry_3des_amd64_crypt_blk3,.-_gcry_3des_amd64_crypt_blk3;)
.align 8
.globl _gcry_3des_amd64_cbc_dec
-.type _gcry_3des_amd64_cbc_dec,@function;
+ELF(.type _gcry_3des_amd64_cbc_dec,@function;)
_gcry_3des_amd64_cbc_dec:
/* input:
* %rdi: ctx, CTX
@@ -604,11 +611,11 @@ _gcry_3des_amd64_cbc_dec:
popq %rbp;
ret;
-.size _gcry_3des_amd64_cbc_dec,.-_gcry_3des_amd64_cbc_dec;
+ELF(.size _gcry_3des_amd64_cbc_dec,.-_gcry_3des_amd64_cbc_dec;)
.align 8
.globl _gcry_3des_amd64_ctr_enc
-.type _gcry_3des_amd64_ctr_enc,@function;
+ELF(.type _gcry_3des_amd64_ctr_enc,@function;)
_gcry_3des_amd64_ctr_enc:
/* input:
* %rdi: ctx, CTX
@@ -682,11 +689,11 @@ _gcry_3des_amd64_ctr_enc:
popq %rbp;
ret;
-.size _gcry_3des_amd64_cbc_dec,.-_gcry_3des_amd64_cbc_dec;
+ELF(.size _gcry_3des_amd64_cbc_dec,.-_gcry_3des_amd64_cbc_dec;)
.align 8
.globl _gcry_3des_amd64_cfb_dec
-.type _gcry_3des_amd64_cfb_dec,@function;
+ELF(.type _gcry_3des_amd64_cfb_dec,@function;)
_gcry_3des_amd64_cfb_dec:
/* input:
* %rdi: ctx, CTX
@@ -757,7 +764,7 @@ _gcry_3des_amd64_cfb_dec:
popq %rbx;
popq %rbp;
ret;
-.size _gcry_3des_amd64_cfb_dec,.-_gcry_3des_amd64_cfb_dec;
+ELF(.size _gcry_3des_amd64_cfb_dec,.-_gcry_3des_amd64_cfb_dec;)
.data
.align 16