From 30fc56d58c3345e93a93510e15d5c98733f1956a Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Wed, 1 May 2019 12:54:25 -0400 Subject: [PATCH] Clear alignment warnings on ARM 32-bit platforms --- tweetnacl.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tweetnacl.cpp b/tweetnacl.cpp index c7547183..71d80e70 100644 --- a/tweetnacl.cpp +++ b/tweetnacl.cpp @@ -15,6 +15,14 @@ # pragma warning(disable: 4146 4242 4244 4245) #endif +// Can't use GetAlignmentOf() because of C++11 and constexpr +// Can use 'const unsigned int' because of MSVC 2013 +#if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64) +# define ALIGN_SPEC 16 +#else +# define ALIGN_SPEC 4 +#endif + #ifndef CRYPTOPP_DISABLE_NACL NAMESPACE_BEGIN(CryptoPP) @@ -417,7 +425,7 @@ static void pow2523(gf o,const gf i) // https://github.com/jedisct1/libsodium/blob/master/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c static int has_small_order(const byte s[32]) { - CRYPTOPP_ALIGN_DATA(16) + CRYPTOPP_ALIGN_DATA(ALIGN_SPEC) const byte blacklist[][32] = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },