diff --git a/trunk/c5/arc4.cpp b/trunk/c5/arc4.cpp index 0beeb24b..b5c27309 100644 --- a/trunk/c5/arc4.cpp +++ b/trunk/c5/arc4.cpp @@ -7,11 +7,11 @@ // completely in the public domain. #include "pch.h" -#define CRYPTOPP_ENABLE_NAMESPACE_WEAK +#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 #include "arc4.h" NAMESPACE_BEGIN(CryptoPP) -namespace Weak { +namespace Weak1 { void ARC4_TestInstantiations() { @@ -62,9 +62,10 @@ static inline unsigned int MakeByte(T &x, T &y, byte *s) return s[(a+b) & 0xff]; } -byte ARC4_Base::GenerateByte() +void ARC4_Base::GenerateBlock(byte *output, size_t size) { - return MakeByte(m_x, m_y, m_state); + while (size--) + *output++ = MakeByte(m_x, m_y, m_state); } void ARC4_Base::ProcessData(byte *outString, const byte *inString, size_t length) diff --git a/trunk/c5/arc4.h b/trunk/c5/arc4.h index 1942cafd..9dcc92ef 100644 --- a/trunk/c5/arc4.h +++ b/trunk/c5/arc4.h @@ -5,7 +5,7 @@ NAMESPACE_BEGIN(CryptoPP) -namespace Weak { +namespace Weak1 { //! _ class CRYPTOPP_NO_VTABLE ARC4_Base : public VariableKeyLength<16, 1, 256>, public RandomNumberGenerator, public SymmetricCipher, public SymmetricCipherDocumentation @@ -15,7 +15,7 @@ public: static const char *StaticAlgorithmName() {return "ARC4";} - byte GenerateByte(); + void GenerateBlock(byte *output, size_t size); void DiscardBytes(size_t n); void ProcessData(byte *outString, const byte *inString, size_t length); @@ -55,12 +55,14 @@ protected: DOCUMENTED_TYPEDEF(SymmetricCipherFinal, MARC4) } -#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK -using namespace Weak; -#ifdef __GNUC__ -#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please define CRYPTOPP_ENABLE_NAMESPACE_WEAK and prepend the class name with 'Weak::' to remove this warning." +#if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1 +namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak #else -#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please define CRYPTOPP_ENABLE_NAMESPACE_WEAK and prepend the class name with 'Weak::' to remove this warning.") +using namespace Weak1; // import Weak1 into CryptoPP with warning +#ifdef __GNUC__ +#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning." +#else +#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.") #endif #endif diff --git a/trunk/c5/md2.cpp b/trunk/c5/md2.cpp index 9e07712f..41f714b5 100644 --- a/trunk/c5/md2.cpp +++ b/trunk/c5/md2.cpp @@ -15,11 +15,11 @@ */ #include "pch.h" -#define CRYPTOPP_ENABLE_NAMESPACE_WEAK +#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 #include "md2.h" NAMESPACE_BEGIN(CryptoPP) -namespace Weak { +namespace Weak1 { MD2::MD2() : m_X(48), m_C(16), m_buf(16) diff --git a/trunk/c5/md2.h b/trunk/c5/md2.h index 4e8ac4b0..b0837c88 100644 --- a/trunk/c5/md2.h +++ b/trunk/c5/md2.h @@ -6,7 +6,7 @@ NAMESPACE_BEGIN(CryptoPP) -namespace Weak { +namespace Weak1 { /// MD2 class MD2 : public HashTransformation @@ -30,12 +30,14 @@ private: }; } -#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK -using namespace Weak; -#ifdef __GNUC__ -#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please define CRYPTOPP_ENABLE_NAMESPACE_WEAK and prepend the class name with 'Weak::' to remove this warning." +#if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1 +namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak #else -#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please define CRYPTOPP_ENABLE_NAMESPACE_WEAK and prepend the class name with 'Weak::' to remove this warning.") +using namespace Weak1; // import Weak1 into CryptoPP with warning +#ifdef __GNUC__ +#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning." +#else +#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.") #endif #endif diff --git a/trunk/c5/md4.cpp b/trunk/c5/md4.cpp index f032fc05..9ed639cb 100644 --- a/trunk/c5/md4.cpp +++ b/trunk/c5/md4.cpp @@ -15,12 +15,12 @@ */ #include "pch.h" -#define CRYPTOPP_ENABLE_NAMESPACE_WEAK +#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 #include "md4.h" #include "misc.h" NAMESPACE_BEGIN(CryptoPP) -namespace Weak { +namespace Weak1 { void MD4::InitState(HashWordType *state) { diff --git a/trunk/c5/md4.h b/trunk/c5/md4.h index d80a3d70..53387003 100644 --- a/trunk/c5/md4.h +++ b/trunk/c5/md4.h @@ -5,7 +5,7 @@ NAMESPACE_BEGIN(CryptoPP) -namespace Weak { +namespace Weak1 { //! MD4 /*! \warning MD4 is considered insecure, and should not be used @@ -19,12 +19,14 @@ public: }; } -#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK -using namespace Weak; -#ifdef __GNUC__ -#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please define CRYPTOPP_ENABLE_NAMESPACE_WEAK and prepend the class name with 'Weak::' to remove this warning." +#if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1 +namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak #else -#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please define CRYPTOPP_ENABLE_NAMESPACE_WEAK and prepend the class name with 'Weak::' to remove this warning.") +using namespace Weak1; // import Weak1 into CryptoPP with warning +#ifdef __GNUC__ +#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning." +#else +#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.") #endif #endif diff --git a/trunk/c5/md5.cpp b/trunk/c5/md5.cpp index 839d0191..a5229781 100644 --- a/trunk/c5/md5.cpp +++ b/trunk/c5/md5.cpp @@ -2,12 +2,12 @@ // any modifications are placed in the public domain #include "pch.h" -#define CRYPTOPP_ENABLE_NAMESPACE_WEAK +#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 #include "md5.h" #include "misc.h" NAMESPACE_BEGIN(CryptoPP) -namespace Weak { +namespace Weak1 { void MD5_TestInstantiations() { diff --git a/trunk/c5/md5.h b/trunk/c5/md5.h index 944a4eec..73ec5326 100644 --- a/trunk/c5/md5.h +++ b/trunk/c5/md5.h @@ -5,7 +5,7 @@ NAMESPACE_BEGIN(CryptoPP) -namespace Weak { +namespace Weak1 { //! MD5 class MD5 : public IteratedHashWithStaticTransform @@ -17,12 +17,14 @@ public: }; } -#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK -using namespace Weak; -#ifdef __GNUC__ -#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please define CRYPTOPP_ENABLE_NAMESPACE_WEAK and prepend the class name with 'Weak::' to remove this warning." +#if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1 +namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak #else -#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please define CRYPTOPP_ENABLE_NAMESPACE_WEAK and prepend the class name with 'Weak::' to remove this warning.") +using namespace Weak1; // import Weak1 into CryptoPP with warning +#ifdef __GNUC__ +#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning." +#else +#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.") #endif #endif diff --git a/trunk/c5/pkcspad.cpp b/trunk/c5/pkcspad.cpp index 0ce0aa55..e1f1d1e2 100644 --- a/trunk/c5/pkcspad.cpp +++ b/trunk/c5/pkcspad.cpp @@ -11,11 +11,11 @@ NAMESPACE_BEGIN(CryptoPP) // more in dll.cpp -template<> const byte PKCS_DigestDecoration::decoration[] = {0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x02,0x05,0x00,0x04,0x10}; -template<> const unsigned int PKCS_DigestDecoration::length = sizeof(PKCS_DigestDecoration::decoration); +template<> const byte PKCS_DigestDecoration::decoration[] = {0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x02,0x05,0x00,0x04,0x10}; +template<> const unsigned int PKCS_DigestDecoration::length = sizeof(PKCS_DigestDecoration::decoration); -template<> const byte PKCS_DigestDecoration::decoration[] = {0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x04,0x10}; -template<> const unsigned int PKCS_DigestDecoration::length = sizeof(PKCS_DigestDecoration::decoration); +template<> const byte PKCS_DigestDecoration::decoration[] = {0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x04,0x10}; +template<> const unsigned int PKCS_DigestDecoration::length = sizeof(PKCS_DigestDecoration::decoration); template<> const byte PKCS_DigestDecoration::decoration[] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2b,0x24,0x03,0x02,0x01,0x05,0x00,0x04,0x14}; template<> const unsigned int PKCS_DigestDecoration::length = sizeof(PKCS_DigestDecoration::decoration); diff --git a/trunk/c5/pkcspad.h b/trunk/c5/pkcspad.h index 4d890890..6371c769 100644 --- a/trunk/c5/pkcspad.h +++ b/trunk/c5/pkcspad.h @@ -37,7 +37,7 @@ class SHA224; class SHA256; class SHA384; class SHA512; -namespace Weak { +namespace Weak1 { class MD2; class MD5; } diff --git a/trunk/c5/rsa.h b/trunk/c5/rsa.h index debaa447..6a8b1852 100644 --- a/trunk/c5/rsa.h +++ b/trunk/c5/rsa.h @@ -162,11 +162,11 @@ typedef RSASS::Signer RSASSA_PKCS1v15_SHA_Signer; typedef RSASS::Verifier RSASSA_PKCS1v15_SHA_Verifier; namespace Weak { -typedef RSASS::Signer RSASSA_PKCS1v15_MD2_Signer; -typedef RSASS::Verifier RSASSA_PKCS1v15_MD2_Verifier; +typedef RSASS::Signer RSASSA_PKCS1v15_MD2_Signer; +typedef RSASS::Verifier RSASSA_PKCS1v15_MD2_Verifier; -typedef RSASS::Signer RSASSA_PKCS1v15_MD5_Signer; -typedef RSASS::Verifier RSASSA_PKCS1v15_MD5_Verifier; +typedef RSASS::Signer RSASSA_PKCS1v15_MD5_Signer; +typedef RSASS::Verifier RSASSA_PKCS1v15_MD5_Verifier; } NAMESPACE_END