diff options
author | weidai <weidai11@users.noreply.github.com> | 2007-05-04 15:24:09 +0000 |
---|---|---|
committer | weidai <weidai11@users.noreply.github.com> | 2007-05-04 15:24:09 +0000 |
commit | d2510f30c75b341dcbc45432a4bd38c0513f2616 (patch) | |
tree | 3ddcd92ac078642dfed5375980dc2db4006d1498 /sha.cpp | |
parent | 460c2d6c6adc5490c77777f8f8b2e96cc4bf4eb3 (diff) | |
download | cryptopp-git-d2510f30c75b341dcbc45432a4bd38c0513f2616.tar.gz |
fix compile for x64, DLL and VC 6
Diffstat (limited to 'sha.cpp')
-rw-r--r-- | sha.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -308,9 +308,9 @@ CRYPTOPP_ALIGN_DATA(16) static const word64 SHA512_K[80] CRYPTOPP_SECTION_ALIGN1 W64LIT(0x5fcb6fab3ad6faec), W64LIT(0x6c44198c4a475817) }; -#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86 // put assembly version in separate function, otherwise MSVC 2005 SP1 doesn't generate correct code for the non-assembly version -static void CRYPTOPP_FASTCALL SHA512_SSE2_Transform(word64 *state, const word64 *data) +CRYPTOPP_NAKED static void CRYPTOPP_FASTCALL SHA512_SSE2_Transform(word64 *state, const word64 *data) { #ifdef __GNUC__ __asm__ __volatile__ @@ -319,6 +319,9 @@ static void CRYPTOPP_FASTCALL SHA512_SSE2_Transform(word64 *state, const word64 AS1( push ebx) AS2( mov ebx, eax) #else + AS1( push ebx) + AS1( push esi) + AS1( push edi) AS2( lea ebx, SHA512_K) #endif @@ -486,22 +489,30 @@ static void CRYPTOPP_FASTCALL SHA512_SSE2_Transform(word64 *state, const word64 AS1( pop esp) AS1( emms) -#ifdef __GNUC__ +#if defined(__GNUC__) AS1( pop ebx) ".att_syntax prefix;" : : "a" (SHA512_K), "c" (state), "d" (data) : "%esi", "%edi", "memory", "cc" ); +#else + AS1( pop edi) + AS1( pop esi) + AS1( pop ebx) + AS1( ret) #endif } #endif // #if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE void SHA512::Transform(word64 *state, const word64 *data) { -#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86 if (HasSSE2()) - return SHA512_SSE2_Transform(state, data); + { + SHA512_SSE2_Transform(state, data); + return; + } #endif #define S0(x) (rotrFixed(x,28)^rotrFixed(x,34)^rotrFixed(x,39)) |