summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2007-05-04 15:10:50 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2007-05-04 15:10:50 +0000
commitd5c2286093d51a7cd8e4f2e1448473b5545001ea (patch)
treef27ba515a537694e503655577430ff6ce5d283f9
parentca5713f67f7152d1054c0d6f75c9851f7b01f73c (diff)
downloadcryptopp-d5c2286093d51a7cd8e4f2e1448473b5545001ea.tar.gz
use Weak1 namespace
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@330 57ff6487-cd31-0410-9ec3-f628ee90f5f0
-rw-r--r--arc4.cpp9
-rw-r--r--arc4.h14
-rw-r--r--md2.cpp4
-rw-r--r--md2.h12
-rw-r--r--md4.cpp4
-rw-r--r--md4.h12
-rw-r--r--md5.cpp4
-rw-r--r--md5.h12
-rw-r--r--pkcspad.cpp8
-rw-r--r--pkcspad.h2
-rw-r--r--rsa.h8
11 files changed, 49 insertions, 40 deletions
diff --git a/arc4.cpp b/arc4.cpp
index 0beeb24..b5c2730 100644
--- a/arc4.cpp
+++ b/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/arc4.h b/arc4.h
index 1942caf..9dcc92e 100644
--- a/arc4.h
+++ b/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_Base>, MARC4)
}
-#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK
-using namespace Weak;
+#if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1
+namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak
+#else
+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 and prepend the class name with 'Weak::' to remove this warning."
+#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 and prepend the class name with 'Weak::' to remove this warning.")
+#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/md2.cpp b/md2.cpp
index 9e07712..41f714b 100644
--- a/md2.cpp
+++ b/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/md2.h b/md2.h
index 4e8ac4b..b0837c8 100644
--- a/md2.h
+++ b/md2.h
@@ -6,7 +6,7 @@
NAMESPACE_BEGIN(CryptoPP)
-namespace Weak {
+namespace Weak1 {
/// <a href="http://www.cryptolounge.org/wiki/MD2">MD2</a>
class MD2 : public HashTransformation
@@ -30,12 +30,14 @@ private:
};
}
-#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK
-using namespace Weak;
+#if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1
+namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak
+#else
+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 and prepend the class name with 'Weak::' to remove this warning."
+#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 and prepend the class name with 'Weak::' to remove this warning.")
+#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/md4.cpp b/md4.cpp
index f032fc0..9ed639c 100644
--- a/md4.cpp
+++ b/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/md4.h b/md4.h
index d80a3d7..5338700 100644
--- a/md4.h
+++ b/md4.h
@@ -5,7 +5,7 @@
NAMESPACE_BEGIN(CryptoPP)
-namespace Weak {
+namespace Weak1 {
//! <a href="http://www.weidai.com/scan-mirror/md.html#MD4">MD4</a>
/*! \warning MD4 is considered insecure, and should not be used
@@ -19,12 +19,14 @@ public:
};
}
-#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK
-using namespace Weak;
+#if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1
+namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak
+#else
+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 and prepend the class name with 'Weak::' to remove this warning."
+#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 and prepend the class name with 'Weak::' to remove this warning.")
+#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/md5.cpp b/md5.cpp
index 839d019..a522978 100644
--- a/md5.cpp
+++ b/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/md5.h b/md5.h
index 944a4ee..73ec532 100644
--- a/md5.h
+++ b/md5.h
@@ -5,7 +5,7 @@
NAMESPACE_BEGIN(CryptoPP)
-namespace Weak {
+namespace Weak1 {
//! <a href="http://www.cryptolounge.org/wiki/MD5">MD5</a>
class MD5 : public IteratedHashWithStaticTransform<word32, LittleEndian, 64, 16, MD5>
@@ -17,12 +17,14 @@ public:
};
}
-#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK
-using namespace Weak;
+#if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1
+namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak
+#else
+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 and prepend the class name with 'Weak::' to remove this warning."
+#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 and prepend the class name with 'Weak::' to remove this warning.")
+#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/pkcspad.cpp b/pkcspad.cpp
index 0ce0aa5..e1f1d1e 100644
--- a/pkcspad.cpp
+++ b/pkcspad.cpp
@@ -11,11 +11,11 @@
NAMESPACE_BEGIN(CryptoPP)
// more in dll.cpp
-template<> const byte PKCS_DigestDecoration<Weak::MD2>::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<Weak::MD2>::length = sizeof(PKCS_DigestDecoration<Weak::MD2>::decoration);
+template<> const byte PKCS_DigestDecoration<Weak1::MD2>::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<Weak1::MD2>::length = sizeof(PKCS_DigestDecoration<Weak1::MD2>::decoration);
-template<> const byte PKCS_DigestDecoration<Weak::MD5>::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<Weak::MD5>::length = sizeof(PKCS_DigestDecoration<Weak::MD5>::decoration);
+template<> const byte PKCS_DigestDecoration<Weak1::MD5>::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<Weak1::MD5>::length = sizeof(PKCS_DigestDecoration<Weak1::MD5>::decoration);
template<> const byte PKCS_DigestDecoration<RIPEMD160>::decoration[] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2b,0x24,0x03,0x02,0x01,0x05,0x00,0x04,0x14};
template<> const unsigned int PKCS_DigestDecoration<RIPEMD160>::length = sizeof(PKCS_DigestDecoration<RIPEMD160>::decoration);
diff --git a/pkcspad.h b/pkcspad.h
index 4d89089..6371c76 100644
--- a/pkcspad.h
+++ b/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/rsa.h b/rsa.h
index debaa44..6a8b185 100644
--- a/rsa.h
+++ b/rsa.h
@@ -162,11 +162,11 @@ typedef RSASS<PKCS1v15, SHA>::Signer RSASSA_PKCS1v15_SHA_Signer;
typedef RSASS<PKCS1v15, SHA>::Verifier RSASSA_PKCS1v15_SHA_Verifier;
namespace Weak {
-typedef RSASS<PKCS1v15, MD2>::Signer RSASSA_PKCS1v15_MD2_Signer;
-typedef RSASS<PKCS1v15, MD2>::Verifier RSASSA_PKCS1v15_MD2_Verifier;
+typedef RSASS<PKCS1v15, Weak1::MD2>::Signer RSASSA_PKCS1v15_MD2_Signer;
+typedef RSASS<PKCS1v15, Weak1::MD2>::Verifier RSASSA_PKCS1v15_MD2_Verifier;
-typedef RSASS<PKCS1v15, MD5>::Signer RSASSA_PKCS1v15_MD5_Signer;
-typedef RSASS<PKCS1v15, MD5>::Verifier RSASSA_PKCS1v15_MD5_Verifier;
+typedef RSASS<PKCS1v15, Weak1::MD5>::Signer RSASSA_PKCS1v15_MD5_Signer;
+typedef RSASS<PKCS1v15, Weak1::MD5>::Verifier RSASSA_PKCS1v15_MD5_Verifier;
}
NAMESPACE_END