Use CRYPTOPP_SSE2_INTRIN_AVAILABLE for consistent naming

pull/462/head
Jeffrey Walton 2017-08-18 02:11:41 -04:00
parent 2a2f6cb7b3
commit a9534a7cf3
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
5 changed files with 11 additions and 11 deletions

View File

@ -7,7 +7,7 @@
#include "misc.h" #include "misc.h"
#include "cpu.h" #include "cpu.h"
#if CRYPTOPP_SSE2_AVAILABLE #if CRYPTOPP_SSE2_INTRIN_AVAILABLE
# define CRYPTOPP_ENABLE_ARIA_SSE2_INTRINSICS 1 # define CRYPTOPP_ENABLE_ARIA_SSE2_INTRINSICS 1
#endif #endif

View File

@ -37,7 +37,7 @@ NAMESPACE_BEGIN(CryptoPP)
// Sun Studio 12.3 and earlier lack SSE2's _mm_set_epi64x. Win32 lacks _mm_set_epi64x, Win64 supplies it except for VS2008. // Sun Studio 12.3 and earlier lack SSE2's _mm_set_epi64x. Win32 lacks _mm_set_epi64x, Win64 supplies it except for VS2008.
// Also see http://stackoverflow.com/a/38547909/608639 // Also see http://stackoverflow.com/a/38547909/608639
#if CRYPTOPP_SSE2_AVAILABLE && ((__SUNPRO_CC >= 0x5100 && __SUNPRO_CC < 0x5130) || (defined(_MSC_VER) && _MSC_VER < 1600) || (defined(_M_IX86) && _MSC_VER >= 1600)) #if CRYPTOPP_SSE2_INTRIN_AVAILABLE && ((__SUNPRO_CC >= 0x5100 && __SUNPRO_CC < 0x5130) || (defined(_MSC_VER) && _MSC_VER < 1600) || (defined(_M_IX86) && _MSC_VER >= 1600))
inline __m128i MM_SET_EPI64X(const word64 a, const word64 b) inline __m128i MM_SET_EPI64X(const word64 a, const word64 b)
{ {
const word64 t[2] = {b,a}; __m128i r; const word64 t[2] = {b,a}; __m128i r;

View File

@ -481,7 +481,7 @@ NAMESPACE_END
#endif #endif
#if !defined(CRYPTOPP_DISABLE_ASM) && (defined(_MSC_VER) || defined(__SSE2__)) #if !defined(CRYPTOPP_DISABLE_ASM) && (defined(_MSC_VER) || defined(__SSE2__))
#define CRYPTOPP_SSE2_AVAILABLE 1 #define CRYPTOPP_SSE2_INTRIN_AVAILABLE 1
#endif #endif
#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SSSE3) #if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SSSE3)
@ -581,7 +581,7 @@ NAMESPACE_END
// ***************** Miscellaneous ******************** // ***************** Miscellaneous ********************
#if CRYPTOPP_SSE2_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || CRYPTOPP_ARM_NEON_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE) #if CRYPTOPP_SSE2_INTRIN_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || CRYPTOPP_ARM_NEON_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)
#define CRYPTOPP_BOOL_ALIGN16 1 #define CRYPTOPP_BOOL_ALIGN16 1
#else #else
#define CRYPTOPP_BOOL_ALIGN16 0 #define CRYPTOPP_BOOL_ALIGN16 0

View File

@ -150,7 +150,7 @@ static bool CPU_ProbeSSE2()
{ {
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE #if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
AS2(por xmm0, xmm0) // executing SSE2 instruction AS2(por xmm0, xmm0) // executing SSE2 instruction
#elif CRYPTOPP_SSE2_AVAILABLE #elif CRYPTOPP_SSE2_INTRIN_AVAILABLE
__m128i x = _mm_setzero_si128(); __m128i x = _mm_setzero_si128();
return _mm_cvtsi128_si32(x) == 0; return _mm_cvtsi128_si32(x) == 0;
#endif #endif
@ -182,7 +182,7 @@ static bool CPU_ProbeSSE2()
{ {
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE #if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
__asm __volatile ("por %xmm0, %xmm0"); __asm __volatile ("por %xmm0, %xmm0");
#elif CRYPTOPP_SSE2_AVAILABLE #elif CRYPTOPP_SSE2_INTRIN_AVAILABLE
__m128i x = _mm_setzero_si128(); __m128i x = _mm_setzero_si128();
result = _mm_cvtsi128_si32(x) == 0; result = _mm_cvtsi128_si32(x) == 0;
#endif #endif

10
gcm.cpp
View File

@ -32,7 +32,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
#if (CRYPTOPP_SSE2_AVAILABLE) #if (CRYPTOPP_SSE2_INTRIN_AVAILABLE)
# include "emmintrin.h" # include "emmintrin.h"
#endif #endif
@ -76,14 +76,14 @@ inline static void Xor16(byte *a, const byte *b, const byte *c)
((word64 *)(void *)a)[1] = ((word64 *)(void *)b)[1] ^ ((word64 *)(void *)c)[1]; ((word64 *)(void *)a)[1] = ((word64 *)(void *)b)[1] ^ ((word64 *)(void *)c)[1];
} }
#if CRYPTOPP_SSE2_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE #if CRYPTOPP_SSE2_INTRIN_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
inline static void GCM_Xor16_SSE2(byte *a, const byte *b, const byte *c) 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
*M128_CAST(a) = _mm_xor_si128(*M128_CAST(b), *M128_CAST(c)); *M128_CAST(a) = _mm_xor_si128(*M128_CAST(b), *M128_CAST(c));
# elif CRYPTOPP_SSE2_AVAILABLE # elif CRYPTOPP_SSE2_INTRIN_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>()));
@ -197,7 +197,7 @@ void GCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const
for (i=0; i<16; i++) for (i=0; i<16; i++)
{ {
memset(mulTable+i*256*16, 0, 16); memset(mulTable+i*256*16, 0, 16);
#if CRYPTOPP_SSE2_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE #if CRYPTOPP_SSE2_INTRIN_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
if (HasSSE2()) if (HasSSE2())
for (j=2; j<=0x80; j*=2) for (j=2; j<=0x80; j*=2)
for (k=1; k<j; k++) for (k=1; k<j; k++)
@ -249,7 +249,7 @@ void GCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const
{ {
memset(mulTable+i*256, 0, 16); memset(mulTable+i*256, 0, 16);
memset(mulTable+1024+i*256, 0, 16); memset(mulTable+1024+i*256, 0, 16);
#if CRYPTOPP_SSE2_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE #if CRYPTOPP_SSE2_INTRIN_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
if (HasSSE2()) if (HasSSE2())
for (j=2; j<=8; j*=2) for (j=2; j<=8; j*=2)
for (k=1; k<j; k++) for (k=1; k<j; k++)