1
0

CryptoPP patches from xcb567

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1067 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-11-25 21:07:38 +00:00
parent 46c7f75cab
commit f50c14f91b
5 changed files with 12 additions and 7 deletions

View File

@ -1,5 +1,5 @@
Crypto++: a C++ Class Library of Cryptographic Schemes 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. Crypto++ Library is a free C++ class library of cryptographic schemes.
Currently the library contains the following algorithms: 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 elliptic curve cryptography ECDSA, ECNR, ECIES, ECDH, ECMQV
insecure or obsolescent MD2, MD4, MD5, Panama Hash, DES, ARC4, SEAL 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 compatibility and historical SAFER, 3-WAY, GOST, SHARK, CAST-128, Square
value value

View File

@ -9,7 +9,7 @@
NAMESPACE_BEGIN(CryptoPP) 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";} static const char *StaticAlgorithmName() {return "Blowfish";}
}; };

View File

@ -12,6 +12,7 @@ template <class AbstractClass>
class ObjectFactory class ObjectFactory
{ {
public: public:
virtual ~ObjectFactory () {}
virtual AbstractClass * CreateObject() const =0; virtual AbstractClass * CreateObject() const =0;
}; };

View File

@ -580,13 +580,13 @@ CRYPTOPP_DLL void CRYPTOPP_API UnalignedDeallocate(void *p);
template <class T> inline T rotlFixed(T x, unsigned int y) template <class T> inline T rotlFixed(T x, unsigned int y)
{ {
assert(y < sizeof(T)*8); 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 <class T> inline T rotrFixed(T x, unsigned int y) template <class T> inline T rotrFixed(T x, unsigned int y)
{ {
assert(y < sizeof(T)*8); 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 <class T> inline T rotlVariable(T x, unsigned int y) template <class T> inline T rotlVariable(T x, unsigned int y)

View File

@ -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 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) || CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)
if (HasSSE2()) if (HasSSE2())
#else
if (HasAESNI())
#endif
{ {
Rijndael::Enc::AdvancedProcessBlocks(inBlock, xorBlock, outBlock, 16, 0); Rijndael::Enc::AdvancedProcessBlocks(inBlock, xorBlock, outBlock, 16, 0);
return; return;
@ -522,7 +526,7 @@ CRYPTOPP_NAKED void CRYPTOPP_FASTCALL Rijndael_Enc_AdvancedProcessBlocks(void *l
#if CRYPTOPP_BOOL_X86 #if CRYPTOPP_BOOL_X86
#define L_REG esp #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_INXORBLOCKS L_INBLOCKS+4
#define L_OUTXORBLOCKS L_INBLOCKS+8 #define L_OUTXORBLOCKS L_INBLOCKS+8
#define L_OUTBLOCKS L_INBLOCKS+12 #define L_OUTBLOCKS L_INBLOCKS+12
@ -621,7 +625,7 @@ CRYPTOPP_NAKED void CRYPTOPP_FASTCALL Rijndael_Enc_AdvancedProcessBlocks(void *l
#if CRYPTOPP_BOOL_X86 #if CRYPTOPP_BOOL_X86
AS2( mov [ecx+16*12+16*4], esp) // save esp to L_SP AS2( mov [ecx+16*12+16*4], esp) // save esp to L_SP
AS2( lea esp, [ecx-512]) AS2( lea esp, [ecx-768])
#endif #endif
// copy subkeys to stack // copy subkeys to stack