[PATCH 1/5] Fix building with x86-64 medium and large memory models

Jussi Kivilinna jussi.kivilinna at iki.fi
Thu May 18 19:27:29 CEST 2017


* cipher/cast5-amd64.S [HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS]
(GET_EXTERN_POINTER): Load 64-bit address instead of 32-bit.
* cipher/rijndael.c (do_encrypt, do_decrypt)
[USE_AMD64_ASM && !HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS]: Load
table pointer through register instead of generic reference.
--

Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 cipher/cast5-amd64.S |    2 +-
 cipher/rijndael.c    |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cipher/cast5-amd64.S b/cipher/cast5-amd64.S
index a5f078e3..608fb64e 100644
--- a/cipher/cast5-amd64.S
+++ b/cipher/cast5-amd64.S
@@ -24,7 +24,7 @@
      defined(HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS)) && defined(USE_CAST5)
 
 #if defined(HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS) || !defined(__PIC__)
-#  define GET_EXTERN_POINTER(name, reg) leaq name, reg
+#  define GET_EXTERN_POINTER(name, reg) movabsq $name, reg
 #else
 #  define GET_EXTERN_POINTER(name, reg) movq name at GOTPCREL(%rip), reg
 #endif
diff --git a/cipher/rijndael.c b/cipher/rijndael.c
index 66ea0f3a..8637195a 100644
--- a/cipher/rijndael.c
+++ b/cipher/rijndael.c
@@ -752,7 +752,7 @@ do_encrypt (const RIJNDAEL_context *ctx,
                   "+d" (ax),
                   "+c" (rounds)
                 : "0" (_gcry_aes_amd64_encrypt_block),
-                  [encT] "g" (encT)
+                  [encT] "r" (encT)
                 : "cc", "memory", "r8", "r9", "r10", "r11");
   return ret;
 # endif /* HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS */
@@ -1135,7 +1135,7 @@ do_decrypt (const RIJNDAEL_context *ctx, unsigned char *bx,
                   "+d" (ax),
                   "+c" (rounds)
                 : "0" (_gcry_aes_amd64_decrypt_block),
-                  [dectabs] "g" (&dec_tables)
+                  [dectabs] "r" (&dec_tables)
                 : "cc", "memory", "r8", "r9", "r10", "r11");
   return ret;
 # endif /* HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS */




More information about the Gcrypt-devel mailing list