From b848bb238264e0b2b23ccb5543a9588e02575ddd Mon Sep 17 00:00:00 2001 From: Jens Wiklander Date: Fri, 9 Nov 2018 13:22:05 +0100 Subject: LTC: drop LTC_NO_ASM and configure Drops LTC_NO_ASM and configures endian and word size accordingly, that is, little endian and 32-bit or 64-bit depending on arm architecture. Defines ulong32 and ulong64 based on uint32_t and uint64_t to make sure that the types are always defined correctly. Reviewed-by: Jerome Forissier Signed-off-by: Jens Wiklander --- core/lib/libtomcrypt/include/tomcrypt_custom.h | 17 ++++++++++++++++- core/lib/libtomcrypt/include/tomcrypt_macros.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'core/lib') diff --git a/core/lib/libtomcrypt/include/tomcrypt_custom.h b/core/lib/libtomcrypt/include/tomcrypt_custom.h index 2fbb7a11..d4f8de1a 100644 --- a/core/lib/libtomcrypt/include/tomcrypt_custom.h +++ b/core/lib/libtomcrypt/include/tomcrypt_custom.h @@ -275,7 +275,7 @@ #define LTC_NO_FILE /* disable all forms of ASM */ -#define LTC_NO_ASM +/* #define LTC_NO_ASM */ /* disable FAST mode */ /* #define LTC_NO_FAST */ @@ -535,6 +535,21 @@ /* define this if you use Valgrind, note: it CHANGES the way SOBER-128 and LTC_RC4 work (see the code) */ /* #define LTC_VALGRIND */ +#if defined(ARM32) || defined(ARM64) +#define ENDIAN_LITTLE +#endif +#ifdef ARM32 +#define ENDIAN_32BITWORD +#endif +#ifdef ARM64 +#define ENDIAN_64BITWORD +#endif + +#define LTC_ULONGXX_DEFINED +typedef uint32_t ulong32; +typedef uint64_t ulong64; +#define CONST64(x) UINT64_C(x) + #endif diff --git a/core/lib/libtomcrypt/include/tomcrypt_macros.h b/core/lib/libtomcrypt/include/tomcrypt_macros.h index 895c12e6..8b94b80a 100644 --- a/core/lib/libtomcrypt/include/tomcrypt_macros.h +++ b/core/lib/libtomcrypt/include/tomcrypt_macros.h @@ -29,6 +29,7 @@ #ifndef TOMCRYPT_MACROS_H_ #define TOMCRYPT_MACROS_H_ +#ifndef LTC_ULONGXX_DEFINED /* fix for MSVC ...evil! */ #ifdef _MSC_VER #define CONST64(n) n ## ui64 @@ -47,6 +48,7 @@ #else typedef unsigned long ulong32; #endif +#endif #ifdef ENDIAN_64BITWORD typedef ulong64 ltc_mp_digit; -- cgit v1.2.3