summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2009-03-15 03:53:58 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2009-03-15 03:53:58 +0000
commitf458268c79d1c37b27eec83ac8247d8c292b12ab (patch)
treeb44599a84f8936aeb1175ede422f778e614f4c36
parent02df6c04ecd6ac6ca2580c23dd4282a556cd55c5 (diff)
downloadcryptopp-f458268c79d1c37b27eec83ac8247d8c292b12ab.tar.gz
fix compile on MSVC 6 and MSVC 2003
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@457 57ff6487-cd31-0410-9ec3-f628ee90f5f0
-rw-r--r--gcm.cpp9
-rw-r--r--rijndael.cpp4
-rw-r--r--sha.cpp15
3 files changed, 21 insertions, 7 deletions
diff --git a/gcm.cpp b/gcm.cpp
index 4d20011..986aa2a 100644
--- a/gcm.cpp
+++ b/gcm.cpp
@@ -80,6 +80,11 @@ void GCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const
else
tableSize = (GetTablesOption() == GCM_64K_Tables) ? 64*1024 : 2*1024;
+#if defined(_MSC_VER) && (_MSC_VER >= 1300 && _MSC_VER < 1400)
+ // VC 2003 workaround: compiler generates bad code for 64K tables
+ tableSize = 2*1024;
+#endif
+
m_buffer.resize(3*REQUIRED_BLOCKSIZE + tableSize);
byte *hashKey = HashKey();
memset(hashKey, 0, REQUIRED_BLOCKSIZE);
@@ -409,7 +414,7 @@ size_t GCM_Base::AuthenticateBlocks(const byte *data, size_t len)
AS2( shr WORD_REG(dx), 4 )
#endif
- #if !defined(_MSC_VER) || (_MSC_VER < 1300)
+ #if !defined(_MSC_VER) || (_MSC_VER < 1400)
AS_PUSH_IF86( bx)
#endif
AS_PUSH_IF86( bp)
@@ -519,7 +524,7 @@ size_t GCM_Base::AuthenticateBlocks(const byte *data, size_t len)
AS2( movdqa [WORD_REG(si)], xmm0 )
AS_POP_IF86( bp)
- #if !defined(_MSC_VER) || (_MSC_VER < 1300)
+ #if !defined(_MSC_VER) || (_MSC_VER < 1400)
AS_POP_IF86( bx)
#endif
diff --git a/rijndael.cpp b/rijndael.cpp
index e10b3df..a2c7be3 100644
--- a/rijndael.cpp
+++ b/rijndael.cpp
@@ -539,7 +539,7 @@ CRYPTOPP_NAKED void CRYPTOPP_FASTCALL Rijndael_Enc_AdvancedProcessBlocks(void *l
#else
AS_PUSH_IF86(si)
AS_PUSH_IF86(di)
-#if !defined(_MSC_VER) || (_MSC_VER < 1300)
+#if !defined(_MSC_VER) || (_MSC_VER < 1400)
AS_PUSH_IF86(bx)
#endif
AS_PUSH_IF86(bp)
@@ -871,7 +871,7 @@ CRYPTOPP_NAKED void CRYPTOPP_FASTCALL Rijndael_Enc_AdvancedProcessBlocks(void *l
AS1( emms)
#endif
AS_POP_IF86(bp)
-#if !defined(_MSC_VER) || (_MSC_VER < 1300)
+#if !defined(_MSC_VER) || (_MSC_VER < 1400)
AS_POP_IF86(bx)
#endif
#if defined(_MSC_VER) && CRYPTOPP_BOOL_X86
diff --git a/sha.cpp b/sha.cpp
index a0f696c..fd0b0a2 100644
--- a/sha.cpp
+++ b/sha.cpp
@@ -125,8 +125,17 @@ extern const word32 SHA256_K[64] = {
#pragma warning(disable: 4731) // frame pointer register 'ebp' modified by inline assembly code
-static void CRYPTOPP_FASTCALL X86_SHA256_HashBlocks(word32 *state, const word32 *data, size_t len)
+static void CRYPTOPP_FASTCALL X86_SHA256_HashBlocks(word32 *state, const word32 *data, size_t len
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
+ , ... // VC60 workaround: prevent VC 6 from inlining this function
+#endif
+ )
{
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
+ AS2(mov ecx, [state])
+ AS2(mov edx, [data])
+#endif
+
#define LOCALS_SIZE 8*4 + 16*4 + 4*WORD_SZ
#define H(i) [BASE+ASM_MOD(1024+7-(i),8)*4]
#define G(i) H(i+1)
@@ -252,7 +261,7 @@ static void CRYPTOPP_FASTCALL X86_SHA256_HashBlocks(word32 *state, const word32
AS2( mov edi, [len])
AS2( lea WORD_REG(si), [SHA256_K+48*4])
#endif
- #if !defined(_MSC_VER) || (_MSC_VER < 1300)
+ #if !defined(_MSC_VER) || (_MSC_VER < 1400)
AS_PUSH_IF86(bx)
#endif
@@ -397,7 +406,7 @@ static void CRYPTOPP_FASTCALL X86_SHA256_HashBlocks(word32 *state, const word32
AS_POP_IF86(sp)
AS_POP_IF86(bp)
- #if !defined(_MSC_VER) || (_MSC_VER < 1300)
+ #if !defined(_MSC_VER) || (_MSC_VER < 1400)
AS_POP_IF86(bx)
#endif