Fix sources after sync with upstream master

pull/461/head
Jeffrey Walton 2017-08-13 07:06:19 -04:00
parent e0ec92b541
commit 011429583d
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 6 additions and 10 deletions

12
gcm.cpp
View File

@ -23,10 +23,6 @@
// # undef CRYPTOPP_CLMUL_AVAILABLE // # undef CRYPTOPP_CLMUL_AVAILABLE
// #endif // #endif
// Clang casts
#define M128I_CAST(x) ((__m128i *)(void *)(x))
#define CONST_M128I_CAST(x) ((const __m128i *)(const void *)(x))
#include "gcm.h" #include "gcm.h"
#include "cpu.h" #include "cpu.h"
@ -53,6 +49,10 @@ NAMESPACE_BEGIN(CryptoPP)
#endif #endif
#endif #endif
// Clang __m128i casts
#define M128_CAST(x) ((__m128i *)(void *)(x))
#define CONST_M128_CAST(x) ((const __m128i *)(const void *)(x))
#if CRYPTOPP_ARM_NEON_AVAILABLE #if CRYPTOPP_ARM_NEON_AVAILABLE
extern void GCM_Xor16_NEON(byte *a, const byte *b, const byte *c); extern void GCM_Xor16_NEON(byte *a, const byte *b, const byte *c);
#endif #endif
@ -80,12 +80,12 @@ inline static void GCM_Xor16_SSE2(byte *a, const byte *b, const byte *c)
// SunCC 5.14 crash (bewildering since asserts are not in effect in release builds) // SunCC 5.14 crash (bewildering since asserts are not in effect in release builds)
// Also see http://github.com/weidai11/cryptopp/issues/226 and http://github.com/weidai11/cryptopp/issues/284 // Also see http://github.com/weidai11/cryptopp/issues/226 and http://github.com/weidai11/cryptopp/issues/284
# if __SUNPRO_CC # if __SUNPRO_CC
*(__m128i *)(void *)a = _mm_xor_si128(*(__m128i *)(void *)b, *(__m128i *)(void *)c); *M128_CAST(a) = _mm_xor_si128(*M128_CAST(b), *M128_CAST(c));
# elif CRYPTOPP_SSE2_AVAILABLE # elif CRYPTOPP_SSE2_AVAILABLE
CRYPTOPP_ASSERT(IsAlignedOn(a,GetAlignmentOf<__m128i>())); CRYPTOPP_ASSERT(IsAlignedOn(a,GetAlignmentOf<__m128i>()));
CRYPTOPP_ASSERT(IsAlignedOn(b,GetAlignmentOf<__m128i>())); CRYPTOPP_ASSERT(IsAlignedOn(b,GetAlignmentOf<__m128i>()));
CRYPTOPP_ASSERT(IsAlignedOn(c,GetAlignmentOf<__m128i>())); CRYPTOPP_ASSERT(IsAlignedOn(c,GetAlignmentOf<__m128i>()));
*M128I_CAST(a) = _mm_xor_si128(*M128I_CAST(b), *M128I_CAST(c)); *M128_CAST(a) = _mm_xor_si128(*M128_CAST(b), *M128_CAST(c));
# else # else
asm ("movdqa %1, %%xmm0; pxor %2, %%xmm0; movdqa %%xmm0, %0;" : "=m" (a[0]) : "m"(b[0]), "m"(c[0])); asm ("movdqa %1, %%xmm0; pxor %2, %%xmm0; movdqa %%xmm0, %0;" : "=m" (a[0]) : "m"(b[0]), "m"(c[0]));
# endif # endif

View File

@ -92,10 +92,6 @@ NAMESPACE_BEGIN(CryptoPP)
# define MAYBE_CONST const # define MAYBE_CONST const
#endif #endif
// Clang casts
#define M128I_CAST(x) ((__m128i *)(void *)(x))
#define CONST_M128I_CAST(x) ((const __m128i *)(const void *)(x))
#if defined(CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS) || defined(CRYPTOPP_ALLOW_RIJNDAEL_UNALIGNED_DATA_ACCESS) #if defined(CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS) || defined(CRYPTOPP_ALLOW_RIJNDAEL_UNALIGNED_DATA_ACCESS)
# if (CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)) && !defined(CRYPTOPP_DISABLE_RIJNDAEL_ASM) # if (CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)) && !defined(CRYPTOPP_DISABLE_RIJNDAEL_ASM)
namespace rdtable {CRYPTOPP_ALIGN_DATA(16) word64 Te[256+2];} namespace rdtable {CRYPTOPP_ALIGN_DATA(16) word64 Te[256+2];}