diff --git a/config.h b/config.h index 485b8d09..9e881586 100644 --- a/config.h +++ b/config.h @@ -182,7 +182,7 @@ NAMESPACE_END #ifndef CRYPTOPP_ALIGN_DATA #if defined(CRYPTOPP_MSVC6PP_OR_LATER) #define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x)) - #elif defined(__GNUC__) || __SUNPRO_CC > 0x590 + #elif defined(__GNUC__) #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x))) #else #define CRYPTOPP_ALIGN_DATA(x) diff --git a/eax.h b/eax.h index eeacd4c9..e78401e4 100644 --- a/eax.h +++ b/eax.h @@ -72,7 +72,11 @@ public: private: CMAC_Base & AccessMAC() {return m_cmac;} CMAC m_cmac; -}; +}; + +#ifdef EAX // EAX is defined to 11 on GCC 3.4.3, OpenSolaris 8.11 +#undef EAX +#endif /// EAX template diff --git a/rijndael.cpp b/rijndael.cpp index d6b267a6..e10b3df9 100644 --- a/rijndael.cpp +++ b/rijndael.cpp @@ -69,6 +69,10 @@ being unloaded from L1 cache, until that round is finished. #include "misc.h" #include "cpu.h" +#ifdef __sun +#include +#endif + NAMESPACE_BEGIN(CryptoPP) #ifdef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS diff --git a/salsa.cpp b/salsa.cpp index 57576dcc..bd216eec 100755 --- a/salsa.cpp +++ b/salsa.cpp @@ -11,10 +11,6 @@ #include "argnames.h" #include "cpu.h" -#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE -#include -#endif - NAMESPACE_BEGIN(CryptoPP) void Salsa20_TestInstantiations() @@ -136,7 +132,7 @@ void Salsa20_Policy::OperateKeystream(KeystreamOperation operation, byte *output #define REG_temp rdx #define SSE2_WORKSPACE %5 - __m128i workspace[32]; + FixedSizeAlignedSecBlock workspace; #else #define REG_output edi #define REG_input eax @@ -463,7 +459,7 @@ void Salsa20_Policy::OperateKeystream(KeystreamOperation operation, byte *output ".att_syntax prefix;" : #if CRYPTOPP_BOOL_X64 - : "r" (m_rounds), "r" (input), "r" (iterationCount), "r" (m_state.data()), "r" (output), "r" (workspace) + : "r" (m_rounds), "r" (input), "r" (iterationCount), "r" (m_state.data()), "r" (output), "r" (workspace.m_ptr) : "%eax", "%edx", "memory", "cc", "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7", "%xmm8", "%xmm9", "%xmm10", "%xmm11", "%xmm12", "%xmm13", "%xmm14", "%xmm15" #else : "d" (m_rounds), "a" (input), "c" (iterationCount), "S" (m_state.data()), "D" (output) diff --git a/sha.cpp b/sha.cpp index b125127b..a0f696c6 100644 --- a/sha.cpp +++ b/sha.cpp @@ -14,10 +14,6 @@ #include "misc.h" #include "cpu.h" -#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE -#include -#endif - NAMESPACE_BEGIN(CryptoPP) // start of Steve Reid's code @@ -230,12 +226,12 @@ static void CRYPTOPP_FASTCALL X86_SHA256_HashBlocks(word32 *state, const word32 #if defined(__GNUC__) #if CRYPTOPP_BOOL_X64 - __m128i workspace[(LOCALS_SIZE+15)/16]; + FixedSizeAlignedSecBlock workspace; #endif __asm__ __volatile__ ( #if CRYPTOPP_BOOL_X64 - "movq %4, %%r8;" + "lea %4, %%r8;" #endif ".intel_syntax noprefix;" #elif defined(CRYPTOPP_GENERATE_X64_MASM) @@ -420,7 +416,7 @@ static void CRYPTOPP_FASTCALL X86_SHA256_HashBlocks(word32 *state, const word32 : : "c" (state), "d" (data), "S" (SHA256_K+48), "D" (len) #if CRYPTOPP_BOOL_X64 - , "r" (workspace) + , "m" (workspace[0]) #endif : "memory", "cc", "%eax" #if CRYPTOPP_BOOL_X64 diff --git a/sosemanuk.cpp b/sosemanuk.cpp index e0e411f1..08636755 100755 --- a/sosemanuk.cpp +++ b/sosemanuk.cpp @@ -12,10 +12,6 @@ #include "serpentp.h" -#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE -#include -#endif - NAMESPACE_BEGIN(CryptoPP) void SosemanukPolicy::CipherSetKey(const NameValuePairs ¶ms, const byte *userKey, size_t keylen) @@ -353,7 +349,7 @@ void SosemanukPolicy::OperateKeystream(KeystreamOperation operation, byte *outpu { #ifdef __GNUC__ #if CRYPTOPP_BOOL_X64 - __m128i workspace[(80*4*2+12*4+8*WORD_SZ)/16]; + FixedSizeAlignedSecBlock workspace; #endif __asm__ __volatile__ ( @@ -601,8 +597,8 @@ void SosemanukPolicy::OperateKeystream(KeystreamOperation operation, byte *outpu : : "a" (m_state.m_ptr), "c" (iterationCount), "S" (s_sosemanukMulTables), "D" (output), "d" (input) #if CRYPTOPP_BOOL_X64 - , "r" (workspace) - : "memory", "cc", "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7" + , "r" (workspace.m_ptr) + : "memory", "cc", "%r9", "%r10", "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7" #else : "memory", "cc" #endif diff --git a/whrlpool.cpp b/whrlpool.cpp index 1ebdecd3..9da12e3d 100644 --- a/whrlpool.cpp +++ b/whrlpool.cpp @@ -68,10 +68,6 @@ #include "misc.h" #include "cpu.h" -#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE -#include -#endif - NAMESPACE_BEGIN(CryptoPP) void Whirlpool_TestInstantiations() @@ -401,7 +397,7 @@ void Whirlpool::Transform(word64 *digest, const word64 *block) // MMX version has the same structure as C version below #ifdef __GNUC__ #if CRYPTOPP_BOOL_X64 - __m128i workspace[8]; + word64 workspace[16]; #endif __asm__ __volatile__ (