From f50c14f91b9d7488caa45b1ab9faeaa6d6028f41 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 25 Nov 2012 21:07:38 +0000 Subject: CryptoPP patches from xcb567 git-svn-id: http://mc-server.googlecode.com/svn/trunk@1067 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- CryptoPP/Readme.txt | 4 ++-- CryptoPP/blowfish.h | 2 +- CryptoPP/factory.h | 1 + CryptoPP/misc.h | 4 ++-- CryptoPP/rijndael.cpp | 8 ++++++-- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CryptoPP/Readme.txt b/CryptoPP/Readme.txt index 1b26794a0..2f04e9f28 100644 --- a/CryptoPP/Readme.txt +++ b/CryptoPP/Readme.txt @@ -1,5 +1,5 @@ Crypto++: a C++ Class Library of Cryptographic Schemes -Version 5.6.1 (8/9/2010, SVN r520) +Version 5.6.2 (in development) Crypto++ Library is a free C++ class library of cryptographic schemes. Currently the library contains the following algorithms: @@ -41,7 +41,7 @@ Currently the library contains the following algorithms: elliptic curve cryptography ECDSA, ECNR, ECIES, ECDH, ECMQV insecure or obsolescent MD2, MD4, MD5, Panama Hash, DES, ARC4, SEAL -algorithms retained for backwards 3.0, WAKE, WAKE-OFB, DESX (DES-XEX3), RC2, +algorithms retained for backwards 3.0, WAKE-OFB, DESX (DES-XEX3), RC2, compatibility and historical SAFER, 3-WAY, GOST, SHARK, CAST-128, Square value diff --git a/CryptoPP/blowfish.h b/CryptoPP/blowfish.h index 4707ce192..ebc4f94d3 100644 --- a/CryptoPP/blowfish.h +++ b/CryptoPP/blowfish.h @@ -9,7 +9,7 @@ NAMESPACE_BEGIN(CryptoPP) //! _ -struct Blowfish_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 1, 56>, public FixedRounds<16> +struct Blowfish_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 4, 56>, public FixedRounds<16> { static const char *StaticAlgorithmName() {return "Blowfish";} }; diff --git a/CryptoPP/factory.h b/CryptoPP/factory.h index ef5a59e41..5b65db3da 100644 --- a/CryptoPP/factory.h +++ b/CryptoPP/factory.h @@ -12,6 +12,7 @@ template class ObjectFactory { public: + virtual ~ObjectFactory () {} virtual AbstractClass * CreateObject() const =0; }; diff --git a/CryptoPP/misc.h b/CryptoPP/misc.h index 8425c5362..7f32b860b 100644 --- a/CryptoPP/misc.h +++ b/CryptoPP/misc.h @@ -580,13 +580,13 @@ CRYPTOPP_DLL void CRYPTOPP_API UnalignedDeallocate(void *p); template inline T rotlFixed(T x, unsigned int y) { assert(y < sizeof(T)*8); - return T((x<>(sizeof(T)*8-y))); + return y ? T((x<>(sizeof(T)*8-y))) : x; } template inline T rotrFixed(T x, unsigned int y) { assert(y < sizeof(T)*8); - return T((x>>y) | (x<<(sizeof(T)*8-y))); + return y ? T((x>>y) | (x<<(sizeof(T)*8-y))) : x; } template inline T rotlVariable(T x, unsigned int y) diff --git a/CryptoPP/rijndael.cpp b/CryptoPP/rijndael.cpp index 608b9d30d..c185032cf 100644 --- a/CryptoPP/rijndael.cpp +++ b/CryptoPP/rijndael.cpp @@ -349,7 +349,11 @@ void Rijndael::Base::UncheckedSetKey(const byte *userKey, unsigned int keylen, c void Rijndael::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const { #if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE) || CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE +#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE) if (HasSSE2()) +#else + if (HasAESNI()) +#endif { Rijndael::Enc::AdvancedProcessBlocks(inBlock, xorBlock, outBlock, 16, 0); return; @@ -522,7 +526,7 @@ CRYPTOPP_NAKED void CRYPTOPP_FASTCALL Rijndael_Enc_AdvancedProcessBlocks(void *l #if CRYPTOPP_BOOL_X86 #define L_REG esp -#define L_INDEX(i) (L_REG+512+i) +#define L_INDEX(i) (L_REG+768+i) #define L_INXORBLOCKS L_INBLOCKS+4 #define L_OUTXORBLOCKS L_INBLOCKS+8 #define L_OUTBLOCKS L_INBLOCKS+12 @@ -621,7 +625,7 @@ CRYPTOPP_NAKED void CRYPTOPP_FASTCALL Rijndael_Enc_AdvancedProcessBlocks(void *l #if CRYPTOPP_BOOL_X86 AS2( mov [ecx+16*12+16*4], esp) // save esp to L_SP - AS2( lea esp, [ecx-512]) + AS2( lea esp, [ecx-768]) #endif // copy subkeys to stack -- cgit v1.2.3