summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2006-12-14 11:41:39 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2006-12-14 11:41:39 +0000
commit085c5b2d0b70a2ff3d9ccf8616a7bdf4abbc957f (patch)
treebe3960f1424e79719ea9c5f6152df003bc1c44f3
parent60b7db799a5d9d607dba4b9a66c4421bb60f2577 (diff)
downloadcryptopp-085c5b2d0b70a2ff3d9ccf8616a7bdf4abbc957f.tar.gz
port to Borland C++Builder 2006
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@260 57ff6487-cd31-0410-9ec3-f628ee90f5f0
-rw-r--r--Readme.txt15
-rw-r--r--adler32.h2
-rw-r--r--algebra.cpp7
-rw-r--r--config.h25
-rw-r--r--crc.h2
-rw-r--r--datatest.cpp6
-rw-r--r--dmac.h2
-rw-r--r--eccrypto.cpp5
-rw-r--r--factory.h4
-rw-r--r--files.cpp1
-rw-r--r--filters.h2
-rw-r--r--gfpcrypt.cpp7
-rw-r--r--haval.h3
-rw-r--r--hmac.cpp6
-rw-r--r--hmac.h19
-rw-r--r--iterhash.h9
-rw-r--r--lubyrack.h9
-rw-r--r--md2.h3
-rw-r--r--md5mac.h2
-rw-r--r--misc.h11
-rw-r--r--modes.cpp2
-rw-r--r--modes.h3
-rw-r--r--panama.h10
-rw-r--r--rc2.h3
-rw-r--r--rijndael.cpp1
-rwxr-xr-xsalsa.cpp2
-rwxr-xr-xsalsa.h7
-rw-r--r--seal.h7
-rw-r--r--secblock.h10
-rw-r--r--seckey.h42
-rw-r--r--simple.h12
-rw-r--r--socketft.h2
-rw-r--r--strciphr.cpp2
-rw-r--r--strciphr.h8
-rw-r--r--test.cpp9
-rw-r--r--ttmac.h2
-rw-r--r--xormac.h13
37 files changed, 158 insertions, 117 deletions
diff --git a/Readme.txt b/Readme.txt
index daf4811..4ea278b 100644
--- a/Readme.txt
+++ b/Readme.txt
@@ -54,12 +54,13 @@ This library includes:
- FIPS 140-2 Validated
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
-and .NET 2003 on Windows XP, GCC 2.95.4 on FreeBSD 4.6, GCC 2.95.3 on
-Linux 2.4 and SunOS 5.8, GCC 3.4 on Cygwin 1.5.10, and Metrowerks
-CodeWarrior 8.3 for Windows and MacOS.
+and .NET 2005 on Windows XP SP2, GCC 3.4.2 on FreeBSD 5.4, GCC 4.1.2 on
+Linux 2.6, GCC 3.4.4 on Cygwin 1.5.21, GCC 3.3 and 4.0.1 on MacOS X 10.4,
+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 ***
@@ -149,8 +150,8 @@ may come up.
If you run into any problems, please try the Crypto++ mailing list.
The subscription information and the list archive are available on
-http://www.cryptopp.com. You can also email me directly at
-cryptopp@weidai.com, but you will probably get a faster response through
+http://www.cryptopp.com. You can also email me directly by visiting
+http://www.weidai.com, but you will probably get a faster response through
the mailing list.
*** History ***
@@ -356,6 +357,6 @@ the mailing list.
5.4 - added Salsa20
- 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
diff --git a/adler32.h b/adler32.h
index 28c309b..bff6b35 100644
--- a/adler32.h
+++ b/adler32.h
@@ -9,7 +9,7 @@ NAMESPACE_BEGIN(CryptoPP)
class Adler32 : public HashTransformation
{
public:
- enum {DIGESTSIZE = 4};
+ CRYPTOPP_CONSTANT(DIGESTSIZE = 4)
Adler32() {Reset();}
void Update(const byte *input, size_t length);
void TruncatedFinal(byte *hash, size_t size);
diff --git a/algebra.cpp b/algebra.cpp
index 599ea32..810a32a 100644
--- a/algebra.cpp
+++ b/algebra.cpp
@@ -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
{
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()};
-#endif
Element y;
unsigned int i0=0, i1=1, i2=2;
diff --git a/config.h b/config.h
index 30414e5..947c607 100644
--- a/config.h
+++ b/config.h
@@ -108,7 +108,7 @@ typedef unsigned int word32;
#define WORD64_AVAILABLE
typedef unsigned long long word64;
#define W64LIT(x) x##LL
-#elif defined(_MSC_VER) || defined(__BCPLUSPLUS__)
+#elif defined(_MSC_VER) || defined(__BORLANDC__)
#define WORD64_AVAILABLE
typedef unsigned __int64 word64;
#define W64LIT(x) x##ui64
@@ -138,7 +138,7 @@ typedef unsigned int word32;
typedef word32 word;
typedef word64 dword;
#else
- typedef word8 hword;
+ typedef byte hword;
typedef word16 word;
typedef word32 dword;
#endif
@@ -147,7 +147,7 @@ typedef unsigned int word32;
const unsigned int WORD_SIZE = sizeof(word);
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 FAST_ROTATE
#elif defined(__MWERKS__) && TARGET_CPU_PPC
@@ -165,10 +165,12 @@ const unsigned int WORD_BITS = WORD_SIZE * 8;
#endif
#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
#elif defined(__GNUC__)
#define CRYPTOPP_L1_CACHE_ALIGN(x) x __attribute__((aligned(CRYPTOPP_L1_CACHE_LINE_SIZE)))
+ #else
+ #define CRYPTOPP_L1_CACHE_ALIGN(x) x
#endif
#endif
@@ -199,6 +201,11 @@ NAMESPACE_END
# pragma warning(disable: 4231 4250 4251 4275 4660 4661 4786 4355)
#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)
#define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
#endif
@@ -224,6 +231,12 @@ NAMESPACE_END
# define CRYPTOPP_NOINLINE
#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 ********************
@@ -316,6 +329,8 @@ NAMESPACE_END
#if defined(__MWERKS__)
#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
+#elif defined(__BORLANDC__)
+#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
#else
#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
#endif
@@ -328,6 +343,8 @@ NAMESPACE_END
#if defined(__MWERKS__)
#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class
+#elif defined(__BORLANDC__)
+#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class
#else
#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class
#endif
diff --git a/crc.h b/crc.h
index 1696174..23f1461 100644
--- a/crc.h
+++ b/crc.h
@@ -19,7 +19,7 @@ const word32 CRC32_NEGL = 0xffffffffL;
class CRC32 : public HashTransformation
{
public:
- enum {DIGESTSIZE = 4};
+ CRYPTOPP_CONSTANT(DIGESTSIZE = 4)
CRC32();
void Update(const byte *input, size_t length);
void TruncatedFinal(byte *hash, size_t size);
diff --git a/datatest.cpp b/datatest.cpp
index 4a2d950..1942326 100644
--- a/datatest.cpp
+++ b/datatest.cpp
@@ -264,6 +264,9 @@ void TestSymmetricCipher(TestData &v)
if (test == "Encrypt")
{
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);
int seek = pairs.GetIntValueWithDefault("Seek", 0);
if (seek)
@@ -276,6 +279,9 @@ void TestSymmetricCipher(TestData &v)
else if (test == "Decrypt")
{
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);
int seek = pairs.GetIntValueWithDefault("Seek", 0);
if (seek)
diff --git a/dmac.h b/dmac.h
index c0f81b3..6d4c0b7 100644
--- a/dmac.h
+++ b/dmac.h
@@ -12,7 +12,7 @@ class CRYPTOPP_NO_VTABLE DMAC_Base : public SameKeyLengthAs<T>, public MessageAu
public:
static std::string StaticAlgorithmName() {return std::string("DMAC(") + T::StaticAlgorithmName() + ")";}
- enum {DIGESTSIZE=T::BLOCKSIZE};
+ CRYPTOPP_CONSTANT(DIGESTSIZE=T::BLOCKSIZE)
DMAC_Base() {}
diff --git a/eccrypto.cpp b/eccrypto.cpp
index 74cb95e..876ee79 100644
--- a/eccrypto.cpp
+++ b/eccrypto.cpp
@@ -535,10 +535,11 @@ bool DL_GroupParameters_EC<EC>::ValidateElement(unsigned int level, const Elemen
if (gpc)
pass = pass && gpc->Exponentiate(this->GetGroupPrecomputation(), Integer::One()) == g;
}
- if (level >= 2)
+ if (level >= 2 && pass)
{
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;
}
diff --git a/factory.h b/factory.h
index 50e4313..ad8a84f 100644
--- a/factory.h
+++ b/factory.h
@@ -84,8 +84,10 @@ template <class AbstractClass, class ConcreteClass, int instance = 0>
struct RegisterDefaultFactoryFor {
RegisterDefaultFactoryFor(const char *name=NULL)
{
+ // BCB2006 workaround
+ std::string n = name ? std::string(name) : std::string(ConcreteClass::StaticAlgorithmName());
ObjectFactoryRegistry<AbstractClass, instance>::Registry().
- RegisterFactory(name ? name : ConcreteClass::StaticAlgorithmName(), new DefaultObjectFactory<AbstractClass, ConcreteClass>);
+ RegisterFactory(n, new DefaultObjectFactory<AbstractClass, ConcreteClass>);
}};
template <class SchemeClass>
diff --git a/files.cpp b/files.cpp
index ac7e0c0..f9fecbe 100644
--- a/files.cpp
+++ b/files.cpp
@@ -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
}
m_stream->seekg(newPosition);
- lword total = 0;
try
{
assert(!m_waiting);
diff --git a/filters.h b/filters.h
index 9cc70ef..fc5c6e8 100644
--- a/filters.h
+++ b/filters.h
@@ -110,7 +110,7 @@ private:
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);}
unsigned int message; lword position; lword size;
};
diff --git a/gfpcrypt.cpp b/gfpcrypt.cpp
index a82c492..6d9ffce 100644
--- a/gfpcrypt.cpp
+++ b/gfpcrypt.cpp
@@ -148,8 +148,11 @@ bool DL_GroupParameters_IntegerBased::ValidateElement(unsigned int level, const
// and at most 1 bit is leaked if it's false
bool fullValidate = (GetFieldType() == 2 && level >= 3) || !FastSubgroupCheckAvailable();
- if (fullValidate)
- pass = pass && IsIdentity(gpc ? gpc->Exponentiate(GetGroupPrecomputation(), q) : ExponentiateElement(g, q));
+ if (fullValidate && pass)
+ {
+ Integer gp = gpc ? gpc->Exponentiate(GetGroupPrecomputation(), q) : ExponentiateElement(g, q);
+ pass = pass && IsIdentity(gp);
+ }
else if (GetFieldType() == 1)
pass = pass && Jacobi(g, p) == 1;
}
diff --git a/haval.h b/haval.h
index c9860aa..d3fb4c3 100644
--- a/haval.h
+++ b/haval.h
@@ -11,7 +11,8 @@ NAMESPACE_BEGIN(CryptoPP)
class HAVAL : public IteratedHash<word32, LittleEndian, 128>
{
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>
/// pass can be 3, 4 or 5 (Default=3)
diff --git a/hmac.cpp b/hmac.cpp
index dc9fc9b..d4a649c 100644
--- a/hmac.cpp
+++ b/hmac.cpp
@@ -20,6 +20,8 @@ void HMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, con
if (!blockSize)
throw InvalidArgument("HMAC: can only be used with a block-based hash function");
+ m_buf.resize(2*AccessHash().BlockSize() + AccessHash().DigestSize());
+
if (keylength <= blockSize)
memcpy(AccessIpad(), userKey, keylength);
else
@@ -33,8 +35,8 @@ void HMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, con
for (unsigned int i=0; i<blockSize; i++)
{
- AccessOpad()[i] = AccessIpad()[i] ^ OPAD;
- AccessIpad()[i] ^= IPAD;
+ AccessOpad()[i] = AccessIpad()[i] ^ 0x5c;
+ AccessIpad()[i] ^= 0x36;
}
}
diff --git a/hmac.h b/hmac.h
index f6b0fb1..62db5ef 100644
--- a/hmac.h
+++ b/hmac.h
@@ -9,7 +9,7 @@
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:
HMAC_Base() : m_innerHashKeyed(false) {}
@@ -23,15 +23,14 @@ public:
protected:
virtual HashTransformation & AccessHash() =0;
- virtual byte * AccessIpad() =0;
- virtual byte * AccessOpad() =0;
- virtual byte * AccessInnerHash() =0;
+ byte * AccessIpad() {return m_buf;}
+ byte * AccessOpad() {return m_buf + AccessHash().BlockSize();}
+ byte * AccessInnerHash() {return m_buf + 2*AccessHash().BlockSize();}
private:
void KeyInnerHash();
- enum {IPAD=0x36, OPAD=0x5c};
-
+ SecByteBlock m_buf;
bool m_innerHashKeyed;
};
@@ -41,7 +40,8 @@ template <class T>
class HMAC : public MessageAuthenticationCodeImpl<HMAC_Base, HMAC<T> >
{
public:
- enum {DIGESTSIZE=T::DIGESTSIZE, BLOCKSIZE=T::BLOCKSIZE};
+ CRYPTOPP_CONSTANT(DIGESTSIZE=T::DIGESTSIZE)
+ CRYPTOPP_CONSTANT(BLOCKSIZE=T::BLOCKSIZE)
HMAC() {}
HMAC(const byte *key, size_t length=HMAC_Base::DEFAULT_KEYLENGTH)
@@ -52,12 +52,7 @@ public:
private:
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;
};
diff --git a/iterhash.h b/iterhash.h
index 2f417ce..7db3c4f 100644
--- a/iterhash.h
+++ b/iterhash.h
@@ -62,8 +62,9 @@ public:
typedef T_Endianness ByteOrderClass;
typedef T_HashWordType HashWordType;
- enum {BLOCKSIZE = T_BlockSize};
- CRYPTOPP_COMPILE_ASSERT((BLOCKSIZE & (BLOCKSIZE - 1)) == 0); // blockSize is a power of 2
+ CRYPTOPP_CONSTANT(BLOCKSIZE = T_BlockSize)
+ // 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();}
@@ -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
: public ClonableImpl<T_Transform, AlgorithmImpl<IteratedHash<T_HashWordType, T_Endianness, T_BlockSize>, T_Transform> >
{
public:
- enum {DIGESTSIZE = T_DigestSize};
+ CRYPTOPP_CONSTANT(DIGESTSIZE = T_DigestSize ? T_DigestSize : T_StateSize)
unsigned int DigestSize() const {return DIGESTSIZE;};
protected:
diff --git a/lubyrack.h b/lubyrack.h
index af3a77b..e8fd2f7 100644
--- a/lubyrack.h
+++ b/lubyrack.h
@@ -10,11 +10,14 @@
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
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();}
};
@@ -38,7 +41,7 @@ class LR : public LR_Info<T>, public BlockCipherDocumentation
}
protected:
- enum {S=T::DIGESTSIZE};
+ CRYPTOPP_CONSTANT(S=T::DIGESTSIZE)
unsigned int L; // key length / 2
SecByteBlock key;
diff --git a/md2.h b/md2.h
index dc28922..a92bf97 100644
--- a/md2.h
+++ b/md2.h
@@ -17,7 +17,8 @@ public:
unsigned int DigestSize() const {return DIGESTSIZE;}
static const char * StaticAlgorithmName() {return "MD2";}
- enum {DIGESTSIZE = 16, BLOCKSIZE = 16};
+ CRYPTOPP_CONSTANT(DIGESTSIZE = 16)
+ CRYPTOPP_CONSTANT(BLOCKSIZE = 16)
private:
void Transform();
diff --git a/md5mac.h b/md5mac.h
index 318dde8..4daa71b 100644
--- a/md5mac.h
+++ b/md5mac.h
@@ -13,7 +13,7 @@ class CRYPTOPP_NO_VTABLE MD5MAC_Base : public FixedKeyLength<16>, public Iterate
{
public:
static std::string StaticAlgorithmName() {return "MD5-MAC";}
- enum {DIGESTSIZE = 16};
+ CRYPTOPP_CONSTANT(DIGESTSIZE = 16)
MD5MAC_Base() {SetStateSize(DIGESTSIZE);}
diff --git a/misc.h b/misc.h
index 1c81258..2c71deb 100644
--- a/misc.h
+++ b/misc.h
@@ -8,6 +8,10 @@
#include <stdlib.h>
#endif
+#ifdef __BORLANDC__
+#include <mem.h>
+#endif
+
NAMESPACE_BEGIN(CryptoPP)
// ************** compile-time assertion ***************
@@ -291,6 +295,8 @@ inline unsigned int GetAlignment(T *dummy=NULL) // VC60 workaround
return __alignof(T);
#elif defined(__GNUC__)
return __alignof__(T);
+#elif defined(CRYPTOPP_SLOW_WORD64)
+ return UnsignedMin(4U, sizeof(T));
#else
return sizeof(T);
#endif
@@ -370,7 +376,7 @@ inline void IncrementCounterByOne(byte *output, const byte *input, unsigned int
{
int i, carry;
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);
}
@@ -543,7 +549,7 @@ inline byte BitReverse(byte value)
{
value = ((value & 0xAA) >> 1) | ((value & 0x55) << 1);
value = ((value & 0xCC) >> 2) | ((value & 0x33) << 2);
- return rotlFixed(value, 4);
+ return rotlFixed(value, 4U);
}
inline word16 BitReverse(word16 value)
@@ -796,6 +802,7 @@ inline void PutWord(bool assumeAligned, ByteOrder order, byte *block, T value, c
if (assumeAligned)
{
assert(IsAligned<T>(block));
+ assert(IsAligned<T>(xorBlock));
if (xorBlock)
*reinterpret_cast<T *>(block) = ConditionalByteReverse(order, value) ^ *reinterpret_cast<const T *>(xorBlock);
else
diff --git a/modes.cpp b/modes.cpp
index cdd4c26..295fc34 100644
--- a/modes.cpp
+++ b/modes.cpp
@@ -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());
}
diff --git a/modes.h b/modes.h
index 04e5016..98547d4 100644
--- a/modes.h
+++ b/modes.h
@@ -64,6 +64,7 @@ class CRYPTOPP_NO_VTABLE ModePolicyCommonTemplate : public CipherModeBase, publi
{
unsigned int GetAlignment() const {return m_cipher->BlockAlignment();}
void CipherSetKey(const NameValuePairs &params, const byte *key, size_t length);
+ void CipherGetNextIV(byte *IV) {CipherModeBase::GetNextIV(IV);}
};
template <class POLICY_INTERFACE>
@@ -147,7 +148,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CTR_ModePolicy : public ModePolicyCommonTe
public:
bool IsRandomAccess() const {return true;}
IV_Requirement IVRequirement() const {return STRUCTURED_IV;}
- void GetNextIV(byte *IV);
+ void CipherGetNextIV(byte *IV);
static const char * CRYPTOPP_API StaticAlgorithmName() {return "CTR";}
private:
diff --git a/panama.h b/panama.h
index ffad8ae..1f24609 100644
--- a/panama.h
+++ b/panama.h
@@ -18,9 +18,9 @@ public:
protected:
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;
};
@@ -29,7 +29,7 @@ template <class B = LittleEndian>
class PanamaHash : protected Panama<B>, public AlgorithmImpl<IteratedHash<word32, NativeByteOrder, 32>, PanamaHash<B> >
{
public:
- enum {DIGESTSIZE = 32};
+ CRYPTOPP_CONSTANT(DIGESTSIZE = 32)
PanamaHash() {Panama<B>::Reset();}
unsigned int DigestSize() const {return DIGESTSIZE;}
void TruncatedFinal(byte *hash, size_t size);
@@ -43,7 +43,7 @@ protected:
//! MAC construction using a hermetic hash function
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:
void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params)
@@ -127,7 +127,7 @@ protected:
template <class B = LittleEndian>
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;
};
diff --git a/rc2.h b/rc2.h
index 8a619ab..90c2a06 100644
--- a/rc2.h
+++ b/rc2.h
@@ -13,7 +13,8 @@ NAMESPACE_BEGIN(CryptoPP)
//! _
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";}
};
diff --git a/rijndael.cpp b/rijndael.cpp
index 5749c59..fb79e25 100644
--- a/rijndael.cpp
+++ b/rijndael.cpp
@@ -63,7 +63,6 @@ void Rijndael::Base::UncheckedSetKey(const byte *userKey, unsigned int keylen, c
word32 temp, *rk = m_key;
const word32 *rc = rcon;
- unsigned int i=0;
GetUserKey(BIG_ENDIAN_ORDER, rk, keylen/4, userKey, keylen);
diff --git a/salsa.cpp b/salsa.cpp
index a3c18ef..5a84b73 100755
--- a/salsa.cpp
+++ b/salsa.cpp
@@ -12,7 +12,7 @@ void Salsa20_TestInstantiations()
Salsa20::Encryption x;
}
-void Salsa20_Policy::GetNextIV(byte *IV) const
+void Salsa20_Policy::CipherGetNextIV(byte *IV)
{
word32 j6 = m_state[6] + 1;
word32 j7 = m_state[7] + (j6 == 0);
diff --git a/salsa.h b/salsa.h
index dd66d15..8d6bedf 100755
--- a/salsa.h
+++ b/salsa.h
@@ -8,20 +8,17 @@
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";}
};
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:
void CipherSetKey(const NameValuePairs &params, const byte *key, size_t length);
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
+ void CipherGetNextIV(byte *IV);
void CipherResynchronize(byte *keystreamBuffer, const byte *IV);
bool IsRandomAccess() const {return true;}
void SeekToIteration(lword iterationCount);
diff --git a/seal.h b/seal.h
index fd4ba03..fc53c2f 100644
--- a/seal.h
+++ b/seal.h
@@ -7,7 +7,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! _
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";}
};
@@ -15,13 +15,10 @@ struct SEAL_Info : public FixedKeyLength<20, SimpleKeyingInterface::INTERNALLY_G
template <class B = BigEndian>
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:
void CipherSetKey(const NameValuePairs &params, const byte *key, size_t length);
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);
bool IsRandomAccess() const {return true;}
void SeekToIteration(lword iterationCount);
diff --git a/secblock.h b/secblock.h
index 3095d10..5f0299a 100644
--- a/secblock.h
+++ b/secblock.h
@@ -235,23 +235,17 @@ public:
~SecBlock()
{m_alloc.deallocate(m_ptr, m_size);}
+#ifndef __BORLANDC__
operator const void *() const
{return m_ptr;}
operator void *()
{return m_ptr;}
-#if defined(__GNUC__) && __GNUC__ < 3 // reduce warnings
- operator const void *()
- {return m_ptr;}
-#endif
operator const T *() const
{return m_ptr;}
+#endif
operator T *()
{return m_ptr;}
-#if defined(__GNUC__) && __GNUC__ < 3 // reduce warnings
- operator const T *()
- {return m_ptr;}
-#endif
// T *operator +(size_type offset)
// {return m_ptr+offset;}
diff --git a/seckey.h b/seckey.h
index b5e8824..6fe56b8 100644
--- a/seckey.h
+++ b/seckey.h
@@ -21,7 +21,7 @@ template <unsigned int N>
class FixedBlockSize
{
public:
- enum {BLOCKSIZE = N};
+ CRYPTOPP_CONSTANT(BLOCKSIZE = N)
};
// ************** rounds ***************
@@ -31,7 +31,7 @@ template <unsigned int R>
class FixedRounds
{
public:
- enum {ROUNDS = R};
+ CRYPTOPP_CONSTANT(ROUNDS = R)
};
//! 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
{
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;}
protected:
@@ -65,17 +67,21 @@ protected:
// ************** 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
{
public:
- enum {KEYLENGTH=N, MIN_KEYLENGTH=N, MAX_KEYLENGTH=N, DEFAULT_KEYLENGTH=N};
- enum {IV_REQUIREMENT = IV_REQ};
+ CRYPTOPP_CONSTANT(KEYLENGTH=N)
+ 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;}
};
/// 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
{
// 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(M % Q == 0);
CRYPTOPP_COMPILE_ASSERT(N < M);
- CRYPTOPP_COMPILE_ASSERT(D >= N && M >= D);
+ CRYPTOPP_COMPILE_ASSERT(D >= N);
+ CRYPTOPP_COMPILE_ASSERT(M >= D);
public:
- enum {MIN_KEYLENGTH=N, MAX_KEYLENGTH=M, DEFAULT_KEYLENGTH=D, KEYLENGTH_MULTIPLE=Q};
- enum {IV_REQUIREMENT = IV_REQ};
+ CRYPTOPP_CONSTANT(MIN_KEYLENGTH=N)
+ 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)
{
if (n < (size_t)MIN_KEYLENGTH)
@@ -107,13 +119,16 @@ template <class T>
class SameKeyLengthAs
{
public:
- enum {MIN_KEYLENGTH=T::MIN_KEYLENGTH, MAX_KEYLENGTH=T::MAX_KEYLENGTH, DEFAULT_KEYLENGTH=T::DEFAULT_KEYLENGTH};
- enum {IV_REQUIREMENT = T::IV_REQUIREMENT};
+ CRYPTOPP_CONSTANT(MIN_KEYLENGTH=T::MIN_KEYLENGTH)
+ 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)
{return T::StaticGetValidKeyLength(keylength);}
};
-// ************** implementation helper for SimpledKeyed ***************
+// ************** implementation helper for SimpleKeyed ***************
//! _
template <class BASE, class INFO = BASE>
@@ -125,6 +140,7 @@ public:
size_t DefaultKeyLength() const {return INFO::DEFAULT_KEYLENGTH;}
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;}
+ unsigned int IVSize() const {return INFO::IV_LENGTH;}
};
template <class INFO, class BASE = BlockCipher>
diff --git a/simple.h b/simple.h
index 1710cf5..a37c6d1 100644
--- a/simple.h
+++ b/simple.h
@@ -199,17 +199,7 @@ protected:
//! A BufferedTransformation that doesn't produce any retrievable output
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Sink : public BufferedTransformation
{
-protected:
- // 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;
+public:
size_t TransferTo2(BufferedTransformation &target, lword &transferBytes, const std::string &channel=NULL_CHANNEL, bool blocking=true)
{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
diff --git a/socketft.h b/socketft.h
index d23dd40..e414aa6 100644
--- a/socketft.h
+++ b/socketft.h
@@ -94,6 +94,8 @@ public:
#ifdef USE_WINDOWS_STYLE_SOCKETS
void CheckAndHandleError(const char *operation, BOOL result) const
{assert(result==TRUE || result==FALSE); if (!result) HandleError(operation);}
+ void CheckAndHandleError(const char *operation, bool result) const
+ {if (!result) HandleError(operation);}
#endif
//! look up the port number given its name, returns 0 if not found
diff --git a/strciphr.cpp b/strciphr.cpp
index 61b4df9..8e53e0c 100644
--- a/strciphr.cpp
+++ b/strciphr.cpp
@@ -23,7 +23,7 @@ byte AdditiveCipherTemplate<S>::GenerateByte()
}
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)
{
diff --git a/strciphr.h b/strciphr.h
index e905d7b..ee5ba5d 100644
--- a/strciphr.h
+++ b/strciphr.h
@@ -64,7 +64,8 @@ struct CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AdditiveCipherAbstractPolicy
virtual bool CanOperateKeystream() const {return false;}
virtual void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount) {assert(false);}
virtual void CipherSetKey(const NameValuePairs &params, 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 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:
byte GenerateByte();
void ProcessData(byte *outString, const byte *inString, size_t length);
+ void GetNextIV(byte *iv) {this->AccessPolicy().CipherGetNextIV(iv);}
void Resynchronize(const byte *iv);
unsigned int OptimalBlockSize() const {return this->GetPolicy().GetBytesPerIteration();}
unsigned int GetOptimalNextBlockSize() const {return (unsigned int)this->m_leftOver;}
@@ -156,7 +158,8 @@ public:
virtual bool CanIterate() const {return false;}
virtual void Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount) {assert(false);}
virtual void CipherSetKey(const NameValuePairs &params, 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>
@@ -221,6 +224,7 @@ class CRYPTOPP_NO_VTABLE CFB_CipherTemplate : public BASE
{
public:
void ProcessData(byte *outString, const byte *inString, size_t length);
+ void GetNextIV(byte *iv) {this->AccessPolicy().CipherGetNextIV(iv);}
void Resynchronize(const byte *iv);
unsigned int OptimalBlockSize() const {return this->GetPolicy().GetBytesPerIteration();}
unsigned int GetOptimalNextBlockSize() const {return (unsigned int)m_leftOver;}
diff --git a/test.cpp b/test.cpp
index 7a13bfc..cd7f0e7 100644
--- a/test.cpp
+++ b/test.cpp
@@ -39,6 +39,11 @@
#include <console.h>
#endif
+#ifdef __BORLANDC__
+#pragma comment(lib, "cryptlib_bds.lib")
+#pragma comment(lib, "ws2_32.lib")
+#endif
+
USING_NAMESPACE(CryptoPP)
USING_NAMESPACE(std)
@@ -84,11 +89,7 @@ bool Validate(int, bool, const char *);
int (*AdhocTest)(int argc, char *argv[]) = NULL;
-#ifdef __BCPLUSPLUS__
-int cmain(int argc, char *argv[])
-#else
int CRYPTOPP_API main(int argc, char *argv[])
-#endif
{
#ifdef _CRTDBG_LEAK_CHECK_DF
// Turn on leak-checking
diff --git a/ttmac.h b/ttmac.h
index a8ca6d5..2e9b262 100644
--- a/ttmac.h
+++ b/ttmac.h
@@ -13,7 +13,7 @@ class CRYPTOPP_NO_VTABLE TTMAC_Base : public FixedKeyLength<20>, public Iterated
{
public:
static std::string StaticAlgorithmName() {return std::string("Two-Track-MAC");}
- enum {DIGESTSIZE=20};
+ CRYPTOPP_CONSTANT(DIGESTSIZE=20)
TTMAC_Base() {SetStateSize(DIGESTSIZE*2);}
diff --git a/xormac.h b/xormac.h
index 3afb816..cbd590c 100644
--- a/xormac.h
+++ b/xormac.h
@@ -10,7 +10,10 @@
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>
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:
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;
XMACC_Base() {SetStateSize(T::DIGESTSIZE);}
@@ -51,8 +54,12 @@ private:
void HashEndianCorrectedBlock(const HashWordType *data);
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;
+#endif
word32 m_counter, m_index;
};