port to Borland C++Builder 2006
parent
0f5ff1a063
commit
4afd858ae4
15
Readme.txt
15
Readme.txt
|
|
@ -54,12 +54,13 @@ This library includes:
|
||||||
- FIPS 140-2 Validated
|
- FIPS 140-2 Validated
|
||||||
|
|
||||||
You are welcome to use it for any purpose without paying me, but see
|
You are welcome to use it for any purpose without paying me, but see
|
||||||
license.txt for the fine print.
|
License.txt for the fine print.
|
||||||
|
|
||||||
This version of Crypto++ has been compiled successfully with MSVC 6.0 SP5
|
This version of Crypto++ has been compiled successfully with MSVC 6.0 SP5
|
||||||
and .NET 2003 on Windows XP, GCC 2.95.4 on FreeBSD 4.6, GCC 2.95.3 on
|
and .NET 2005 on Windows XP SP2, GCC 3.4.2 on FreeBSD 5.4, GCC 4.1.2 on
|
||||||
Linux 2.4 and SunOS 5.8, GCC 3.4 on Cygwin 1.5.10, and Metrowerks
|
Linux 2.6, GCC 3.4.4 on Cygwin 1.5.21, GCC 3.3 and 4.0.1 on MacOS X 10.4,
|
||||||
CodeWarrior 8.3 for Windows and MacOS.
|
and Borland C++Builder 2006. For an update to date list of supported compilers
|
||||||
|
and operating systems, please visit http://www.cryptopp.com.
|
||||||
|
|
||||||
*** Important Usage Notes ***
|
*** Important Usage Notes ***
|
||||||
|
|
||||||
|
|
@ -149,8 +150,8 @@ may come up.
|
||||||
|
|
||||||
If you run into any problems, please try the Crypto++ mailing list.
|
If you run into any problems, please try the Crypto++ mailing list.
|
||||||
The subscription information and the list archive are available on
|
The subscription information and the list archive are available on
|
||||||
http://www.cryptopp.com. You can also email me directly at
|
http://www.cryptopp.com. You can also email me directly by visiting
|
||||||
cryptopp@weidai.com, but you will probably get a faster response through
|
http://www.weidai.com, but you will probably get a faster response through
|
||||||
the mailing list.
|
the mailing list.
|
||||||
|
|
||||||
*** History ***
|
*** History ***
|
||||||
|
|
@ -356,6 +357,6 @@ the mailing list.
|
||||||
|
|
||||||
5.4 - added Salsa20
|
5.4 - added Salsa20
|
||||||
- updated Whirlpool to version 3.0
|
- updated Whirlpool to version 3.0
|
||||||
- ported to GCC 4.1
|
- ported to GCC 4.1 and Borland C++Builder 2006
|
||||||
|
|
||||||
Written by Wei Dai
|
Written by Wei Dai
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||||
class Adler32 : public HashTransformation
|
class Adler32 : public HashTransformation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum {DIGESTSIZE = 4};
|
CRYPTOPP_CONSTANT(DIGESTSIZE = 4)
|
||||||
Adler32() {Reset();}
|
Adler32() {Reset();}
|
||||||
void Update(const byte *input, size_t length);
|
void Update(const byte *input, size_t length);
|
||||||
void TruncatedFinal(byte *hash, size_t size);
|
void TruncatedFinal(byte *hash, size_t size);
|
||||||
|
|
|
||||||
|
|
@ -66,14 +66,7 @@ template <class T> const T& AbstractEuclideanDomain<T>::Gcd(const Element &a, co
|
||||||
template <class T> const typename QuotientRing<T>::Element& QuotientRing<T>::MultiplicativeInverse(const Element &a) const
|
template <class T> const typename QuotientRing<T>::Element& QuotientRing<T>::MultiplicativeInverse(const Element &a) const
|
||||||
{
|
{
|
||||||
Element g[3]={m_modulus, a};
|
Element g[3]={m_modulus, a};
|
||||||
#ifdef __BCPLUSPLUS__
|
|
||||||
// BC++50 workaround
|
|
||||||
Element v[3];
|
|
||||||
v[0]=m_domain.Identity();
|
|
||||||
v[1]=m_domain.MultiplicativeIdentity();
|
|
||||||
#else
|
|
||||||
Element v[3]={m_domain.Identity(), m_domain.MultiplicativeIdentity()};
|
Element v[3]={m_domain.Identity(), m_domain.MultiplicativeIdentity()};
|
||||||
#endif
|
|
||||||
Element y;
|
Element y;
|
||||||
unsigned int i0=0, i1=1, i2=2;
|
unsigned int i0=0, i1=1, i2=2;
|
||||||
|
|
||||||
|
|
|
||||||
25
config.h
25
config.h
|
|
@ -108,7 +108,7 @@ typedef unsigned int word32;
|
||||||
#define WORD64_AVAILABLE
|
#define WORD64_AVAILABLE
|
||||||
typedef unsigned long long word64;
|
typedef unsigned long long word64;
|
||||||
#define W64LIT(x) x##LL
|
#define W64LIT(x) x##LL
|
||||||
#elif defined(_MSC_VER) || defined(__BCPLUSPLUS__)
|
#elif defined(_MSC_VER) || defined(__BORLANDC__)
|
||||||
#define WORD64_AVAILABLE
|
#define WORD64_AVAILABLE
|
||||||
typedef unsigned __int64 word64;
|
typedef unsigned __int64 word64;
|
||||||
#define W64LIT(x) x##ui64
|
#define W64LIT(x) x##ui64
|
||||||
|
|
@ -138,7 +138,7 @@ typedef unsigned int word32;
|
||||||
typedef word32 word;
|
typedef word32 word;
|
||||||
typedef word64 dword;
|
typedef word64 dword;
|
||||||
#else
|
#else
|
||||||
typedef word8 hword;
|
typedef byte hword;
|
||||||
typedef word16 word;
|
typedef word16 word;
|
||||||
typedef word32 dword;
|
typedef word32 dword;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -147,7 +147,7 @@ typedef unsigned int word32;
|
||||||
const unsigned int WORD_SIZE = sizeof(word);
|
const unsigned int WORD_SIZE = sizeof(word);
|
||||||
const unsigned int WORD_BITS = WORD_SIZE * 8;
|
const unsigned int WORD_BITS = WORD_SIZE * 8;
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__BCPLUSPLUS__)
|
#if defined(_MSC_VER) // || defined(__BORLANDC__) intrinsics don't work on BCB 2006
|
||||||
#define INTEL_INTRINSICS
|
#define INTEL_INTRINSICS
|
||||||
#define FAST_ROTATE
|
#define FAST_ROTATE
|
||||||
#elif defined(__MWERKS__) && TARGET_CPU_PPC
|
#elif defined(__MWERKS__) && TARGET_CPU_PPC
|
||||||
|
|
@ -165,10 +165,12 @@ const unsigned int WORD_BITS = WORD_SIZE * 8;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CRYPTOPP_L1_CACHE_ALIGN
|
#ifndef CRYPTOPP_L1_CACHE_ALIGN
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER)
|
||||||
#define CRYPTOPP_L1_CACHE_ALIGN(x) __declspec(align(CRYPTOPP_L1_CACHE_LINE_SIZE)) x
|
#define CRYPTOPP_L1_CACHE_ALIGN(x) __declspec(align(CRYPTOPP_L1_CACHE_LINE_SIZE)) x
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
#define CRYPTOPP_L1_CACHE_ALIGN(x) x __attribute__((aligned(CRYPTOPP_L1_CACHE_LINE_SIZE)))
|
#define CRYPTOPP_L1_CACHE_ALIGN(x) x __attribute__((aligned(CRYPTOPP_L1_CACHE_LINE_SIZE)))
|
||||||
|
#else
|
||||||
|
#define CRYPTOPP_L1_CACHE_ALIGN(x) x
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -199,6 +201,11 @@ NAMESPACE_END
|
||||||
# pragma warning(disable: 4231 4250 4251 4275 4660 4661 4786 4355)
|
# pragma warning(disable: 4231 4250 4251 4275 4660 4661 4786 4355)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
// 8037: non-const function called for const object. needed to work around BCB2006 bug
|
||||||
|
# pragma warn -8037
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__MWERKS__) || defined(_STLPORT_VERSION)
|
#if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__MWERKS__) || defined(_STLPORT_VERSION)
|
||||||
#define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
|
#define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -224,6 +231,12 @@ NAMESPACE_END
|
||||||
# define CRYPTOPP_NOINLINE
|
# define CRYPTOPP_NOINLINE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// how to declare class constants
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER < 1300
|
||||||
|
# define CRYPTOPP_CONSTANT(x) enum {x};
|
||||||
|
#else
|
||||||
|
# define CRYPTOPP_CONSTANT(x) static const int x;
|
||||||
|
#endif
|
||||||
|
|
||||||
// ***************** determine availability of OS features ********************
|
// ***************** determine availability of OS features ********************
|
||||||
|
|
||||||
|
|
@ -316,6 +329,8 @@ NAMESPACE_END
|
||||||
|
|
||||||
#if defined(__MWERKS__)
|
#if defined(__MWERKS__)
|
||||||
#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
|
#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
|
||||||
|
#elif defined(__BORLANDC__)
|
||||||
|
#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
|
||||||
#else
|
#else
|
||||||
#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
|
#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -328,6 +343,8 @@ NAMESPACE_END
|
||||||
|
|
||||||
#if defined(__MWERKS__)
|
#if defined(__MWERKS__)
|
||||||
#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class
|
#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class
|
||||||
|
#elif defined(__BORLANDC__)
|
||||||
|
#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class
|
||||||
#else
|
#else
|
||||||
#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class
|
#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
2
crc.h
2
crc.h
|
|
@ -19,7 +19,7 @@ const word32 CRC32_NEGL = 0xffffffffL;
|
||||||
class CRC32 : public HashTransformation
|
class CRC32 : public HashTransformation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum {DIGESTSIZE = 4};
|
CRYPTOPP_CONSTANT(DIGESTSIZE = 4)
|
||||||
CRC32();
|
CRC32();
|
||||||
void Update(const byte *input, size_t length);
|
void Update(const byte *input, size_t length);
|
||||||
void TruncatedFinal(byte *hash, size_t size);
|
void TruncatedFinal(byte *hash, size_t size);
|
||||||
|
|
|
||||||
|
|
@ -264,6 +264,9 @@ void TestSymmetricCipher(TestData &v)
|
||||||
if (test == "Encrypt")
|
if (test == "Encrypt")
|
||||||
{
|
{
|
||||||
std::auto_ptr<SymmetricCipher> encryptor(ObjectFactoryRegistry<SymmetricCipher, ENCRYPTION>::Registry().CreateObject(name.c_str()));
|
std::auto_ptr<SymmetricCipher> encryptor(ObjectFactoryRegistry<SymmetricCipher, ENCRYPTION>::Registry().CreateObject(name.c_str()));
|
||||||
|
ConstByteArrayParameter iv;
|
||||||
|
if (pairs.GetValue(Name::IV(), iv) && iv.size() != encryptor->IVSize())
|
||||||
|
SignalTestFailure();
|
||||||
encryptor->SetKey((const byte *)key.data(), key.size(), pairs);
|
encryptor->SetKey((const byte *)key.data(), key.size(), pairs);
|
||||||
int seek = pairs.GetIntValueWithDefault("Seek", 0);
|
int seek = pairs.GetIntValueWithDefault("Seek", 0);
|
||||||
if (seek)
|
if (seek)
|
||||||
|
|
@ -276,6 +279,9 @@ void TestSymmetricCipher(TestData &v)
|
||||||
else if (test == "Decrypt")
|
else if (test == "Decrypt")
|
||||||
{
|
{
|
||||||
std::auto_ptr<SymmetricCipher> decryptor(ObjectFactoryRegistry<SymmetricCipher, DECRYPTION>::Registry().CreateObject(name.c_str()));
|
std::auto_ptr<SymmetricCipher> decryptor(ObjectFactoryRegistry<SymmetricCipher, DECRYPTION>::Registry().CreateObject(name.c_str()));
|
||||||
|
ConstByteArrayParameter iv;
|
||||||
|
if (pairs.GetValue(Name::IV(), iv) && iv.size() != decryptor->IVSize())
|
||||||
|
SignalTestFailure();
|
||||||
decryptor->SetKey((const byte *)key.data(), key.size(), pairs);
|
decryptor->SetKey((const byte *)key.data(), key.size(), pairs);
|
||||||
int seek = pairs.GetIntValueWithDefault("Seek", 0);
|
int seek = pairs.GetIntValueWithDefault("Seek", 0);
|
||||||
if (seek)
|
if (seek)
|
||||||
|
|
|
||||||
2
dmac.h
2
dmac.h
|
|
@ -12,7 +12,7 @@ class CRYPTOPP_NO_VTABLE DMAC_Base : public SameKeyLengthAs<T>, public MessageAu
|
||||||
public:
|
public:
|
||||||
static std::string StaticAlgorithmName() {return std::string("DMAC(") + T::StaticAlgorithmName() + ")";}
|
static std::string StaticAlgorithmName() {return std::string("DMAC(") + T::StaticAlgorithmName() + ")";}
|
||||||
|
|
||||||
enum {DIGESTSIZE=T::BLOCKSIZE};
|
CRYPTOPP_CONSTANT(DIGESTSIZE=T::BLOCKSIZE)
|
||||||
|
|
||||||
DMAC_Base() {}
|
DMAC_Base() {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -535,10 +535,11 @@ bool DL_GroupParameters_EC<EC>::ValidateElement(unsigned int level, const Elemen
|
||||||
if (gpc)
|
if (gpc)
|
||||||
pass = pass && gpc->Exponentiate(this->GetGroupPrecomputation(), Integer::One()) == g;
|
pass = pass && gpc->Exponentiate(this->GetGroupPrecomputation(), Integer::One()) == g;
|
||||||
}
|
}
|
||||||
if (level >= 2)
|
if (level >= 2 && pass)
|
||||||
{
|
{
|
||||||
const Integer &q = GetSubgroupOrder();
|
const Integer &q = GetSubgroupOrder();
|
||||||
pass = pass && IsIdentity(gpc ? gpc->Exponentiate(this->GetGroupPrecomputation(), q) : ExponentiateElement(g, q));
|
Element gq = gpc ? gpc->Exponentiate(this->GetGroupPrecomputation(), q) : ExponentiateElement(g, q);
|
||||||
|
pass = pass && IsIdentity(gq);
|
||||||
}
|
}
|
||||||
return pass;
|
return pass;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,8 +84,10 @@ template <class AbstractClass, class ConcreteClass, int instance = 0>
|
||||||
struct RegisterDefaultFactoryFor {
|
struct RegisterDefaultFactoryFor {
|
||||||
RegisterDefaultFactoryFor(const char *name=NULL)
|
RegisterDefaultFactoryFor(const char *name=NULL)
|
||||||
{
|
{
|
||||||
|
// BCB2006 workaround
|
||||||
|
std::string n = name ? std::string(name) : std::string(ConcreteClass::StaticAlgorithmName());
|
||||||
ObjectFactoryRegistry<AbstractClass, instance>::Registry().
|
ObjectFactoryRegistry<AbstractClass, instance>::Registry().
|
||||||
RegisterFactory(name ? name : ConcreteClass::StaticAlgorithmName(), new DefaultObjectFactory<AbstractClass, ConcreteClass>);
|
RegisterFactory(n, new DefaultObjectFactory<AbstractClass, ConcreteClass>);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
template <class SchemeClass>
|
template <class SchemeClass>
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,6 @@ size_t FileStore::CopyRangeTo2(BufferedTransformation &target, lword &begin, lwo
|
||||||
return 0; // don't try to seek beyond the end of file
|
return 0; // don't try to seek beyond the end of file
|
||||||
}
|
}
|
||||||
m_stream->seekg(newPosition);
|
m_stream->seekg(newPosition);
|
||||||
lword total = 0;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
assert(!m_waiting);
|
assert(!m_waiting);
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ private:
|
||||||
|
|
||||||
struct MessageRange
|
struct MessageRange
|
||||||
{
|
{
|
||||||
inline bool operator<(const MessageRange &b)
|
inline bool operator<(const MessageRange &b) const // BCB2006 workaround: this has to be a member function
|
||||||
{return message < b.message || (message == b.message && position < b.position);}
|
{return message < b.message || (message == b.message && position < b.position);}
|
||||||
unsigned int message; lword position; lword size;
|
unsigned int message; lword position; lword size;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -148,8 +148,11 @@ bool DL_GroupParameters_IntegerBased::ValidateElement(unsigned int level, const
|
||||||
// and at most 1 bit is leaked if it's false
|
// and at most 1 bit is leaked if it's false
|
||||||
bool fullValidate = (GetFieldType() == 2 && level >= 3) || !FastSubgroupCheckAvailable();
|
bool fullValidate = (GetFieldType() == 2 && level >= 3) || !FastSubgroupCheckAvailable();
|
||||||
|
|
||||||
if (fullValidate)
|
if (fullValidate && pass)
|
||||||
pass = pass && IsIdentity(gpc ? gpc->Exponentiate(GetGroupPrecomputation(), q) : ExponentiateElement(g, q));
|
{
|
||||||
|
Integer gp = gpc ? gpc->Exponentiate(GetGroupPrecomputation(), q) : ExponentiateElement(g, q);
|
||||||
|
pass = pass && IsIdentity(gp);
|
||||||
|
}
|
||||||
else if (GetFieldType() == 1)
|
else if (GetFieldType() == 1)
|
||||||
pass = pass && Jacobi(g, p) == 1;
|
pass = pass && Jacobi(g, p) == 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
haval.h
3
haval.h
|
|
@ -11,7 +11,8 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||||
class HAVAL : public IteratedHash<word32, LittleEndian, 128>
|
class HAVAL : public IteratedHash<word32, LittleEndian, 128>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum {DIGESTSIZE = 32, HAVAL_VERSION = 1};
|
enum {HAVAL_VERSION = 1};
|
||||||
|
CRYPTOPP_CONSTANT(DIGESTSIZE = 32)
|
||||||
|
|
||||||
/// digestSize can be 16, 20, 24, 28, or 32 (Default=32)<br>
|
/// digestSize can be 16, 20, 24, 28, or 32 (Default=32)<br>
|
||||||
/// pass can be 3, 4 or 5 (Default=3)
|
/// pass can be 3, 4 or 5 (Default=3)
|
||||||
|
|
|
||||||
6
hmac.cpp
6
hmac.cpp
|
|
@ -20,6 +20,8 @@ void HMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, con
|
||||||
if (!blockSize)
|
if (!blockSize)
|
||||||
throw InvalidArgument("HMAC: can only be used with a block-based hash function");
|
throw InvalidArgument("HMAC: can only be used with a block-based hash function");
|
||||||
|
|
||||||
|
m_buf.resize(2*AccessHash().BlockSize() + AccessHash().DigestSize());
|
||||||
|
|
||||||
if (keylength <= blockSize)
|
if (keylength <= blockSize)
|
||||||
memcpy(AccessIpad(), userKey, keylength);
|
memcpy(AccessIpad(), userKey, keylength);
|
||||||
else
|
else
|
||||||
|
|
@ -33,8 +35,8 @@ void HMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, con
|
||||||
|
|
||||||
for (unsigned int i=0; i<blockSize; i++)
|
for (unsigned int i=0; i<blockSize; i++)
|
||||||
{
|
{
|
||||||
AccessOpad()[i] = AccessIpad()[i] ^ OPAD;
|
AccessOpad()[i] = AccessIpad()[i] ^ 0x5c;
|
||||||
AccessIpad()[i] ^= IPAD;
|
AccessIpad()[i] ^= 0x36;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
19
hmac.h
19
hmac.h
|
|
@ -9,7 +9,7 @@
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
//! _
|
//! _
|
||||||
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE HMAC_Base : public VariableKeyLength<16, 0, UINT_MAX>, public MessageAuthenticationCode
|
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE HMAC_Base : public VariableKeyLength<16, 0, INT_MAX>, public MessageAuthenticationCode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HMAC_Base() : m_innerHashKeyed(false) {}
|
HMAC_Base() : m_innerHashKeyed(false) {}
|
||||||
|
|
@ -23,15 +23,14 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual HashTransformation & AccessHash() =0;
|
virtual HashTransformation & AccessHash() =0;
|
||||||
virtual byte * AccessIpad() =0;
|
byte * AccessIpad() {return m_buf;}
|
||||||
virtual byte * AccessOpad() =0;
|
byte * AccessOpad() {return m_buf + AccessHash().BlockSize();}
|
||||||
virtual byte * AccessInnerHash() =0;
|
byte * AccessInnerHash() {return m_buf + 2*AccessHash().BlockSize();}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void KeyInnerHash();
|
void KeyInnerHash();
|
||||||
|
|
||||||
enum {IPAD=0x36, OPAD=0x5c};
|
SecByteBlock m_buf;
|
||||||
|
|
||||||
bool m_innerHashKeyed;
|
bool m_innerHashKeyed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -41,7 +40,8 @@ template <class T>
|
||||||
class HMAC : public MessageAuthenticationCodeImpl<HMAC_Base, HMAC<T> >
|
class HMAC : public MessageAuthenticationCodeImpl<HMAC_Base, HMAC<T> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum {DIGESTSIZE=T::DIGESTSIZE, BLOCKSIZE=T::BLOCKSIZE};
|
CRYPTOPP_CONSTANT(DIGESTSIZE=T::DIGESTSIZE)
|
||||||
|
CRYPTOPP_CONSTANT(BLOCKSIZE=T::BLOCKSIZE)
|
||||||
|
|
||||||
HMAC() {}
|
HMAC() {}
|
||||||
HMAC(const byte *key, size_t length=HMAC_Base::DEFAULT_KEYLENGTH)
|
HMAC(const byte *key, size_t length=HMAC_Base::DEFAULT_KEYLENGTH)
|
||||||
|
|
@ -52,12 +52,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HashTransformation & AccessHash() {return m_hash;}
|
HashTransformation & AccessHash() {return m_hash;}
|
||||||
byte * AccessIpad() {return m_ipad;}
|
|
||||||
byte * AccessOpad() {return m_opad;}
|
|
||||||
byte * AccessInnerHash() {return m_innerHash;}
|
|
||||||
|
|
||||||
FixedSizeSecBlock<byte, BLOCKSIZE> m_ipad, m_opad;
|
|
||||||
FixedSizeSecBlock<byte, DIGESTSIZE> m_innerHash;
|
|
||||||
T m_hash;
|
T m_hash;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,9 @@ public:
|
||||||
typedef T_Endianness ByteOrderClass;
|
typedef T_Endianness ByteOrderClass;
|
||||||
typedef T_HashWordType HashWordType;
|
typedef T_HashWordType HashWordType;
|
||||||
|
|
||||||
enum {BLOCKSIZE = T_BlockSize};
|
CRYPTOPP_CONSTANT(BLOCKSIZE = T_BlockSize)
|
||||||
CRYPTOPP_COMPILE_ASSERT((BLOCKSIZE & (BLOCKSIZE - 1)) == 0); // blockSize is a power of 2
|
// BCB2006 workaround: can't use BLOCKSIZE here
|
||||||
|
CRYPTOPP_COMPILE_ASSERT((T_BlockSize & (T_BlockSize - 1)) == 0); // blockSize is a power of 2
|
||||||
|
|
||||||
ByteOrder GetByteOrder() const {return T_Endianness::ToEnum();}
|
ByteOrder GetByteOrder() const {return T_Endianness::ToEnum();}
|
||||||
|
|
||||||
|
|
@ -77,12 +78,12 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
//! _
|
//! _
|
||||||
template <class T_HashWordType, class T_Endianness, unsigned int T_BlockSize, unsigned int T_StateSize, class T_Transform, unsigned int T_DigestSize = T_StateSize>
|
template <class T_HashWordType, class T_Endianness, unsigned int T_BlockSize, unsigned int T_StateSize, class T_Transform, unsigned int T_DigestSize = 0>
|
||||||
class CRYPTOPP_NO_VTABLE IteratedHashWithStaticTransform
|
class CRYPTOPP_NO_VTABLE IteratedHashWithStaticTransform
|
||||||
: public ClonableImpl<T_Transform, AlgorithmImpl<IteratedHash<T_HashWordType, T_Endianness, T_BlockSize>, T_Transform> >
|
: public ClonableImpl<T_Transform, AlgorithmImpl<IteratedHash<T_HashWordType, T_Endianness, T_BlockSize>, T_Transform> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum {DIGESTSIZE = T_DigestSize};
|
CRYPTOPP_CONSTANT(DIGESTSIZE = T_DigestSize ? T_DigestSize : T_StateSize)
|
||||||
unsigned int DigestSize() const {return DIGESTSIZE;};
|
unsigned int DigestSize() const {return DIGESTSIZE;};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,14 @@
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
template <class T> struct DigestSizeDoubleWorkaround {enum {RESULT = 2*T::DIGESTSIZE};}; // VC60 workaround
|
template <class T> struct DigestSizeDoubleWorkaround // VC60 workaround
|
||||||
|
{
|
||||||
|
CRYPTOPP_CONSTANT(RESULT = 2*T::DIGESTSIZE)
|
||||||
|
};
|
||||||
|
|
||||||
//! algorithm info
|
//! algorithm info
|
||||||
template <class T>
|
template <class T>
|
||||||
struct LR_Info : public VariableKeyLength<16, 0, 2*(UINT_MAX/2), 2>, public FixedBlockSize<DigestSizeDoubleWorkaround<T>::RESULT>
|
struct LR_Info : public VariableKeyLength<16, 0, 2*(INT_MAX/2), 2>, public FixedBlockSize<DigestSizeDoubleWorkaround<T>::RESULT>
|
||||||
{
|
{
|
||||||
static std::string StaticAlgorithmName() {return std::string("LR/")+T::StaticAlgorithmName();}
|
static std::string StaticAlgorithmName() {return std::string("LR/")+T::StaticAlgorithmName();}
|
||||||
};
|
};
|
||||||
|
|
@ -38,7 +41,7 @@ class LR : public LR_Info<T>, public BlockCipherDocumentation
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum {S=T::DIGESTSIZE};
|
CRYPTOPP_CONSTANT(S=T::DIGESTSIZE)
|
||||||
unsigned int L; // key length / 2
|
unsigned int L; // key length / 2
|
||||||
SecByteBlock key;
|
SecByteBlock key;
|
||||||
|
|
||||||
|
|
|
||||||
3
md2.h
3
md2.h
|
|
@ -17,7 +17,8 @@ public:
|
||||||
unsigned int DigestSize() const {return DIGESTSIZE;}
|
unsigned int DigestSize() const {return DIGESTSIZE;}
|
||||||
static const char * StaticAlgorithmName() {return "MD2";}
|
static const char * StaticAlgorithmName() {return "MD2";}
|
||||||
|
|
||||||
enum {DIGESTSIZE = 16, BLOCKSIZE = 16};
|
CRYPTOPP_CONSTANT(DIGESTSIZE = 16)
|
||||||
|
CRYPTOPP_CONSTANT(BLOCKSIZE = 16)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Transform();
|
void Transform();
|
||||||
|
|
|
||||||
2
md5mac.h
2
md5mac.h
|
|
@ -13,7 +13,7 @@ class CRYPTOPP_NO_VTABLE MD5MAC_Base : public FixedKeyLength<16>, public Iterate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::string StaticAlgorithmName() {return "MD5-MAC";}
|
static std::string StaticAlgorithmName() {return "MD5-MAC";}
|
||||||
enum {DIGESTSIZE = 16};
|
CRYPTOPP_CONSTANT(DIGESTSIZE = 16)
|
||||||
|
|
||||||
MD5MAC_Base() {SetStateSize(DIGESTSIZE);}
|
MD5MAC_Base() {SetStateSize(DIGESTSIZE);}
|
||||||
|
|
||||||
|
|
|
||||||
11
misc.h
11
misc.h
|
|
@ -8,6 +8,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#include <mem.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
// ************** compile-time assertion ***************
|
// ************** compile-time assertion ***************
|
||||||
|
|
@ -291,6 +295,8 @@ inline unsigned int GetAlignment(T *dummy=NULL) // VC60 workaround
|
||||||
return __alignof(T);
|
return __alignof(T);
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
return __alignof__(T);
|
return __alignof__(T);
|
||||||
|
#elif defined(CRYPTOPP_SLOW_WORD64)
|
||||||
|
return UnsignedMin(4U, sizeof(T));
|
||||||
#else
|
#else
|
||||||
return sizeof(T);
|
return sizeof(T);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -370,7 +376,7 @@ inline void IncrementCounterByOne(byte *output, const byte *input, unsigned int
|
||||||
{
|
{
|
||||||
int i, carry;
|
int i, carry;
|
||||||
for (i=s-1, carry=1; i>=0 && carry; i--)
|
for (i=s-1, carry=1; i>=0 && carry; i--)
|
||||||
carry = !(output[i] = input[i]+1);
|
carry = ((output[i] = input[i]+1) == 0);
|
||||||
memcpy_s(output, s, input, i+1);
|
memcpy_s(output, s, input, i+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -543,7 +549,7 @@ inline byte BitReverse(byte value)
|
||||||
{
|
{
|
||||||
value = ((value & 0xAA) >> 1) | ((value & 0x55) << 1);
|
value = ((value & 0xAA) >> 1) | ((value & 0x55) << 1);
|
||||||
value = ((value & 0xCC) >> 2) | ((value & 0x33) << 2);
|
value = ((value & 0xCC) >> 2) | ((value & 0x33) << 2);
|
||||||
return rotlFixed(value, 4);
|
return rotlFixed(value, 4U);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline word16 BitReverse(word16 value)
|
inline word16 BitReverse(word16 value)
|
||||||
|
|
@ -796,6 +802,7 @@ inline void PutWord(bool assumeAligned, ByteOrder order, byte *block, T value, c
|
||||||
if (assumeAligned)
|
if (assumeAligned)
|
||||||
{
|
{
|
||||||
assert(IsAligned<T>(block));
|
assert(IsAligned<T>(block));
|
||||||
|
assert(IsAligned<T>(xorBlock));
|
||||||
if (xorBlock)
|
if (xorBlock)
|
||||||
*reinterpret_cast<T *>(block) = ConditionalByteReverse(order, value) ^ *reinterpret_cast<const T *>(xorBlock);
|
*reinterpret_cast<T *>(block) = ConditionalByteReverse(order, value) ^ *reinterpret_cast<const T *>(xorBlock);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ void CTR_ModePolicy::SeekToIteration(lword iterationCount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTR_ModePolicy::GetNextIV(byte *IV)
|
void CTR_ModePolicy::CipherGetNextIV(byte *IV)
|
||||||
{
|
{
|
||||||
IncrementCounterByOne(IV, m_counterArray, BlockSize());
|
IncrementCounterByOne(IV, m_counterArray, BlockSize());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
modes.h
3
modes.h
|
|
@ -64,6 +64,7 @@ class CRYPTOPP_NO_VTABLE ModePolicyCommonTemplate : public CipherModeBase, publi
|
||||||
{
|
{
|
||||||
unsigned int GetAlignment() const {return m_cipher->BlockAlignment();}
|
unsigned int GetAlignment() const {return m_cipher->BlockAlignment();}
|
||||||
void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
|
void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
|
||||||
|
void CipherGetNextIV(byte *IV) {CipherModeBase::GetNextIV(IV);}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class POLICY_INTERFACE>
|
template <class POLICY_INTERFACE>
|
||||||
|
|
@ -147,7 +148,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CTR_ModePolicy : public ModePolicyCommonTe
|
||||||
public:
|
public:
|
||||||
bool IsRandomAccess() const {return true;}
|
bool IsRandomAccess() const {return true;}
|
||||||
IV_Requirement IVRequirement() const {return STRUCTURED_IV;}
|
IV_Requirement IVRequirement() const {return STRUCTURED_IV;}
|
||||||
void GetNextIV(byte *IV);
|
void CipherGetNextIV(byte *IV);
|
||||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "CTR";}
|
static const char * CRYPTOPP_API StaticAlgorithmName() {return "CTR";}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
10
panama.h
10
panama.h
|
|
@ -18,9 +18,9 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef word32 Stage[8];
|
typedef word32 Stage[8];
|
||||||
enum {STAGES = 32};
|
CRYPTOPP_CONSTANT(STAGES = 32)
|
||||||
|
|
||||||
FixedSizeSecBlock<word32, 17*2 + STAGES*sizeof(Stage)> m_state;
|
FixedSizeSecBlock<word32, 17*2 + 32*sizeof(Stage)> m_state;
|
||||||
unsigned int m_bstart;
|
unsigned int m_bstart;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -29,7 +29,7 @@ template <class B = LittleEndian>
|
||||||
class PanamaHash : protected Panama<B>, public AlgorithmImpl<IteratedHash<word32, NativeByteOrder, 32>, PanamaHash<B> >
|
class PanamaHash : protected Panama<B>, public AlgorithmImpl<IteratedHash<word32, NativeByteOrder, 32>, PanamaHash<B> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum {DIGESTSIZE = 32};
|
CRYPTOPP_CONSTANT(DIGESTSIZE = 32)
|
||||||
PanamaHash() {Panama<B>::Reset();}
|
PanamaHash() {Panama<B>::Reset();}
|
||||||
unsigned int DigestSize() const {return DIGESTSIZE;}
|
unsigned int DigestSize() const {return DIGESTSIZE;}
|
||||||
void TruncatedFinal(byte *hash, size_t size);
|
void TruncatedFinal(byte *hash, size_t size);
|
||||||
|
|
@ -43,7 +43,7 @@ protected:
|
||||||
|
|
||||||
//! MAC construction using a hermetic hash function
|
//! MAC construction using a hermetic hash function
|
||||||
template <class T_Hash, class T_Info = T_Hash>
|
template <class T_Hash, class T_Info = T_Hash>
|
||||||
class HermeticHashFunctionMAC : public AlgorithmImpl<SimpleKeyingInterfaceImpl<TwoBases<MessageAuthenticationCode, VariableKeyLength<32, 0, UINT_MAX> > >, T_Info>
|
class HermeticHashFunctionMAC : public AlgorithmImpl<SimpleKeyingInterfaceImpl<TwoBases<MessageAuthenticationCode, VariableKeyLength<32, 0, INT_MAX> > >, T_Info>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms)
|
void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms)
|
||||||
|
|
@ -127,7 +127,7 @@ protected:
|
||||||
template <class B = LittleEndian>
|
template <class B = LittleEndian>
|
||||||
struct PanamaCipher : public PanamaCipherInfo<B>, public SymmetricCipherDocumentation
|
struct PanamaCipher : public PanamaCipherInfo<B>, public SymmetricCipherDocumentation
|
||||||
{
|
{
|
||||||
typedef SymmetricCipherFinal<ConcretePolicyHolder<PanamaCipherPolicy<B>, AdditiveCipherTemplate<> > > Encryption;
|
typedef SymmetricCipherFinal<ConcretePolicyHolder<PanamaCipherPolicy<B>, AdditiveCipherTemplate<> >, PanamaCipherInfo<B> > Encryption;
|
||||||
typedef Encryption Decryption;
|
typedef Encryption Decryption;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
3
rc2.h
3
rc2.h
|
|
@ -13,7 +13,8 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||||
//! _
|
//! _
|
||||||
struct RC2_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 1, 128>
|
struct RC2_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 1, 128>
|
||||||
{
|
{
|
||||||
enum {DEFAULT_EFFECTIVE_KEYLENGTH = 1024, MAX_EFFECTIVE_KEYLENGTH = 1024};
|
CRYPTOPP_CONSTANT(DEFAULT_EFFECTIVE_KEYLENGTH = 1024)
|
||||||
|
CRYPTOPP_CONSTANT(MAX_EFFECTIVE_KEYLENGTH = 1024)
|
||||||
static const char *StaticAlgorithmName() {return "RC2";}
|
static const char *StaticAlgorithmName() {return "RC2";}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,6 @@ void Rijndael::Base::UncheckedSetKey(const byte *userKey, unsigned int keylen, c
|
||||||
|
|
||||||
word32 temp, *rk = m_key;
|
word32 temp, *rk = m_key;
|
||||||
const word32 *rc = rcon;
|
const word32 *rc = rcon;
|
||||||
unsigned int i=0;
|
|
||||||
|
|
||||||
GetUserKey(BIG_ENDIAN_ORDER, rk, keylen/4, userKey, keylen);
|
GetUserKey(BIG_ENDIAN_ORDER, rk, keylen/4, userKey, keylen);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ void Salsa20_TestInstantiations()
|
||||||
Salsa20::Encryption x;
|
Salsa20::Encryption x;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Salsa20_Policy::GetNextIV(byte *IV) const
|
void Salsa20_Policy::CipherGetNextIV(byte *IV)
|
||||||
{
|
{
|
||||||
word32 j6 = m_state[6] + 1;
|
word32 j6 = m_state[6] + 1;
|
||||||
word32 j7 = m_state[7] + (j6 == 0);
|
word32 j7 = m_state[7] + (j6 == 0);
|
||||||
|
|
|
||||||
7
salsa.h
7
salsa.h
|
|
@ -8,20 +8,17 @@
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
//! _
|
//! _
|
||||||
struct Salsa20_Info : public VariableKeyLength<32, 16, 32, 16, SimpleKeyingInterface::STRUCTURED_IV>
|
struct Salsa20_Info : public VariableKeyLength<32, 16, 32, 16, SimpleKeyingInterface::STRUCTURED_IV, 8>
|
||||||
{
|
{
|
||||||
static const char *StaticAlgorithmName() {return "Salsa20";}
|
static const char *StaticAlgorithmName() {return "Salsa20";}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CRYPTOPP_NO_VTABLE Salsa20_Policy : public AdditiveCipherConcretePolicy<word32, 16>, public Salsa20_Info
|
class CRYPTOPP_NO_VTABLE Salsa20_Policy : public AdditiveCipherConcretePolicy<word32, 16>, public Salsa20_Info
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
unsigned int IVSize() const {return 8;}
|
|
||||||
void GetNextIV(byte *IV) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
|
void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
|
||||||
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
|
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
|
||||||
|
void CipherGetNextIV(byte *IV);
|
||||||
void CipherResynchronize(byte *keystreamBuffer, const byte *IV);
|
void CipherResynchronize(byte *keystreamBuffer, const byte *IV);
|
||||||
bool IsRandomAccess() const {return true;}
|
bool IsRandomAccess() const {return true;}
|
||||||
void SeekToIteration(lword iterationCount);
|
void SeekToIteration(lword iterationCount);
|
||||||
|
|
|
||||||
7
seal.h
7
seal.h
|
|
@ -7,7 +7,7 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
//! _
|
//! _
|
||||||
template <class B = BigEndian>
|
template <class B = BigEndian>
|
||||||
struct SEAL_Info : public FixedKeyLength<20, SimpleKeyingInterface::INTERNALLY_GENERATED_IV>
|
struct SEAL_Info : public FixedKeyLength<20, SimpleKeyingInterface::INTERNALLY_GENERATED_IV, 4>
|
||||||
{
|
{
|
||||||
static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "SEAL-3.0-LE" : "SEAL-3.0-BE";}
|
static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "SEAL-3.0-LE" : "SEAL-3.0-BE";}
|
||||||
};
|
};
|
||||||
|
|
@ -15,13 +15,10 @@ struct SEAL_Info : public FixedKeyLength<20, SimpleKeyingInterface::INTERNALLY_G
|
||||||
template <class B = BigEndian>
|
template <class B = BigEndian>
|
||||||
class CRYPTOPP_NO_VTABLE SEAL_Policy : public AdditiveCipherConcretePolicy<word32, 256>, public SEAL_Info<B>
|
class CRYPTOPP_NO_VTABLE SEAL_Policy : public AdditiveCipherConcretePolicy<word32, 256>, public SEAL_Info<B>
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
unsigned int IVSize() const {return 4;}
|
|
||||||
void GetNextIV(byte *IV) const {UnalignedPutWord(BIG_ENDIAN_ORDER, IV, m_outsideCounter+1);}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
|
void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
|
||||||
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
|
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
|
||||||
|
void CipherGetNextIV(byte *IV) {UnalignedPutWord(BIG_ENDIAN_ORDER, IV, m_outsideCounter+1);}
|
||||||
void CipherResynchronize(byte *keystreamBuffer, const byte *IV);
|
void CipherResynchronize(byte *keystreamBuffer, const byte *IV);
|
||||||
bool IsRandomAccess() const {return true;}
|
bool IsRandomAccess() const {return true;}
|
||||||
void SeekToIteration(lword iterationCount);
|
void SeekToIteration(lword iterationCount);
|
||||||
|
|
|
||||||
10
secblock.h
10
secblock.h
|
|
@ -235,23 +235,17 @@ public:
|
||||||
~SecBlock()
|
~SecBlock()
|
||||||
{m_alloc.deallocate(m_ptr, m_size);}
|
{m_alloc.deallocate(m_ptr, m_size);}
|
||||||
|
|
||||||
|
#ifndef __BORLANDC__
|
||||||
operator const void *() const
|
operator const void *() const
|
||||||
{return m_ptr;}
|
{return m_ptr;}
|
||||||
operator void *()
|
operator void *()
|
||||||
{return m_ptr;}
|
{return m_ptr;}
|
||||||
#if defined(__GNUC__) && __GNUC__ < 3 // reduce warnings
|
|
||||||
operator const void *()
|
|
||||||
{return m_ptr;}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
operator const T *() const
|
operator const T *() const
|
||||||
{return m_ptr;}
|
{return m_ptr;}
|
||||||
|
#endif
|
||||||
operator T *()
|
operator T *()
|
||||||
{return m_ptr;}
|
{return m_ptr;}
|
||||||
#if defined(__GNUC__) && __GNUC__ < 3 // reduce warnings
|
|
||||||
operator const T *()
|
|
||||||
{return m_ptr;}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// T *operator +(size_type offset)
|
// T *operator +(size_type offset)
|
||||||
// {return m_ptr+offset;}
|
// {return m_ptr+offset;}
|
||||||
|
|
|
||||||
42
seckey.h
42
seckey.h
|
|
@ -21,7 +21,7 @@ template <unsigned int N>
|
||||||
class FixedBlockSize
|
class FixedBlockSize
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum {BLOCKSIZE = N};
|
CRYPTOPP_CONSTANT(BLOCKSIZE = N)
|
||||||
};
|
};
|
||||||
|
|
||||||
// ************** rounds ***************
|
// ************** rounds ***************
|
||||||
|
|
@ -31,7 +31,7 @@ template <unsigned int R>
|
||||||
class FixedRounds
|
class FixedRounds
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum {ROUNDS = R};
|
CRYPTOPP_CONSTANT(ROUNDS = R)
|
||||||
};
|
};
|
||||||
|
|
||||||
//! to be inherited by ciphers with variable number of rounds
|
//! to be inherited by ciphers with variable number of rounds
|
||||||
|
|
@ -39,7 +39,9 @@ template <unsigned int D, unsigned int N=1, unsigned int M=INT_MAX> // use INT_
|
||||||
class VariableRounds
|
class VariableRounds
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum {DEFAULT_ROUNDS = D, MIN_ROUNDS = N, MAX_ROUNDS = M};
|
CRYPTOPP_CONSTANT(DEFAULT_ROUNDS = D)
|
||||||
|
CRYPTOPP_CONSTANT(MIN_ROUNDS = N)
|
||||||
|
CRYPTOPP_CONSTANT(MAX_ROUNDS = M)
|
||||||
static unsigned int StaticGetDefaultRounds(size_t keylength) {return DEFAULT_ROUNDS;}
|
static unsigned int StaticGetDefaultRounds(size_t keylength) {return DEFAULT_ROUNDS;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -65,17 +67,21 @@ protected:
|
||||||
// ************** key length ***************
|
// ************** key length ***************
|
||||||
|
|
||||||
//! to be inherited by keyed algorithms with fixed key length
|
//! to be inherited by keyed algorithms with fixed key length
|
||||||
template <unsigned int N, unsigned int IV_REQ = SimpleKeyingInterface::NOT_RESYNCHRONIZABLE>
|
template <unsigned int N, unsigned int IV_REQ = SimpleKeyingInterface::NOT_RESYNCHRONIZABLE, unsigned int IV_L = 0>
|
||||||
class FixedKeyLength
|
class FixedKeyLength
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum {KEYLENGTH=N, MIN_KEYLENGTH=N, MAX_KEYLENGTH=N, DEFAULT_KEYLENGTH=N};
|
CRYPTOPP_CONSTANT(KEYLENGTH=N)
|
||||||
enum {IV_REQUIREMENT = IV_REQ};
|
CRYPTOPP_CONSTANT(MIN_KEYLENGTH=N)
|
||||||
|
CRYPTOPP_CONSTANT(MAX_KEYLENGTH=N)
|
||||||
|
CRYPTOPP_CONSTANT(DEFAULT_KEYLENGTH=N)
|
||||||
|
CRYPTOPP_CONSTANT(IV_REQUIREMENT = IV_REQ)
|
||||||
|
CRYPTOPP_CONSTANT(IV_LENGTH = IV_L)
|
||||||
static size_t CRYPTOPP_API StaticGetValidKeyLength(size_t) {return KEYLENGTH;}
|
static size_t CRYPTOPP_API StaticGetValidKeyLength(size_t) {return KEYLENGTH;}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// support query of variable key length, template parameters are default, min, max, multiple (default multiple 1)
|
/// support query of variable key length, template parameters are default, min, max, multiple (default multiple 1)
|
||||||
template <unsigned int D, unsigned int N, unsigned int M, unsigned int Q = 1, unsigned int IV_REQ = SimpleKeyingInterface::NOT_RESYNCHRONIZABLE>
|
template <unsigned int D, unsigned int N, unsigned int M, unsigned int Q = 1, unsigned int IV_REQ = SimpleKeyingInterface::NOT_RESYNCHRONIZABLE, unsigned int IV_L = 0>
|
||||||
class VariableKeyLength
|
class VariableKeyLength
|
||||||
{
|
{
|
||||||
// make these private to avoid Doxygen documenting them in all derived classes
|
// make these private to avoid Doxygen documenting them in all derived classes
|
||||||
|
|
@ -83,11 +89,17 @@ class VariableKeyLength
|
||||||
CRYPTOPP_COMPILE_ASSERT(N % Q == 0);
|
CRYPTOPP_COMPILE_ASSERT(N % Q == 0);
|
||||||
CRYPTOPP_COMPILE_ASSERT(M % Q == 0);
|
CRYPTOPP_COMPILE_ASSERT(M % Q == 0);
|
||||||
CRYPTOPP_COMPILE_ASSERT(N < M);
|
CRYPTOPP_COMPILE_ASSERT(N < M);
|
||||||
CRYPTOPP_COMPILE_ASSERT(D >= N && M >= D);
|
CRYPTOPP_COMPILE_ASSERT(D >= N);
|
||||||
|
CRYPTOPP_COMPILE_ASSERT(M >= D);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum {MIN_KEYLENGTH=N, MAX_KEYLENGTH=M, DEFAULT_KEYLENGTH=D, KEYLENGTH_MULTIPLE=Q};
|
CRYPTOPP_CONSTANT(MIN_KEYLENGTH=N)
|
||||||
enum {IV_REQUIREMENT = IV_REQ};
|
CRYPTOPP_CONSTANT(MAX_KEYLENGTH=M)
|
||||||
|
CRYPTOPP_CONSTANT(DEFAULT_KEYLENGTH=D)
|
||||||
|
CRYPTOPP_CONSTANT(KEYLENGTH_MULTIPLE=Q)
|
||||||
|
CRYPTOPP_CONSTANT(IV_REQUIREMENT=IV_REQ)
|
||||||
|
CRYPTOPP_CONSTANT(IV_LENGTH=IV_L)
|
||||||
|
|
||||||
static size_t CRYPTOPP_API StaticGetValidKeyLength(size_t n)
|
static size_t CRYPTOPP_API StaticGetValidKeyLength(size_t n)
|
||||||
{
|
{
|
||||||
if (n < (size_t)MIN_KEYLENGTH)
|
if (n < (size_t)MIN_KEYLENGTH)
|
||||||
|
|
@ -107,13 +119,16 @@ template <class T>
|
||||||
class SameKeyLengthAs
|
class SameKeyLengthAs
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum {MIN_KEYLENGTH=T::MIN_KEYLENGTH, MAX_KEYLENGTH=T::MAX_KEYLENGTH, DEFAULT_KEYLENGTH=T::DEFAULT_KEYLENGTH};
|
CRYPTOPP_CONSTANT(MIN_KEYLENGTH=T::MIN_KEYLENGTH)
|
||||||
enum {IV_REQUIREMENT = T::IV_REQUIREMENT};
|
CRYPTOPP_CONSTANT(MAX_KEYLENGTH=T::MAX_KEYLENGTH)
|
||||||
|
CRYPTOPP_CONSTANT(DEFAULT_KEYLENGTH=T::DEFAULT_KEYLENGTH)
|
||||||
|
CRYPTOPP_CONSTANT(IV_REQUIREMENT = T::IV_REQUIREMENT)
|
||||||
|
CRYPTOPP_CONSTANT(IV_LENGTH = T::IV_LENGTH)
|
||||||
static size_t CRYPTOPP_API StaticGetValidKeyLength(size_t keylength)
|
static size_t CRYPTOPP_API StaticGetValidKeyLength(size_t keylength)
|
||||||
{return T::StaticGetValidKeyLength(keylength);}
|
{return T::StaticGetValidKeyLength(keylength);}
|
||||||
};
|
};
|
||||||
|
|
||||||
// ************** implementation helper for SimpledKeyed ***************
|
// ************** implementation helper for SimpleKeyed ***************
|
||||||
|
|
||||||
//! _
|
//! _
|
||||||
template <class BASE, class INFO = BASE>
|
template <class BASE, class INFO = BASE>
|
||||||
|
|
@ -125,6 +140,7 @@ public:
|
||||||
size_t DefaultKeyLength() const {return INFO::DEFAULT_KEYLENGTH;}
|
size_t DefaultKeyLength() const {return INFO::DEFAULT_KEYLENGTH;}
|
||||||
size_t GetValidKeyLength(size_t n) const {return INFO::StaticGetValidKeyLength(n);}
|
size_t GetValidKeyLength(size_t n) const {return INFO::StaticGetValidKeyLength(n);}
|
||||||
typename BASE::IV_Requirement IVRequirement() const {return (typename BASE::IV_Requirement)INFO::IV_REQUIREMENT;}
|
typename BASE::IV_Requirement IVRequirement() const {return (typename BASE::IV_Requirement)INFO::IV_REQUIREMENT;}
|
||||||
|
unsigned int IVSize() const {return INFO::IV_LENGTH;}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class INFO, class BASE = BlockCipher>
|
template <class INFO, class BASE = BlockCipher>
|
||||||
|
|
|
||||||
12
simple.h
12
simple.h
|
|
@ -199,17 +199,7 @@ protected:
|
||||||
//! A BufferedTransformation that doesn't produce any retrievable output
|
//! A BufferedTransformation that doesn't produce any retrievable output
|
||||||
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Sink : public BufferedTransformation
|
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Sink : public BufferedTransformation
|
||||||
{
|
{
|
||||||
protected:
|
public:
|
||||||
// make these functions protected to help prevent unintentional calls to them
|
|
||||||
BufferedTransformation::Get;
|
|
||||||
BufferedTransformation::Peek;
|
|
||||||
BufferedTransformation::TransferTo;
|
|
||||||
BufferedTransformation::CopyTo;
|
|
||||||
BufferedTransformation::CopyRangeTo;
|
|
||||||
BufferedTransformation::TransferMessagesTo;
|
|
||||||
BufferedTransformation::CopyMessagesTo;
|
|
||||||
BufferedTransformation::TransferAllTo;
|
|
||||||
BufferedTransformation::CopyAllTo;
|
|
||||||
size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=NULL_CHANNEL, bool blocking=true)
|
size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=NULL_CHANNEL, bool blocking=true)
|
||||||
{transferBytes = 0; return 0;}
|
{transferBytes = 0; return 0;}
|
||||||
size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=NULL_CHANNEL, bool blocking=true) const
|
size_t CopyRangeTo2(BufferedTransformation &target, lword &begin, lword end=LWORD_MAX, const std::string &channel=NULL_CHANNEL, bool blocking=true) const
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,8 @@ public:
|
||||||
#ifdef USE_WINDOWS_STYLE_SOCKETS
|
#ifdef USE_WINDOWS_STYLE_SOCKETS
|
||||||
void CheckAndHandleError(const char *operation, BOOL result) const
|
void CheckAndHandleError(const char *operation, BOOL result) const
|
||||||
{assert(result==TRUE || result==FALSE); if (!result) HandleError(operation);}
|
{assert(result==TRUE || result==FALSE); if (!result) HandleError(operation);}
|
||||||
|
void CheckAndHandleError(const char *operation, bool result) const
|
||||||
|
{if (!result) HandleError(operation);}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//! look up the port number given its name, returns 0 if not found
|
//! look up the port number given its name, returns 0 if not found
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ byte AdditiveCipherTemplate<S>::GenerateByte()
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class S>
|
template <class S>
|
||||||
inline void AdditiveCipherTemplate<S>::ProcessData(byte *outString, const byte *inString, size_t length)
|
void AdditiveCipherTemplate<S>::ProcessData(byte *outString, const byte *inString, size_t length)
|
||||||
{
|
{
|
||||||
if (m_leftOver > 0)
|
if (m_leftOver > 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,8 @@ struct CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AdditiveCipherAbstractPolicy
|
||||||
virtual bool CanOperateKeystream() const {return false;}
|
virtual bool CanOperateKeystream() const {return false;}
|
||||||
virtual void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount) {assert(false);}
|
virtual void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount) {assert(false);}
|
||||||
virtual void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length) =0;
|
virtual void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length) =0;
|
||||||
virtual void CipherResynchronize(byte *keystreamBuffer, const byte *iv) {throw NotImplemented("StreamTransformation: this object doesn't support resynchronization");}
|
virtual void CipherGetNextIV(byte *iv) {throw NotImplemented("SimpleKeyingInterface: this object doesn't support GetNextIV()");}
|
||||||
|
virtual void CipherResynchronize(byte *keystreamBuffer, const byte *iv) {throw NotImplemented("SimpleKeyingInterface: this object doesn't support resynchronization");}
|
||||||
virtual bool IsRandomAccess() const =0;
|
virtual bool IsRandomAccess() const =0;
|
||||||
virtual void SeekToIteration(lword iterationCount) {assert(!IsRandomAccess()); throw NotImplemented("StreamTransformation: this object doesn't support random access");}
|
virtual void SeekToIteration(lword iterationCount) {assert(!IsRandomAccess()); throw NotImplemented("StreamTransformation: this object doesn't support random access");}
|
||||||
};
|
};
|
||||||
|
|
@ -123,6 +124,7 @@ class CRYPTOPP_NO_VTABLE AdditiveCipherTemplate : public BASE
|
||||||
public:
|
public:
|
||||||
byte GenerateByte();
|
byte GenerateByte();
|
||||||
void ProcessData(byte *outString, const byte *inString, size_t length);
|
void ProcessData(byte *outString, const byte *inString, size_t length);
|
||||||
|
void GetNextIV(byte *iv) {this->AccessPolicy().CipherGetNextIV(iv);}
|
||||||
void Resynchronize(const byte *iv);
|
void Resynchronize(const byte *iv);
|
||||||
unsigned int OptimalBlockSize() const {return this->GetPolicy().GetBytesPerIteration();}
|
unsigned int OptimalBlockSize() const {return this->GetPolicy().GetBytesPerIteration();}
|
||||||
unsigned int GetOptimalNextBlockSize() const {return (unsigned int)this->m_leftOver;}
|
unsigned int GetOptimalNextBlockSize() const {return (unsigned int)this->m_leftOver;}
|
||||||
|
|
@ -156,7 +158,8 @@ public:
|
||||||
virtual bool CanIterate() const {return false;}
|
virtual bool CanIterate() const {return false;}
|
||||||
virtual void Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount) {assert(false);}
|
virtual void Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount) {assert(false);}
|
||||||
virtual void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length) =0;
|
virtual void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length) =0;
|
||||||
virtual void CipherResynchronize(const byte *iv) {throw NotImplemented("StreamTransformation: this object doesn't support resynchronization");}
|
virtual void CipherGetNextIV(byte *iv) {throw NotImplemented("SimpleKeyingInterface: this object doesn't support GetNextIV()");}
|
||||||
|
virtual void CipherResynchronize(const byte *iv) {throw NotImplemented("SimpleKeyingInterface: this object doesn't support resynchronization");}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename WT, unsigned int W, class BASE = CFB_CipherAbstractPolicy>
|
template <typename WT, unsigned int W, class BASE = CFB_CipherAbstractPolicy>
|
||||||
|
|
@ -221,6 +224,7 @@ class CRYPTOPP_NO_VTABLE CFB_CipherTemplate : public BASE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void ProcessData(byte *outString, const byte *inString, size_t length);
|
void ProcessData(byte *outString, const byte *inString, size_t length);
|
||||||
|
void GetNextIV(byte *iv) {this->AccessPolicy().CipherGetNextIV(iv);}
|
||||||
void Resynchronize(const byte *iv);
|
void Resynchronize(const byte *iv);
|
||||||
unsigned int OptimalBlockSize() const {return this->GetPolicy().GetBytesPerIteration();}
|
unsigned int OptimalBlockSize() const {return this->GetPolicy().GetBytesPerIteration();}
|
||||||
unsigned int GetOptimalNextBlockSize() const {return (unsigned int)m_leftOver;}
|
unsigned int GetOptimalNextBlockSize() const {return (unsigned int)m_leftOver;}
|
||||||
|
|
|
||||||
9
test.cpp
9
test.cpp
|
|
@ -39,6 +39,11 @@
|
||||||
#include <console.h>
|
#include <console.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma comment(lib, "cryptlib_bds.lib")
|
||||||
|
#pragma comment(lib, "ws2_32.lib")
|
||||||
|
#endif
|
||||||
|
|
||||||
USING_NAMESPACE(CryptoPP)
|
USING_NAMESPACE(CryptoPP)
|
||||||
USING_NAMESPACE(std)
|
USING_NAMESPACE(std)
|
||||||
|
|
||||||
|
|
@ -84,11 +89,7 @@ bool Validate(int, bool, const char *);
|
||||||
|
|
||||||
int (*AdhocTest)(int argc, char *argv[]) = NULL;
|
int (*AdhocTest)(int argc, char *argv[]) = NULL;
|
||||||
|
|
||||||
#ifdef __BCPLUSPLUS__
|
|
||||||
int cmain(int argc, char *argv[])
|
|
||||||
#else
|
|
||||||
int CRYPTOPP_API main(int argc, char *argv[])
|
int CRYPTOPP_API main(int argc, char *argv[])
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifdef _CRTDBG_LEAK_CHECK_DF
|
#ifdef _CRTDBG_LEAK_CHECK_DF
|
||||||
// Turn on leak-checking
|
// Turn on leak-checking
|
||||||
|
|
|
||||||
2
ttmac.h
2
ttmac.h
|
|
@ -13,7 +13,7 @@ class CRYPTOPP_NO_VTABLE TTMAC_Base : public FixedKeyLength<20>, public Iterated
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::string StaticAlgorithmName() {return std::string("Two-Track-MAC");}
|
static std::string StaticAlgorithmName() {return std::string("Two-Track-MAC");}
|
||||||
enum {DIGESTSIZE=20};
|
CRYPTOPP_CONSTANT(DIGESTSIZE=20)
|
||||||
|
|
||||||
TTMAC_Base() {SetStateSize(DIGESTSIZE*2);}
|
TTMAC_Base() {SetStateSize(DIGESTSIZE*2);}
|
||||||
|
|
||||||
|
|
|
||||||
13
xormac.h
13
xormac.h
|
|
@ -10,7 +10,10 @@
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
template <class T> struct DigestSizeSubtract4Workaround {enum {RESULT = T::DIGESTSIZE-4};}; // VC60 workaround
|
template <class T> struct DigestSizeSubtract4Workaround // VC60 workaround
|
||||||
|
{
|
||||||
|
CRYPTOPP_CONSTANT(RESULT = T::DIGESTSIZE-4);
|
||||||
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class CRYPTOPP_NO_VTABLE XMACC_Base : public FixedKeyLength<DigestSizeSubtract4Workaround<T>::RESULT, SimpleKeyingInterface::INTERNALLY_GENERATED_IV>,
|
class CRYPTOPP_NO_VTABLE XMACC_Base : public FixedKeyLength<DigestSizeSubtract4Workaround<T>::RESULT, SimpleKeyingInterface::INTERNALLY_GENERATED_IV>,
|
||||||
|
|
@ -18,7 +21,7 @@ class CRYPTOPP_NO_VTABLE XMACC_Base : public FixedKeyLength<DigestSizeSubtract4W
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::string StaticAlgorithmName() {return std::string("XMAC(") + T::StaticAlgorithmName() + ")";}
|
static std::string StaticAlgorithmName() {return std::string("XMAC(") + T::StaticAlgorithmName() + ")";}
|
||||||
enum {DIGESTSIZE = 4+T::DIGESTSIZE};
|
CRYPTOPP_CONSTANT(DIGESTSIZE = 4+T::DIGESTSIZE)
|
||||||
typedef typename T::HashWordType HashWordType;
|
typedef typename T::HashWordType HashWordType;
|
||||||
|
|
||||||
XMACC_Base() {SetStateSize(T::DIGESTSIZE);}
|
XMACC_Base() {SetStateSize(T::DIGESTSIZE);}
|
||||||
|
|
@ -51,8 +54,12 @@ private:
|
||||||
void HashEndianCorrectedBlock(const HashWordType *data);
|
void HashEndianCorrectedBlock(const HashWordType *data);
|
||||||
|
|
||||||
FixedSizeSecBlock<byte, DigestSizeSubtract4Workaround<T>::RESULT> m_key;
|
FixedSizeSecBlock<byte, DigestSizeSubtract4Workaround<T>::RESULT> m_key;
|
||||||
enum {BUFFER_SIZE = ((T::DIGESTSIZE) / sizeof(HashWordType))}; // VC60 workaround
|
CRYPTOPP_CONSTANT(BUFFER_SIZE = (T::DIGESTSIZE / sizeof(HashWordType))); // VC60 workaround
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
FixedSizeSecBlock<HashWordType, T::DIGESTSIZE / sizeof(HashWordType)> m_buffer;
|
||||||
|
#else
|
||||||
FixedSizeSecBlock<HashWordType, BUFFER_SIZE> m_buffer;
|
FixedSizeSecBlock<HashWordType, BUFFER_SIZE> m_buffer;
|
||||||
|
#endif
|
||||||
word32 m_counter, m_index;
|
word32 m_counter, m_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue