summaryrefslogtreecommitdiff
path: root/cipher/blowfish.c
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@iki.fi>2018-01-06 22:19:56 +0200
committerJussi Kivilinna <jussi.kivilinna@iki.fi>2018-01-09 19:18:15 +0200
commita518b6680ea80a4325731028545a701c1d71fc02 (patch)
tree8175316a4c8b4f08b9c78a2ff636bc7c7ce34c71 /cipher/blowfish.c
parent135250e3060e79be698d4f36a819aa8a880789f8 (diff)
downloadlibgcrypt-a518b6680ea80a4325731028545a701c1d71fc02.tar.gz
Move AMD64 MS to SysV calling convention conversion to assembly side
* cipher/Makefile.am: Add 'asm-common-amd64.h'. * cipher/asm-common-amd64.h: New. * cipher/blowfish-amd64.S: Add ENTER_SYSV_FUNC_* and EXIT_SYSV_FUNC for each global function from 'asm-common-amd64.h'. * cipher/cast5-amd64.S: Ditto. * cipher/des-amd64.S: Ditto. * cipher/rijndael-amd64.S: Ditto. * cipher/twofish-amd64.S: Ditto. * cipher/arcfour-amd64.S: Ditto. * cipher/blowfish.c [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS] (call_sysv_fn): Remove. * cipher/cast5.c [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS] (call_sysv_fn): Remove. * cipher/twofish.c [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS] (call_sysv_fn, call_sysv_fn5, call_sysv_fn6): Remove. * cipher/rijndael.c (do_encrypt, do_decrypt) [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS]: Remove assembly block for calling SysV ABI function. * cipher/arcfour.c [USE_AMD64_ASM] (encrypt_stream): Ditto. -- Old approach was to convert MS ABI to SysV ABI calling convention for AMD64 assembly functions at caller side. This patch moves calling convention conversion to assembly/callee side. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'cipher/blowfish.c')
-rw-r--r--cipher/blowfish.c44
1 files changed, 0 insertions, 44 deletions
diff --git a/cipher/blowfish.c b/cipher/blowfish.c
index a3fc26ce..724d64e9 100644
--- a/cipher/blowfish.c
+++ b/cipher/blowfish.c
@@ -281,87 +281,43 @@ extern void _gcry_blowfish_amd64_cbc_dec(BLOWFISH_context *ctx, byte *out,
extern void _gcry_blowfish_amd64_cfb_dec(BLOWFISH_context *ctx, byte *out,
const byte *in, byte *iv);
-#ifdef HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS
-static inline void
-call_sysv_fn (const void *fn, const void *arg1, const void *arg2,
- const void *arg3, const void *arg4)
-{
- /* Call SystemV ABI function without storing non-volatile XMM registers,
- * as target function does not use vector instruction sets. */
- asm volatile ("callq *%0\n\t"
- : "+a" (fn),
- "+D" (arg1),
- "+S" (arg2),
- "+d" (arg3),
- "+c" (arg4)
- :
- : "cc", "memory", "r8", "r9", "r10", "r11");
-}
-#endif
-
static void
do_encrypt ( BLOWFISH_context *bc, u32 *ret_xl, u32 *ret_xr )
{
-#ifdef HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS
- call_sysv_fn (_gcry_blowfish_amd64_do_encrypt, bc, ret_xl, ret_xr, NULL);
-#else
_gcry_blowfish_amd64_do_encrypt (bc, ret_xl, ret_xr);
-#endif
}
static void
do_encrypt_block (BLOWFISH_context *context, byte *outbuf, const byte *inbuf)
{
-#ifdef HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS
- call_sysv_fn (_gcry_blowfish_amd64_encrypt_block, context, outbuf, inbuf,
- NULL);
-#else
_gcry_blowfish_amd64_encrypt_block (context, outbuf, inbuf);
-#endif
}
static void
do_decrypt_block (BLOWFISH_context *context, byte *outbuf, const byte *inbuf)
{
-#ifdef HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS
- call_sysv_fn (_gcry_blowfish_amd64_decrypt_block, context, outbuf, inbuf,
- NULL);
-#else
_gcry_blowfish_amd64_decrypt_block (context, outbuf, inbuf);
-#endif
}
static inline void
blowfish_amd64_ctr_enc(BLOWFISH_context *ctx, byte *out, const byte *in,
byte *ctr)
{
-#ifdef HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS
- call_sysv_fn (_gcry_blowfish_amd64_ctr_enc, ctx, out, in, ctr);
-#else
_gcry_blowfish_amd64_ctr_enc(ctx, out, in, ctr);
-#endif
}
static inline void
blowfish_amd64_cbc_dec(BLOWFISH_context *ctx, byte *out, const byte *in,
byte *iv)
{
-#ifdef HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS
- call_sysv_fn (_gcry_blowfish_amd64_cbc_dec, ctx, out, in, iv);
-#else
_gcry_blowfish_amd64_cbc_dec(ctx, out, in, iv);
-#endif
}
static inline void
blowfish_amd64_cfb_dec(BLOWFISH_context *ctx, byte *out, const byte *in,
byte *iv)
{
-#ifdef HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS
- call_sysv_fn (_gcry_blowfish_amd64_cfb_dec, ctx, out, in, iv);
-#else
_gcry_blowfish_amd64_cfb_dec(ctx, out, in, iv);
-#endif
}
static unsigned int