summaryrefslogtreecommitdiff
path: root/cipher/camellia-aarch64.S
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2018-03-22 23:32:40 +0200
committerJussi Kivilinna <jussi.kivilinna@iki.fi>2018-03-28 20:37:54 +0300
commit0de2191a07d69ef1fa34ca4c5d5fc4985ff7b4c4 (patch)
tree6bf7cbde10cc048996520a00264f84856b54b3ca /cipher/camellia-aarch64.S
parent4e1b628f492643d4e9b830bcdab7b49daaec5854 (diff)
downloadlibgcrypt-0de2191a07d69ef1fa34ca4c5d5fc4985ff7b4c4.tar.gz
aarch64: Enable building the aarch64 cipher assembly for windows
* cipher/asm-common-aarch64.h: New. * cipher/camellia-aarch64.S: Use ELF macro, use x19 instead of x18. * cipher/chacha20-aarch64.S: Use ELF macro, don't use GOT on windows. * cipher/cipher-gcm-armv8-aarch64-ce.S: Use ELF macro. * cipher/rijndael-aarch64.S: Use ELF macro. * cipher/rijndael-armv8-aarch64-ce.S: Use ELF macro. * cipher/sha1-armv8-aarch64-ce.S: Use ELF macro. * cipher/sha256-armv8-aarch64-ce.S: Use ELF macro. * cipher/twofish-aarch64.S: Use ELF macro. * configure.ac: Don't require .size and .type in aarch64 assembly check. -- Don't require .type and .size in configure; we can make them optional via a preprocessor macro. This is mostly a mechanical change, wrapping the .type and .size directives in an ELF() macro, with two actual manual changes: (when targeting windows): - Don't load global symbols via a GOT (in chacha20) - Don't use the x18 register (in camellia); back up and restore x19 in the prologue/epilogue and use that instead. x18 is a platform specific register; on linux, it's free to be used by user code, while it's reserved for platform use on windows and darwin. Always use x19 instead of x18 for consistency. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'cipher/camellia-aarch64.S')
-rw-r--r--cipher/camellia-aarch64.S23
1 files changed, 14 insertions, 9 deletions
diff --git a/cipher/camellia-aarch64.S b/cipher/camellia-aarch64.S
index 68d2a7d4..c3cc463d 100644
--- a/cipher/camellia-aarch64.S
+++ b/cipher/camellia-aarch64.S
@@ -19,7 +19,7 @@
* License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#include <config.h>
+#include "asm-common-aarch64.h"
#if defined(__AARCH64EL__)
#ifdef HAVE_COMPATIBLE_GCC_AARCH64_PLATFORM_AS
@@ -55,12 +55,12 @@
#define RT0 w15
#define RT1 w16
#define RT2 w17
-#define RT3 w18
+#define RT3 w19
#define xRT0 x15
#define xRT1 x16
#define xRT2 x17
-#define xRT3 x18
+#define xRT3 x19
#ifdef __AARCH64EL__
#define host_to_be(reg, rtmp) \
@@ -198,9 +198,10 @@
str_output_be(RDST, YL, YR, XL, XR, RT0, RT1);
.globl _gcry_camellia_arm_encrypt_block
-.type _gcry_camellia_arm_encrypt_block,@function;
+ELF(.type _gcry_camellia_arm_encrypt_block,@function;)
_gcry_camellia_arm_encrypt_block:
+ stp x19, x30, [sp, #-16]!
/* input:
* x0: keytable
* x1: dst
@@ -227,6 +228,7 @@ _gcry_camellia_arm_encrypt_block:
outunpack(24);
+ ldp x19, x30, [sp], #16
ret;
.ltorg
@@ -236,14 +238,16 @@ _gcry_camellia_arm_encrypt_block:
outunpack(32);
+ ldp x19, x30, [sp], #16
ret;
.ltorg
-.size _gcry_camellia_arm_encrypt_block,.-_gcry_camellia_arm_encrypt_block;
+ELF(.size _gcry_camellia_arm_encrypt_block,.-_gcry_camellia_arm_encrypt_block;)
.globl _gcry_camellia_arm_decrypt_block
-.type _gcry_camellia_arm_decrypt_block,@function;
+ELF(.type _gcry_camellia_arm_decrypt_block,@function;)
_gcry_camellia_arm_decrypt_block:
+ stp x19, x30, [sp, #-16]!
/* input:
* x0: keytable
* x1: dst
@@ -271,6 +275,7 @@ _gcry_camellia_arm_decrypt_block:
outunpack(0);
+ ldp x19, x30, [sp], #16
ret;
.ltorg
@@ -281,11 +286,11 @@ _gcry_camellia_arm_decrypt_block:
b .Ldec_128;
.ltorg
-.size _gcry_camellia_arm_decrypt_block,.-_gcry_camellia_arm_decrypt_block;
+ELF(.size _gcry_camellia_arm_decrypt_block,.-_gcry_camellia_arm_decrypt_block;)
/* Encryption/Decryption tables */
.globl _gcry_camellia_arm_tables
-.type _gcry_camellia_arm_tables,@object;
+ELF(.type _gcry_camellia_arm_tables,@object;)
.balign 32
_gcry_camellia_arm_tables:
.Lcamellia_sp1110:
@@ -551,7 +556,7 @@ _gcry_camellia_arm_tables:
.long 0xc7c7c700, 0x008f8f8f, 0xe300e3e3, 0xf4f400f4
.long 0x80808000, 0x00010101, 0x40004040, 0xc7c700c7
.long 0x9e9e9e00, 0x003d3d3d, 0x4f004f4f, 0x9e9e009e
-.size _gcry_camellia_arm_tables,.-_gcry_camellia_arm_tables;
+ELF(.size _gcry_camellia_arm_tables,.-_gcry_camellia_arm_tables;)
#endif /*HAVE_COMPATIBLE_GCC_AARCH64_PLATFORM_AS*/
#endif /*__AARCH64EL__*/