fix compile on OpenSolaris 8.11

pull/2/head
weidai 2009-03-13 11:15:21 +00:00
parent 393a5eac05
commit 3202bf2809
7 changed files with 19 additions and 27 deletions

View File

@ -182,7 +182,7 @@ NAMESPACE_END
#ifndef CRYPTOPP_ALIGN_DATA #ifndef CRYPTOPP_ALIGN_DATA
#if defined(CRYPTOPP_MSVC6PP_OR_LATER) #if defined(CRYPTOPP_MSVC6PP_OR_LATER)
#define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x)) #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))) #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
#else #else
#define CRYPTOPP_ALIGN_DATA(x) #define CRYPTOPP_ALIGN_DATA(x)

4
eax.h
View File

@ -74,6 +74,10 @@ private:
CMAC<T_BlockCipher> m_cmac; CMAC<T_BlockCipher> m_cmac;
}; };
#ifdef EAX // EAX is defined to 11 on GCC 3.4.3, OpenSolaris 8.11
#undef EAX
#endif
/// <a href="http://www.cryptolounge.org/wiki/EAX">EAX</a> /// <a href="http://www.cryptolounge.org/wiki/EAX">EAX</a>
template <class T_BlockCipher> template <class T_BlockCipher>
struct EAX : public AuthenticatedSymmetricCipherDocumentation struct EAX : public AuthenticatedSymmetricCipherDocumentation

View File

@ -69,6 +69,10 @@ being unloaded from L1 cache, until that round is finished.
#include "misc.h" #include "misc.h"
#include "cpu.h" #include "cpu.h"
#ifdef __sun
#include <alloca.h>
#endif
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
#ifdef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS #ifdef CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS

View File

@ -11,10 +11,6 @@
#include "argnames.h" #include "argnames.h"
#include "cpu.h" #include "cpu.h"
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE
#include <emmintrin.h>
#endif
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
void Salsa20_TestInstantiations() void Salsa20_TestInstantiations()
@ -136,7 +132,7 @@ void Salsa20_Policy::OperateKeystream(KeystreamOperation operation, byte *output
#define REG_temp rdx #define REG_temp rdx
#define SSE2_WORKSPACE %5 #define SSE2_WORKSPACE %5
__m128i workspace[32]; FixedSizeAlignedSecBlock<byte, 32*16> workspace;
#else #else
#define REG_output edi #define REG_output edi
#define REG_input eax #define REG_input eax
@ -463,7 +459,7 @@ void Salsa20_Policy::OperateKeystream(KeystreamOperation operation, byte *output
".att_syntax prefix;" ".att_syntax prefix;"
: :
#if CRYPTOPP_BOOL_X64 #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" : "%eax", "%edx", "memory", "cc", "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7", "%xmm8", "%xmm9", "%xmm10", "%xmm11", "%xmm12", "%xmm13", "%xmm14", "%xmm15"
#else #else
: "d" (m_rounds), "a" (input), "c" (iterationCount), "S" (m_state.data()), "D" (output) : "d" (m_rounds), "a" (input), "c" (iterationCount), "S" (m_state.data()), "D" (output)

10
sha.cpp
View File

@ -14,10 +14,6 @@
#include "misc.h" #include "misc.h"
#include "cpu.h" #include "cpu.h"
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE
#include <emmintrin.h>
#endif
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
// start of Steve Reid's code // 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 defined(__GNUC__)
#if CRYPTOPP_BOOL_X64 #if CRYPTOPP_BOOL_X64
__m128i workspace[(LOCALS_SIZE+15)/16]; FixedSizeAlignedSecBlock<byte, LOCALS_SIZE> workspace;
#endif #endif
__asm__ __volatile__ __asm__ __volatile__
( (
#if CRYPTOPP_BOOL_X64 #if CRYPTOPP_BOOL_X64
"movq %4, %%r8;" "lea %4, %%r8;"
#endif #endif
".intel_syntax noprefix;" ".intel_syntax noprefix;"
#elif defined(CRYPTOPP_GENERATE_X64_MASM) #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) : "c" (state), "d" (data), "S" (SHA256_K+48), "D" (len)
#if CRYPTOPP_BOOL_X64 #if CRYPTOPP_BOOL_X64
, "r" (workspace) , "m" (workspace[0])
#endif #endif
: "memory", "cc", "%eax" : "memory", "cc", "%eax"
#if CRYPTOPP_BOOL_X64 #if CRYPTOPP_BOOL_X64

View File

@ -12,10 +12,6 @@
#include "serpentp.h" #include "serpentp.h"
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE
#include <emmintrin.h>
#endif
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
void SosemanukPolicy::CipherSetKey(const NameValuePairs &params, const byte *userKey, size_t keylen) void SosemanukPolicy::CipherSetKey(const NameValuePairs &params, const byte *userKey, size_t keylen)
@ -353,7 +349,7 @@ void SosemanukPolicy::OperateKeystream(KeystreamOperation operation, byte *outpu
{ {
#ifdef __GNUC__ #ifdef __GNUC__
#if CRYPTOPP_BOOL_X64 #if CRYPTOPP_BOOL_X64
__m128i workspace[(80*4*2+12*4+8*WORD_SZ)/16]; FixedSizeAlignedSecBlock<byte, 80*4*2+12*4+8*WORD_SZ> workspace;
#endif #endif
__asm__ __volatile__ __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) : "a" (m_state.m_ptr), "c" (iterationCount), "S" (s_sosemanukMulTables), "D" (output), "d" (input)
#if CRYPTOPP_BOOL_X64 #if CRYPTOPP_BOOL_X64
, "r" (workspace) , "r" (workspace.m_ptr)
: "memory", "cc", "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7" : "memory", "cc", "%r9", "%r10", "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7"
#else #else
: "memory", "cc" : "memory", "cc"
#endif #endif

View File

@ -68,10 +68,6 @@
#include "misc.h" #include "misc.h"
#include "cpu.h" #include "cpu.h"
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE
#include <emmintrin.h>
#endif
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
void Whirlpool_TestInstantiations() 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 // MMX version has the same structure as C version below
#ifdef __GNUC__ #ifdef __GNUC__
#if CRYPTOPP_BOOL_X64 #if CRYPTOPP_BOOL_X64
__m128i workspace[8]; word64 workspace[16];
#endif #endif
__asm__ __volatile__ __asm__ __volatile__
( (