Removed VC++ 5.0 and 6.0 workarounds (Issue 342)

This commit is contained in:
Jeffrey Walton 2016-12-03 05:05:56 -05:00
parent bded4d385f
commit ba75834ae9
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
40 changed files with 191 additions and 342 deletions

View File

@ -61,7 +61,7 @@ public:
template <class T> ConstByteArrayParameter(const T &string, bool deepCopy = false)
: m_deepCopy(false), m_data(NULL), m_size(0)
{
CRYPTOPP_COMPILE_ASSERT(sizeof(CPP_TYPENAME T::value_type) == 1);
CRYPTOPP_COMPILE_ASSERT(sizeof(typename T::value_type) == 1);
Assign((const byte *)string.data(), string.size(), deepCopy);
}
@ -235,68 +235,6 @@ GetValueHelperClass<T, T> GetValueHelper(const T *pObject, const char *name, con
// ********************************************************
// VC60 workaround
#if defined(_MSC_VER) && (_MSC_VER < 1300)
template <class R>
R Hack_DefaultValueFromConstReferenceType(const R &)
{
return R();
}
template <class R>
bool Hack_GetValueIntoConstReference(const NameValuePairs &source, const char *name, const R &value)
{
return source.GetValue(name, const_cast<R &>(value));
}
template <class T, class BASE>
class AssignFromHelperClass
{
public:
AssignFromHelperClass(T *pObject, const NameValuePairs &source)
: m_pObject(pObject), m_source(source), m_done(false)
{
if (source.GetThisObject(*pObject))
m_done = true;
else if (typeid(BASE) != typeid(T))
pObject->BASE::AssignFrom(source);
}
template <class R>
AssignFromHelperClass & operator()(const char *name, void (T::*pm)(R)) // VC60 workaround: "const R &" here causes compiler error
{
if (!m_done)
{
R value = Hack_DefaultValueFromConstReferenceType(reinterpret_cast<R>(*(int *)NULL));
if (!Hack_GetValueIntoConstReference(m_source, name, value))
throw InvalidArgument(std::string(typeid(T).name()) + ": Missing required parameter '" + name + "'");
(m_pObject->*pm)(value);
}
return *this;
}
template <class R, class S>
AssignFromHelperClass & operator()(const char *name1, const char *name2, void (T::*pm)(R, S)) // VC60 workaround: "const R &" here causes compiler error
{
if (!m_done)
{
R value1 = Hack_DefaultValueFromConstReferenceType(reinterpret_cast<R>(*(int *)NULL));
if (!Hack_GetValueIntoConstReference(m_source, name1, value1))
throw InvalidArgument(std::string(typeid(T).name()) + ": Missing required parameter '" + name1 + "'");
S value2 = Hack_DefaultValueFromConstReferenceType(reinterpret_cast<S>(*(int *)NULL));
if (!Hack_GetValueIntoConstReference(m_source, name2, value2))
throw InvalidArgument(std::string(typeid(T).name()) + ": Missing required parameter '" + name2 + "'");
(m_pObject->*pm)(value1, value2);
}
return *this;
}
private:
T *m_pObject;
const NameValuePairs &m_source;
bool m_done;
};
#else
template <class T, class BASE>
class AssignFromHelperClass
{
@ -344,7 +282,6 @@ private:
const NameValuePairs &m_source;
bool m_done;
};
#endif
template <class BASE, class T>
AssignFromHelperClass<T, BASE> AssignFromHelper(T *pObject, const NameValuePairs &source, BASE *dummy=NULL)
@ -382,22 +319,6 @@ public:
ParameterNotUsed(const char *name) : Exception(OTHER_ERROR, std::string("AlgorithmParametersBase: parameter \"") + name + "\" not used") {}
};
// this is actually a move, not a copy
AlgorithmParametersBase(const AlgorithmParametersBase &x)
: m_name(x.m_name), m_throwIfNotUsed(x.m_throwIfNotUsed), m_used(x.m_used)
{
m_next.reset(const_cast<AlgorithmParametersBase &>(x).m_next.release());
x.m_used = true;
}
//! \brief Construct a AlgorithmParametersBase
//! \param name the parameter name
//! \param throwIfNotUsed flags indicating whether an exception should be thrown
//! \details If throwIfNotUsed is true, then a ParameterNotUsed exception
//! will be thrown in the destructor if the parameter is not not retrieved.
AlgorithmParametersBase(const char *name, bool throwIfNotUsed)
: m_name(name), m_throwIfNotUsed(throwIfNotUsed), m_used(false) {}
virtual ~AlgorithmParametersBase() CRYPTOPP_THROW
{
#ifdef CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE
@ -416,11 +337,27 @@ public:
#endif
}
// this is actually a move, not a copy
AlgorithmParametersBase(const AlgorithmParametersBase &x)
: m_name(x.m_name), m_throwIfNotUsed(x.m_throwIfNotUsed), m_used(x.m_used)
{
m_next.reset(const_cast<AlgorithmParametersBase &>(x).m_next.release());
x.m_used = true;
}
//! \brief Construct a AlgorithmParametersBase
//! \param name the parameter name
//! \param throwIfNotUsed flags indicating whether an exception should be thrown
//! \details If throwIfNotUsed is true, then a ParameterNotUsed exception
//! will be thrown in the destructor if the parameter is not not retrieved.
AlgorithmParametersBase(const char *name, bool throwIfNotUsed)
: m_name(name), m_throwIfNotUsed(throwIfNotUsed), m_used(false) {}
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const;
protected:
friend class AlgorithmParameters;
void operator=(const AlgorithmParametersBase& rhs); // assignment not allowed, declare this for VC60
void operator=(const AlgorithmParametersBase& rhs); // assignment not allowed, declare this for VC60
virtual void AssignValue(const char *name, const std::type_info &valueType, void *pValue) const =0;
virtual void MoveInto(void *p) const =0; // not really const

View File

@ -206,13 +206,10 @@ void BenchMarkKeying(SimpleKeyingInterface &c, size_t keyLength, const NameValue
OutputResultKeying(iterations, timeTaken);
}
//VC60 workaround: compiler bug triggered without the extra dummy parameters
// on VC60 also needs to be named differently from BenchMarkByName
template <class T_FactoryOutput, class T_Interface>
void BenchMarkByName2(const char *factoryName, size_t keyLength = 0, const char *displayName=NULL, const NameValuePairs &params = g_nullNameValuePairs, T_FactoryOutput *x=NULL, T_Interface *y=NULL)
void BenchMarkByName2(const char *factoryName, size_t keyLength = 0, const char *displayName=NULL, const NameValuePairs &params = g_nullNameValuePairs)
{
CRYPTOPP_UNUSED(x), CRYPTOPP_UNUSED(y), CRYPTOPP_UNUSED(params);
CRYPTOPP_UNUSED(params);
std::string name(factoryName ? factoryName : "");
member_ptr<T_FactoryOutput> obj(ObjectFactoryRegistry<T_FactoryOutput>::Registry().CreateObject(name.c_str()));
@ -229,20 +226,17 @@ void BenchMarkByName2(const char *factoryName, size_t keyLength = 0, const char
BenchMarkKeying(*obj, keyLength, CombinedNameValuePairs(params, MakeParameters(Name::IV(), ConstByteArrayParameter(defaultKey, obj->IVSize()), false)));
}
//VC60 workaround: compiler bug triggered without the extra dummy parameters
template <class T_FactoryOutput>
void BenchMarkByName(const char *factoryName, size_t keyLength = 0, const char *displayName=NULL, const NameValuePairs &params = g_nullNameValuePairs, T_FactoryOutput *x=NULL)
void BenchMarkByName(const char *factoryName, size_t keyLength = 0, const char *displayName=NULL, const NameValuePairs &params = g_nullNameValuePairs)
{
CRYPTOPP_UNUSED(x), CRYPTOPP_UNUSED(params);
BenchMarkByName2<T_FactoryOutput, T_FactoryOutput>(factoryName, keyLength, displayName, params, x, x);
CRYPTOPP_UNUSED(params);
BenchMarkByName2<T_FactoryOutput, T_FactoryOutput>(factoryName, keyLength, displayName, params);
}
template <class T>
void BenchMarkByNameKeyLess(const char *factoryName, const char *displayName=NULL, const NameValuePairs &params = g_nullNameValuePairs, T *x=NULL)
void BenchMarkByNameKeyLess(const char *factoryName, const char *displayName=NULL, const NameValuePairs &params = g_nullNameValuePairs)
{
CRYPTOPP_UNUSED(x), CRYPTOPP_UNUSED(params);
CRYPTOPP_UNUSED(params);
std::string name = factoryName;
if (displayName)
name = displayName;

View File

@ -237,12 +237,9 @@ void BenchMarkAgreement(const char *name, AuthenticatedKeyAgreementDomainWithRol
}
#endif
//VC60 workaround: compiler bug triggered without the extra dummy parameters
template <class SCHEME>
void BenchMarkCrypto(const char *filename, const char *name, double timeTotal, SCHEME *x=NULL)
void BenchMarkCrypto(const char *filename, const char *name, double timeTotal)
{
CRYPTOPP_UNUSED(x);
FileSource f(filename, true, new HexDecoder());
typename SCHEME::Decryptor priv(f);
typename SCHEME::Encryptor pub(priv);
@ -250,12 +247,9 @@ void BenchMarkCrypto(const char *filename, const char *name, double timeTotal, S
BenchMarkDecryption(name, priv, pub, timeTotal);
}
//VC60 workaround: compiler bug triggered without the extra dummy parameters
template <class SCHEME>
void BenchMarkSignature(const char *filename, const char *name, double timeTotal, SCHEME *x=NULL)
void BenchMarkSignature(const char *filename, const char *name, double timeTotal)
{
CRYPTOPP_UNUSED(x);
FileSource f(filename, true, new HexDecoder());
typename SCHEME::Signer priv(f);
typename SCHEME::Verifier pub(priv);
@ -263,12 +257,9 @@ void BenchMarkSignature(const char *filename, const char *name, double timeTotal
BenchMarkVerification(name, priv, pub, timeTotal);
}
//VC60 workaround: compiler bug triggered without the extra dummy parameters
template <class D>
void BenchMarkKeyAgreement(const char *filename, const char *name, double timeTotal, D *x=NULL)
void BenchMarkKeyAgreement(const char *filename, const char *name, double timeTotal)
{
CRYPTOPP_UNUSED(x);
FileSource f(filename, true, new HexDecoder());
D d(f);
BenchMarkKeyGen(name, d, timeTotal);

View File

@ -25,7 +25,7 @@ NAMESPACE_BEGIN(CryptoPP)
// Sun Studio 12.3 and earlier lack SSE2's _mm_set_epi64x. Win32 lacks _mm_set_epi64x (Win64 supplies it except for VS2008).
// Also see http://stackoverflow.com/a/38547909/608639
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && ((__SUNPRO_CC >= 0x5100 && __SUNPRO_CC < 0x5130) || (_MSC_VER >= 1200 && _MSC_VER < 1600) || (defined(_M_IX86) && _MSC_VER >= 1600))
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && ((__SUNPRO_CC >= 0x5100 && __SUNPRO_CC < 0x5130) || (defined(_MSC_VER) && _MSC_VER < 1600) || (defined(_M_IX86) && _MSC_VER >= 1600))
inline __m128i _mm_set_epi64x(const word64 a, const word64 b)
{
const word64 t[2] = {b,a}; __m128i r;

View File

@ -329,19 +329,8 @@ NAMESPACE_END
#endif
#endif
#if defined(_MSC_VER)
#if _MSC_VER == 1200
#include <malloc.h>
#endif
#if _MSC_VER > 1200 || defined(_mm_free)
#define CRYPTOPP_MSVC6PP_OR_LATER // VC 6 processor pack or later
#else
#define CRYPTOPP_MSVC6_NO_PP // VC 6 without processor pack
#endif
#endif
#ifndef CRYPTOPP_ALIGN_DATA
#if defined(CRYPTOPP_MSVC6PP_OR_LATER)
#if defined(_MSC_VER)
#define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x))
#elif defined(__GNUC__)
#define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
@ -374,20 +363,6 @@ NAMESPACE_END
#define CRYPTOPP_FASTCALL
#endif
// VC60 workaround: it doesn't allow typename in some places
#if defined(_MSC_VER) && (_MSC_VER < 1300)
#define CPP_TYPENAME
#else
#define CPP_TYPENAME typename
#endif
// VC60 workaround: can't cast unsigned __int64 to float or double
#if defined(_MSC_VER) && !defined(CRYPTOPP_MSVC6PP_OR_LATER)
#define CRYPTOPP_VC6_INT64 (__int64)
#else
#define CRYPTOPP_VC6_INT64
#endif
#ifdef _MSC_VER
#define CRYPTOPP_NO_VTABLE __declspec(novtable)
#else
@ -455,7 +430,7 @@ NAMESPACE_END
// C++Builder 2010 does not allow "call label" where label is defined within inline assembly
#define CRYPTOPP_X86_ASM_AVAILABLE
#if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__))
#if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(_MSC_VER) || CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__))
#define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 1
#else
#define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 0
@ -476,7 +451,7 @@ NAMESPACE_END
#define CRYPTOPP_X64_ASM_AVAILABLE
#endif
#if !defined(CRYPTOPP_DISABLE_ASM) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__)) && !defined(_M_ARM)
#if !defined(CRYPTOPP_DISABLE_ASM) && (defined(_MSC_VER) || defined(__SSE2__)) && !defined(_M_ARM)
#define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 1
#else
#define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 0
@ -536,7 +511,7 @@ NAMESPACE_END
#endif
// how to allocate 16-byte aligned memory (for SSE2)
#if defined(CRYPTOPP_MSVC6PP_OR_LATER)
#if defined(_MSC_VER)
#define CRYPTOPP_MM_MALLOC_AVAILABLE
#elif defined(__APPLE__)
#define CRYPTOPP_APPLE_MALLOC_AVAILABLE
@ -552,7 +527,7 @@ NAMESPACE_END
// http://developer.apple.com/library/mac/documentation/Performance/Conceptual/ManagingMemory/Articles/MemoryAlloc.html
// how to disable inlining
#if defined(_MSC_VER) && _MSC_VER >= 1300
#if defined(_MSC_VER)
# define CRYPTOPP_NOINLINE_DOTDOTDOT
# define CRYPTOPP_NOINLINE __declspec(noinline)
#elif defined(__GNUC__)

View File

@ -111,7 +111,7 @@ enum CipherDir {
const unsigned long INFINITE_TIME = ULONG_MAX;
// VC60 workaround: using enums as template parameters causes problems
//! \brief Converts a typename to an enumerated value
//! \brief Converts an enumeration to a type suitable for use as a template parameter
template <typename ENUM_TYPE, int VALUE>
struct EnumToType
{

View File

@ -89,12 +89,10 @@ DefaultEncryptor::DefaultEncryptor(const byte *passphrase, size_t passphraseLeng
{
}
void DefaultEncryptor::FirstPut(const byte *)
{
// VC60 workaround: __LINE__ expansion bug
CRYPTOPP_COMPILE_ASSERT_INSTANCE(SALTLENGTH <= DefaultHashModule::DIGESTSIZE, 1);
CRYPTOPP_COMPILE_ASSERT_INSTANCE(BLOCKSIZE <= DefaultHashModule::DIGESTSIZE, 2);
CRYPTOPP_COMPILE_ASSERT(SALTLENGTH <= DefaultHashModule::DIGESTSIZE);
CRYPTOPP_COMPILE_ASSERT(BLOCKSIZE <= DefaultHashModule::DIGESTSIZE);
SecByteBlock salt(DefaultHashModule::DIGESTSIZE), keyCheck(DefaultHashModule::DIGESTSIZE);
DefaultHashModule hash;

View File

@ -8,13 +8,6 @@
NAMESPACE_BEGIN(CryptoPP)
// VC60 workaround: gives a C4786 warning without this function
// when runtime lib is set to multithread debug DLL
// even though warning 4786 is disabled!
void DES_VC60Workaround()
{
}
const word32 RawDES::Spbox[8][64] = {
{
0x01010400,0x00000000,0x00010000,0x01010404, 0x01010004,0x00010404,0x00000004,0x00010000,

2
dh.h
View File

@ -21,7 +21,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! for generating key pairs and deriving agreed values.
//! \sa DL_SimpleKeyAgreementDomainBase
//! \since Crypto++ 1.0
template <class GROUP_PARAMETERS, class COFACTOR_OPTION = CPP_TYPENAME GROUP_PARAMETERS::DefaultCofactorOption>
template <class GROUP_PARAMETERS, class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
class DH_Domain : public DL_SimpleKeyAgreementDomainBase<typename GROUP_PARAMETERS::Element>
{
typedef DL_SimpleKeyAgreementDomainBase<typename GROUP_PARAMETERS::Element> Base;

View File

@ -56,9 +56,7 @@ NAMESPACE_END
USING_NAMESPACE(CryptoPP)
#if !(defined(_MSC_VER) && (_MSC_VER < 1300))
using std::set_new_handler;
#endif
static PNew s_pNew = NULL;
static PDelete s_pDelete = NULL;
@ -161,4 +159,4 @@ void operator delete [] (void * p)
operator delete (p);
}
#endif // #ifdef CRYPTOPP_EXPORTS
#endif // CRYPTOPP_EXPORTS

6
dll.h
View File

@ -62,14 +62,10 @@
NAMESPACE_BEGIN(CryptoPP)
#if !(defined(_MSC_VER) && (_MSC_VER < 1300))
using std::new_handler;
#endif
typedef void * (CRYPTOPP_API * PNew)(size_t);
typedef void (CRYPTOPP_API * PDelete)(void *);
typedef void (CRYPTOPP_API * PGetNewAndDelete)(PNew &, PDelete &);
typedef new_handler (CRYPTOPP_API * PSetNewHandler)(new_handler);
typedef std::new_handler (CRYPTOPP_API * PSetNewHandler)(std::new_handler);
typedef void (CRYPTOPP_API * PSetNewAndDelete)(PNew, PDelete, PSetNewHandler);
NAMESPACE_END

View File

@ -46,8 +46,8 @@ static void ECDSA_TestInstantiations()
#endif
#endif
// VC60 workaround: complains when these functions are put into an anonymous namespace
static Integer ConvertToInteger(const PolynomialMod2 &x)
ANONYMOUS_NAMESPACE_BEGIN
Integer ConvertToInteger(const PolynomialMod2 &x)
{
unsigned int l = x.ByteCount();
SecByteBlock temp(l);
@ -55,12 +55,12 @@ static Integer ConvertToInteger(const PolynomialMod2 &x)
return Integer(temp, l);
}
static inline Integer ConvertToInteger(const Integer &x)
inline Integer ConvertToInteger(const Integer &x)
{
return x;
}
static bool CheckMOVCondition(const Integer &q, const Integer &r)
bool CheckMOVCondition(const Integer &q, const Integer &r)
{
// see "Updated standards for validating elliptic curves", http://eprint.iacr.org/2007/343
Integer t = 1;
@ -77,6 +77,7 @@ static bool CheckMOVCondition(const Integer &q, const Integer &r)
}
return true;
}
ANONYMOUS_NAMESPACE_END
// ******************************************************************
@ -626,13 +627,13 @@ void DL_GroupParameters_EC<EC>::SimultaneousExponentiate(Element *results, const
}
template <class EC>
CPP_TYPENAME DL_GroupParameters_EC<EC>::Element DL_GroupParameters_EC<EC>::MultiplyElements(const Element &a, const Element &b) const
typename DL_GroupParameters_EC<EC>::Element DL_GroupParameters_EC<EC>::MultiplyElements(const Element &a, const Element &b) const
{
return GetCurve().Add(a, b);
}
template <class EC>
CPP_TYPENAME DL_GroupParameters_EC<EC>::Element DL_GroupParameters_EC<EC>::CascadeExponentiate(const Element &element1, const Integer &exponent1, const Element &element2, const Integer &exponent2) const
typename DL_GroupParameters_EC<EC>::Element DL_GroupParameters_EC<EC>::CascadeExponentiate(const Element &element1, const Integer &exponent1, const Element &element2, const Integer &exponent2) const
{
return GetCurve().CascadeMultiply(exponent1, element1, exponent2, element2);
}

View File

@ -196,7 +196,7 @@ public:
//! \tparam EC elliptic curve field
//! \tparam COFACTOR_OPTION \ref CofactorMultiplicationOption "cofactor multiplication option"
//! \sa <a href="http://www.weidai.com/scan-mirror/ka.html#ECDH">Elliptic Curve Diffie-Hellman, AKA ECDH</a>
template <class EC, class COFACTOR_OPTION = CPP_TYPENAME DL_GroupParameters_EC<EC>::DefaultCofactorOption>
template <class EC, class COFACTOR_OPTION = typename DL_GroupParameters_EC<EC>::DefaultCofactorOption>
struct ECDH
{
typedef DH_Domain<DL_GroupParameters_EC<EC>, COFACTOR_OPTION> Domain;
@ -207,7 +207,7 @@ struct ECDH
//! \tparam EC elliptic curve field
//! \tparam COFACTOR_OPTION \ref CofactorMultiplicationOption "cofactor multiplication option"
/// \sa <a href="http://www.weidai.com/scan-mirror/ka.html#ECMQV">Elliptic Curve Menezes-Qu-Vanstone, AKA ECMQV</a>
template <class EC, class COFACTOR_OPTION = CPP_TYPENAME DL_GroupParameters_EC<EC>::DefaultCofactorOption>
template <class EC, class COFACTOR_OPTION = typename DL_GroupParameters_EC<EC>::DefaultCofactorOption>
struct ECMQV
{
typedef MQV_Domain<DL_GroupParameters_EC<EC>, COFACTOR_OPTION> Domain;
@ -219,7 +219,7 @@ struct ECMQV
//! \tparam COFACTOR_OPTION \ref CofactorMultiplicationOption "cofactor multiplication option"
//! \details This implementation follows Hugo Krawczyk's <a href="http://eprint.iacr.org/2005/176">HMQV: A High-Performance
//! Secure Diffie-Hellman Protocol</a>. Note: this implements HMQV only. HMQV-C with Key Confirmation is not provided.
template <class EC, class COFACTOR_OPTION = CPP_TYPENAME DL_GroupParameters_EC<EC>::DefaultCofactorOption, class HASH = SHA256>
template <class EC, class COFACTOR_OPTION = typename DL_GroupParameters_EC<EC>::DefaultCofactorOption, class HASH = SHA256>
struct ECHMQV
{
typedef HMQV_Domain<DL_GroupParameters_EC<EC>, COFACTOR_OPTION, HASH> Domain;
@ -237,7 +237,7 @@ typedef ECHMQV< ECP, DL_GroupParameters_EC< ECP >::DefaultCofactorOption, SHA512
//! \details This implementation follows Augustin P. Sarr and Philippe ElbazVincent, and JeanClaude Bajard's
//! <a href="http://eprint.iacr.org/2009/408">A Secure and Efficient Authenticated Diffie-Hellman Protocol</a>.
//! Note: this is FHMQV, Protocol 5, from page 11; and not FHMQV-C.
template <class EC, class COFACTOR_OPTION = CPP_TYPENAME DL_GroupParameters_EC<EC>::DefaultCofactorOption, class HASH = SHA256>
template <class EC, class COFACTOR_OPTION = typename DL_GroupParameters_EC<EC>::DefaultCofactorOption, class HASH = SHA256>
struct ECFHMQV
{
typedef FHMQV_Domain<DL_GroupParameters_EC<EC>, COFACTOR_OPTION, HASH> Domain;

View File

@ -138,7 +138,7 @@ struct ESIGN_Keys
//! \tparam STANDARD Signature encoding method
//! \since Crypto++ 5.0
template <class H, class STANDARD = P1363_EMSA5>
struct ESIGN : public TF_SS<STANDARD, H, ESIGN_Keys>
struct ESIGN : public TF_SS<ESIGN_Keys, STANDARD, H>
{
};

View File

@ -42,7 +42,7 @@ public:
~ObjectFactoryRegistry()
{
for (CPP_TYPENAME Map::iterator i = m_map.begin(); i != m_map.end(); ++i)
for (typename Map::iterator i = m_map.begin(); i != m_map.end(); ++i)
{
delete (ObjectFactory<AbstractClass> *)i->second;
i->second = NULL;
@ -56,7 +56,7 @@ public:
const ObjectFactory<AbstractClass> * GetFactory(const char *name) const
{
CPP_TYPENAME Map::const_iterator i = m_map.find(name);
typename Map::const_iterator i = m_map.find(name);
return i == m_map.end() ? NULL : (ObjectFactory<AbstractClass> *)i->second;
}
@ -73,7 +73,7 @@ public:
std::vector<std::string> GetFactoryNames() const
{
std::vector<std::string> names;
CPP_TYPENAME Map::const_iterator iter;
typename Map::const_iterator iter;
for (iter = m_map.begin(); iter != m_map.end(); ++iter)
names.push_back(iter->first);
return names;
@ -110,32 +110,32 @@ template <class SchemeClass>
void RegisterAsymmetricCipherDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL)
{
CRYPTOPP_UNUSED(dummy);
RegisterDefaultFactoryFor<PK_Encryptor, CPP_TYPENAME SchemeClass::Encryptor>((const char *)name);
RegisterDefaultFactoryFor<PK_Decryptor, CPP_TYPENAME SchemeClass::Decryptor>((const char *)name);
RegisterDefaultFactoryFor<PK_Encryptor, typename SchemeClass::Encryptor>((const char *)name);
RegisterDefaultFactoryFor<PK_Decryptor, typename SchemeClass::Decryptor>((const char *)name);
}
template <class SchemeClass>
void RegisterSignatureSchemeDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL)
{
CRYPTOPP_UNUSED(dummy);
RegisterDefaultFactoryFor<PK_Signer, CPP_TYPENAME SchemeClass::Signer>((const char *)name);
RegisterDefaultFactoryFor<PK_Verifier, CPP_TYPENAME SchemeClass::Verifier>((const char *)name);
RegisterDefaultFactoryFor<PK_Signer, typename SchemeClass::Signer>((const char *)name);
RegisterDefaultFactoryFor<PK_Verifier, typename SchemeClass::Verifier>((const char *)name);
}
template <class SchemeClass>
void RegisterSymmetricCipherDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL)
{
CRYPTOPP_UNUSED(dummy);
RegisterDefaultFactoryFor<SymmetricCipher, CPP_TYPENAME SchemeClass::Encryption, ENCRYPTION>((const char *)name);
RegisterDefaultFactoryFor<SymmetricCipher, CPP_TYPENAME SchemeClass::Decryption, DECRYPTION>((const char *)name);
RegisterDefaultFactoryFor<SymmetricCipher, typename SchemeClass::Encryption, ENCRYPTION>((const char *)name);
RegisterDefaultFactoryFor<SymmetricCipher, typename SchemeClass::Decryption, DECRYPTION>((const char *)name);
}
template <class SchemeClass>
void RegisterAuthenticatedSymmetricCipherDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL)
{
CRYPTOPP_UNUSED(dummy);
RegisterDefaultFactoryFor<AuthenticatedSymmetricCipher, CPP_TYPENAME SchemeClass::Encryption, ENCRYPTION>((const char *)name);
RegisterDefaultFactoryFor<AuthenticatedSymmetricCipher, CPP_TYPENAME SchemeClass::Decryption, DECRYPTION>((const char *)name);
RegisterDefaultFactoryFor<AuthenticatedSymmetricCipher, typename SchemeClass::Encryption, ENCRYPTION>((const char *)name);
RegisterDefaultFactoryFor<AuthenticatedSymmetricCipher, typename SchemeClass::Decryption, DECRYPTION>((const char *)name);
}
NAMESPACE_END

View File

@ -20,7 +20,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! Note: this is FHMQV, Protocol 5, from page 11; and not FHMQV-C.
//! \sa MQV, HMQV, FHMQV, and AuthenticatedKeyAgreementDomain
//! \since Crypto++ 5.6.4
template <class GROUP_PARAMETERS, class COFACTOR_OPTION = CPP_TYPENAME GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
template <class GROUP_PARAMETERS, class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
class FHMQV_Domain : public AuthenticatedKeyAgreementDomain
{
public:

View File

@ -97,7 +97,7 @@ private:
//! \brief Integer-based GroupParameters default implementation
//! \tparam GROUP_PRECOMP group parameters precomputation specialization
//! \tparam BASE_PRECOMP base class precomputation specialization
template <class GROUP_PRECOMP, class BASE_PRECOMP = DL_FixedBasePrecomputationImpl<CPP_TYPENAME GROUP_PRECOMP::Element> >
template <class GROUP_PRECOMP, class BASE_PRECOMP = DL_FixedBasePrecomputationImpl<typename GROUP_PRECOMP::Element> >
class CRYPTOPP_NO_VTABLE DL_GroupParameters_IntegerBasedImpl : public DL_GroupParametersImpl<GROUP_PRECOMP, BASE_PRECOMP, DL_GroupParameters_IntegerBased>
{
typedef DL_GroupParameters_IntegerBasedImpl<GROUP_PRECOMP, BASE_PRECOMP> ThisClass;

2
hmqv.h
View File

@ -19,7 +19,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! Secure Diffie-Hellman Protocol</a>. Note: this implements HMQV only. HMQV-C with Key Confirmation is not provided.
//! \sa MQV, HMQV, FHMQV, and AuthenticatedKeyAgreementDomain
//! \since Crypto++ 5.6.4
template <class GROUP_PARAMETERS, class COFACTOR_OPTION = CPP_TYPENAME GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
template <class GROUP_PARAMETERS, class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption, class HASH = SHA512>
class HMQV_Domain: public AuthenticatedKeyAgreementDomain
{
public:

View File

@ -54,7 +54,7 @@ double TimerBase::ConvertTo(TimerWord t, Unit unit)
// When 'unit' is an enum 'Unit', a Clang warning is generated.
CRYPTOPP_ASSERT(static_cast<unsigned int>(unit) < COUNTOF(unitsPerSecondTable));
return (double)CRYPTOPP_VC6_INT64 t * unitsPerSecondTable[unit] / CRYPTOPP_VC6_INT64 TicksPerSecond();
return static_cast<double>(t) * unitsPerSecondTable[unit] / TicksPerSecond();
}
void TimerBase::StartTimer()

View File

@ -46,10 +46,6 @@
#include <c_asm.h>
#endif
#ifdef CRYPTOPP_MSVC6_NO_PP
#pragma message("You do not seem to have the Visual C++ Processor Pack installed, so use of SSE2 instructions will be disabled.")
#endif
// "Error: The operand ___LKDB cannot be assigned to", http://github.com/weidai11/cryptopp/issues/188
#if (__SUNPRO_CC >= 0x5130)
# define MAYBE_CONST
@ -70,7 +66,7 @@
# define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 0
# define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 0
#else
# define CRYPTOPP_INTEGER_SSE2 (CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86)
# define CRYPTOPP_INTEGER_SSE2 (CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && (CRYPTOPP_BOOL_X86))
#endif
NAMESPACE_BEGIN(CryptoPP)
@ -567,13 +563,8 @@ inline word DWord::operator%(word a)
__asm pop esi \
__asm pop edi \
__asm ret 8
#if _MSC_VER < 1300
#define SaveEBX __asm push ebx
#define RestoreEBX __asm pop ebx
#else
#define SaveEBX
#define RestoreEBX
#endif
#define SquPrologue \
AS2( mov eax, A) \
AS2( mov ecx, C) \
@ -862,8 +853,8 @@ CRYPTOPP_NAKED int CRYPTOPP_FASTCALL SSE2_Sub(size_t N, word *C, const word *A,
AddEpilogue
}
#endif // #if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
#else
#endif // CRYPTOPP_INTEGER_SSE2
#else // CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
int CRYPTOPP_FASTCALL Baseline_Add(size_t N, word *C, const word *A, const word *B)
{
CRYPTOPP_ASSERT (N%2 == 0);
@ -2082,7 +2073,7 @@ static PAdd s_pAdd = &Baseline_Add, s_pSub = &Baseline_Sub;
static size_t s_recursionLimit = 8;
#else
static const size_t s_recursionLimit = 16;
#endif
#endif // CRYPTOPP_INTEGER_SSE2
static PMul s_pMul[9], s_pBot[9];
static PSqu s_pSqu[9];
@ -2099,13 +2090,11 @@ static void SetFunctionPointers()
#if CRYPTOPP_INTEGER_SSE2
if (HasSSE2())
{
#if _MSC_VER != 1200 || !(CRYPTOPP_DEBUG)
if (IsP4())
{
s_pAdd = &SSE2_Add;
s_pSub = &SSE2_Sub;
}
#endif
s_recursionLimit = 32;
@ -2129,7 +2118,7 @@ static void SetFunctionPointers()
s_pTop[8] = &SSE2_MultiplyTop32;
}
else
#endif
#endif // CRYPTOPP_INTEGER_SSE2
{
s_pMul[1] = &Baseline_Multiply4;
s_pMul[2] = &Baseline_Multiply8;
@ -2147,7 +2136,7 @@ static void SetFunctionPointers()
s_pBot[4] = &Baseline_MultiplyBottom16;
s_pSqu[4] = &Baseline_Square16;
s_pTop[4] = &Baseline_MultiplyTop16;
#endif
#endif // !CRYPTOPP_INTEGER_SSE2
}
}
@ -2157,7 +2146,7 @@ inline int Add(word *C, const word *A, const word *B, size_t N)
return s_pAdd(N, C, A, B);
#else
return Baseline_Add(N, C, A, B);
#endif
#endif // CRYPTOPP_INTEGER_SSE2
}
inline int Subtract(word *C, const word *A, const word *B, size_t N)
@ -2166,7 +2155,7 @@ inline int Subtract(word *C, const word *A, const word *B, size_t N)
return s_pSub(N, C, A, B);
#else
return Baseline_Sub(N, C, A, B);
#endif
#endif // CRYPTOPP_INTEGER_SSE2
}
// ********************************************************

View File

@ -11,15 +11,10 @@
NAMESPACE_BEGIN(CryptoPP)
template <class T> struct DigestSizeDoubleWorkaround // VC60 workaround
{
CRYPTOPP_CONSTANT(RESULT = 2*T::DIGESTSIZE)
};
//! \class LR_Info
//! \brief Luby-Rackoff block cipher information
template <class T>
struct LR_Info : public VariableKeyLength<16, 0, 2*(INT_MAX/2), 2>, public FixedBlockSize<DigestSizeDoubleWorkaround<T>::RESULT>
struct LR_Info : public VariableKeyLength<16, 0, 2*(INT_MAX/2), 2>, public FixedBlockSize<2*T::DIGESTSIZE>
{
static std::string StaticAlgorithmName() {return std::string("LR/")+T::StaticAlgorithmName();}
};

4
luc.h
View File

@ -116,7 +116,7 @@ struct LUC
//! trapdoor functions and probably shouldn't be used in production software. The discrete log based LUC schemes
//! defined later in this .h file may be of more practical interest.
template <class STANDARD>
struct LUCES : public TF_ES<STANDARD, LUC>
struct LUCES : public TF_ES<LUC, STANDARD>
{
};
@ -125,7 +125,7 @@ struct LUCES : public TF_ES<STANDARD, LUC>
//! trapdoor functions and probably shouldn't be used in production software. The discrete log based LUC schemes
//! defined later in this .h file may be of more practical interest.
template <class STANDARD, class H>
struct LUCSS : public TF_SS<STANDARD, H, LUC>
struct LUCSS : public TF_SS<LUC, STANDARD, H>
{
};

View File

@ -197,13 +197,11 @@ std::string StringNarrow(const wchar_t *str, bool throwOnError)
return result;
}
#if !(defined(_MSC_VER) && (_MSC_VER < 1300))
using std::new_handler;
using std::set_new_handler;
#endif
void CallNewHandler()
{
using std::new_handler;
using std::set_new_handler;
new_handler newHandler = set_new_handler(NULL);
if (newHandler)
set_new_handler(newHandler);

14
misc.h
View File

@ -473,7 +473,7 @@ inline void * memset_z(void *ptr, int value, size_t num)
//! \param a the first value
//! \param b the second value
//! \returns the minimum value based on a comparison of <tt>b \< a</tt> using <tt>operator\<</tt>
//! \details STDMIN was provided because the library could not use std::min or std::max in MSVC60 or Cygwin 1.1.0
//! \details STDMIN was provided because the library could not easily use std::min or std::max in Windows or Cygwin 1.1.0
template <class T> inline const T& STDMIN(const T& a, const T& b)
{
return b < a ? b : a;
@ -483,10 +483,9 @@ template <class T> inline const T& STDMIN(const T& a, const T& b)
//! \param a the first value
//! \param b the second value
//! \returns the minimum value based on a comparison of <tt>a \< b</tt> using <tt>operator\<</tt>
//! \details STDMAX was provided because the library could not use std::min or std::max in MSVC60 or Cygwin 1.1.0
//! \details STDMAX was provided because the library could not easily use std::min or std::max in Windows or Cygwin 1.1.0
template <class T> inline const T& STDMAX(const T& a, const T& b)
{
// can't use std::min or std::max in MSVC60 or Cygwin 1.1.0
return a < b ? b : a;
}
@ -911,7 +910,6 @@ inline T1 RoundUpToMultipleOf(const T1 &n, const T2 &m)
}
//! \brief Returns the minimum alignment requirements of a type
//! \param dummy an unused Visual C++ 6.0 workaround
//! \returns the minimum alignment requirements of a type, in bytes
//! \details Internally the function calls C++11's <tt>alignof</tt> if available. If not available,
//! then the function uses compiler specific extensions such as <tt>__alignof</tt> and
@ -921,14 +919,14 @@ inline T1 RoundUpToMultipleOf(const T1 &n, const T2 &m)
//! In <em>all</em> cases, if <tt>CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS</tt> is defined, then the
//! function returns 1.
template <class T>
inline unsigned int GetAlignmentOf(T *dummy=NULL) // VC60 workaround
inline unsigned int GetAlignmentOf()
{
// GCC 4.6 (circa 2008) and above aggressively uses vectorization.
#if defined(CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS)
if (sizeof(T) < 16)
return 1;
#endif
CRYPTOPP_UNUSED(dummy);
#if defined(CRYPTOPP_CXX11_ALIGNOF)
return alignof(T);
#elif (_MSC_VER >= 1300)
@ -960,13 +958,11 @@ inline bool IsAlignedOn(const void *ptr, unsigned int alignment)
//! \brief Determines whether ptr is minimally aligned
//! \param ptr the pointer to check for alignment
//! \param dummy an unused Visual C++ 6.0 workaround
//! \returns true if ptr follows native byte ordering, false otherwise
//! \details Internally the function calls IsAlignedOn with a second parameter of GetAlignmentOf<T>
template <class T>
inline bool IsAligned(const void *ptr, T *dummy=NULL) // VC60 workaround
inline bool IsAligned(const void *ptr)
{
CRYPTOPP_UNUSED(dummy);
return IsAlignedOn(ptr, GetAlignmentOf<T>());
}

24
modes.h
View File

@ -336,8 +336,8 @@ CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate<AbstractPolicyHolder<CFB_Ciph
template <class CIPHER>
struct CFB_Mode : public CipherModeDocumentation
{
typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Encryption, ConcretePolicyHolder<Empty, CFB_EncryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> > > > Encryption;
typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Encryption, ConcretePolicyHolder<Empty, CFB_DecryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> > > > Decryption;
typedef CipherModeFinalTemplate_CipherHolder<typename CIPHER::Encryption, ConcretePolicyHolder<Empty, CFB_EncryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> > > > Encryption;
typedef CipherModeFinalTemplate_CipherHolder<typename CIPHER::Encryption, ConcretePolicyHolder<Empty, CFB_DecryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> > > > Decryption;
};
//! \class CFB_Mode_ExternalCipher
@ -354,8 +354,8 @@ struct CFB_Mode_ExternalCipher : public CipherModeDocumentation
template <class CIPHER>
struct CFB_FIPS_Mode : public CipherModeDocumentation
{
typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Encryption, ConcretePolicyHolder<Empty, CFB_RequireFullDataBlocks<CFB_EncryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> > > > > Encryption;
typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Encryption, ConcretePolicyHolder<Empty, CFB_RequireFullDataBlocks<CFB_DecryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> > > > > Decryption;
typedef CipherModeFinalTemplate_CipherHolder<typename CIPHER::Encryption, ConcretePolicyHolder<Empty, CFB_RequireFullDataBlocks<CFB_EncryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> > > > > Encryption;
typedef CipherModeFinalTemplate_CipherHolder<typename CIPHER::Encryption, ConcretePolicyHolder<Empty, CFB_RequireFullDataBlocks<CFB_DecryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> > > > > Decryption;
};
//! \class CFB_FIPS_Mode_ExternalCipher
@ -374,7 +374,7 @@ CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate<AbstractPolicyHolder<Additive
template <class CIPHER>
struct OFB_Mode : public CipherModeDocumentation
{
typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Encryption, ConcretePolicyHolder<Empty, AdditiveCipherTemplate<AbstractPolicyHolder<AdditiveCipherAbstractPolicy, OFB_ModePolicy> > > > Encryption;
typedef CipherModeFinalTemplate_CipherHolder<typename CIPHER::Encryption, ConcretePolicyHolder<Empty, AdditiveCipherTemplate<AbstractPolicyHolder<AdditiveCipherAbstractPolicy, OFB_ModePolicy> > > > Encryption;
typedef Encryption Decryption;
};
@ -394,7 +394,7 @@ CRYPTOPP_DLL_TEMPLATE_CLASS CipherModeFinalTemplate_ExternalCipher<ConcretePolic
template <class CIPHER>
struct CTR_Mode : public CipherModeDocumentation
{
typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Encryption, ConcretePolicyHolder<Empty, AdditiveCipherTemplate<AbstractPolicyHolder<AdditiveCipherAbstractPolicy, CTR_ModePolicy> > > > Encryption;
typedef CipherModeFinalTemplate_CipherHolder<typename CIPHER::Encryption, ConcretePolicyHolder<Empty, AdditiveCipherTemplate<AbstractPolicyHolder<AdditiveCipherAbstractPolicy, CTR_ModePolicy> > > > Encryption;
typedef Encryption Decryption;
};
@ -411,8 +411,8 @@ struct CTR_Mode_ExternalCipher : public CipherModeDocumentation
template <class CIPHER>
struct ECB_Mode : public CipherModeDocumentation
{
typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Encryption, ECB_OneWay> Encryption;
typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Decryption, ECB_OneWay> Decryption;
typedef CipherModeFinalTemplate_CipherHolder<typename CIPHER::Encryption, ECB_OneWay> Encryption;
typedef CipherModeFinalTemplate_CipherHolder<typename CIPHER::Decryption, ECB_OneWay> Decryption;
};
CRYPTOPP_DLL_TEMPLATE_CLASS CipherModeFinalTemplate_ExternalCipher<ECB_OneWay>;
@ -429,8 +429,8 @@ struct ECB_Mode_ExternalCipher : public CipherModeDocumentation
template <class CIPHER>
struct CBC_Mode : public CipherModeDocumentation
{
typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Encryption, CBC_Encryption> Encryption;
typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Decryption, CBC_Decryption> Decryption;
typedef CipherModeFinalTemplate_CipherHolder<typename CIPHER::Encryption, CBC_Encryption> Encryption;
typedef CipherModeFinalTemplate_CipherHolder<typename CIPHER::Decryption, CBC_Decryption> Decryption;
};
CRYPTOPP_DLL_TEMPLATE_CLASS CipherModeFinalTemplate_ExternalCipher<CBC_Encryption>;
@ -447,8 +447,8 @@ struct CBC_Mode_ExternalCipher : public CipherModeDocumentation
template <class CIPHER>
struct CBC_CTS_Mode : public CipherModeDocumentation
{
typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Encryption, CBC_CTS_Encryption> Encryption;
typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Decryption, CBC_CTS_Decryption> Decryption;
typedef CipherModeFinalTemplate_CipherHolder<typename CIPHER::Encryption, CBC_CTS_Encryption> Encryption;
typedef CipherModeFinalTemplate_CipherHolder<typename CIPHER::Decryption, CBC_CTS_Decryption> Decryption;
};
CRYPTOPP_DLL_TEMPLATE_CLASS CipherModeFinalTemplate_ExternalCipher<CBC_CTS_Encryption>;

2
mqv.h
View File

@ -23,7 +23,7 @@ NAMESPACE_BEGIN(CryptoPP)
//! Binary curves use a polynomial to represent its characteristic, while prime curves
//! use a prime number.
//! \sa MQV, HMQV, FHMQV, and AuthenticatedKeyAgreementDomain
template <class GROUP_PARAMETERS, class COFACTOR_OPTION = CPP_TYPENAME GROUP_PARAMETERS::DefaultCofactorOption>
template <class GROUP_PARAMETERS, class COFACTOR_OPTION = typename GROUP_PARAMETERS::DefaultCofactorOption>
class MQV_Domain : public AuthenticatedKeyAgreementDomain
{
public:

View File

@ -399,7 +399,7 @@ float NetworkSink::ComputeCurrentSpeed()
float NetworkSink::GetMaxObservedSpeed() const
{
lword m = GetMaxBytesPerSecond();
return m ? STDMIN(m_maxObservedSpeed, float(CRYPTOPP_VC6_INT64 m)) : m_maxObservedSpeed;
return m ? STDMIN(m_maxObservedSpeed, static_cast<float>(m)) : m_maxObservedSpeed;
}
unsigned int NetworkSink::GetMaxWaitObjectCount() const

View File

@ -86,7 +86,7 @@ protected:
void HashBlocks(const byte *input, size_t length, word32 padbit);
void HashFinal(byte *mac, size_t length);
CPP_TYPENAME T::Encryption m_cipher;
typename T::Encryption m_cipher;
// Accumulated hash, clamped r-key, and encrypted nonce
FixedSizeAlignedSecBlock<word32, 5> m_h;

View File

@ -52,9 +52,6 @@
#include "smartptr.h"
#include "stdcpp.h"
// VC60 workaround: this macro is defined in shlobj.h and conflicts with a template parameter used in this file
#undef INTERFACE
#if defined(__SUNPRO_CC)
# define MAYBE_RETURN(x) return x
#else
@ -273,10 +270,10 @@ public:
//! \class TF_CryptoSystemBase
//! \brief Trapdoor function cryptosystem base class
//! \tparam INTERFACE public key cryptosystem base interface
//! \tparam INTFACE public key cryptosystem base interface
//! \tparam BASE public key cryptosystem implementation base
template <class INTERFACE, class BASE>
class CRYPTOPP_NO_VTABLE TF_CryptoSystemBase : public PK_FixedLengthCryptoSystemImpl<INTERFACE>, protected BASE
template <class INTFACE, class BASE>
class CRYPTOPP_NO_VTABLE TF_CryptoSystemBase : public PK_FixedLengthCryptoSystemImpl<INTFACE>, protected BASE
{
public:
virtual ~TF_CryptoSystemBase() {}
@ -478,8 +475,8 @@ public:
};
//! _
template <class INTERFACE, class BASE>
class CRYPTOPP_NO_VTABLE TF_SignatureSchemeBase : public INTERFACE, protected BASE
template <class INTFACE, class BASE>
class CRYPTOPP_NO_VTABLE TF_SignatureSchemeBase : public INTFACE, protected BASE
{
public:
virtual ~TF_SignatureSchemeBase() {}
@ -571,16 +568,16 @@ public:
PK_MessageAccumulator * NewSignatureAccumulator(RandomNumberGenerator &rng) const
{
CRYPTOPP_UNUSED(rng);
return new PK_MessageAccumulatorImpl<CPP_TYPENAME SCHEME_OPTIONS::HashFunction>;
return new PK_MessageAccumulatorImpl<typename SCHEME_OPTIONS::HashFunction>;
}
PK_MessageAccumulator * NewVerificationAccumulator() const
{
return new PK_MessageAccumulatorImpl<CPP_TYPENAME SCHEME_OPTIONS::HashFunction>;
return new PK_MessageAccumulatorImpl<typename SCHEME_OPTIONS::HashFunction>;
}
protected:
const typename BASE::MessageEncodingInterface & GetMessageEncodingInterface() const
{return Singleton<CPP_TYPENAME SCHEME_OPTIONS::MessageEncodingMethod>().Ref();}
{return Singleton<typename SCHEME_OPTIONS::MessageEncodingMethod>().Ref();}
const TrapdoorFunctionBounds & GetTrapdoorFunctionBounds() const
{return GetKey();}
const typename BASE::TrapdoorFunctionInterface & GetTrapdoorFunctionInterface() const
@ -589,12 +586,12 @@ protected:
// for signature scheme
HashIdentifier GetHashIdentifier() const
{
typedef CPP_TYPENAME SchemeOptions::MessageEncodingMethod::HashIdentifierLookup::template HashIdentifierLookup2<CPP_TYPENAME SchemeOptions::HashFunction> L;
typedef typename SchemeOptions::MessageEncodingMethod::HashIdentifierLookup::template HashIdentifierLookup2<typename SchemeOptions::HashFunction> L;
return L::Lookup();
}
size_t GetDigestSize() const
{
typedef CPP_TYPENAME SchemeOptions::HashFunction H;
typedef typename SchemeOptions::HashFunction H;
return H::DIGESTSIZE;
}
};
@ -940,7 +937,7 @@ private:
//! \tparam GROUP_PRECOMP group precomputation class
//! \tparam BASE_PRECOMP fixed base precomputation class
//! \tparam BASE class or type of an element
template <class GROUP_PRECOMP, class BASE_PRECOMP = DL_FixedBasePrecomputationImpl<CPP_TYPENAME GROUP_PRECOMP::Element>, class BASE = DL_GroupParameters<CPP_TYPENAME GROUP_PRECOMP::Element> >
template <class GROUP_PRECOMP, class BASE_PRECOMP = DL_FixedBasePrecomputationImpl<typename GROUP_PRECOMP::Element>, class BASE = DL_GroupParameters<typename GROUP_PRECOMP::Element> >
class DL_GroupParametersImpl : public BASE
{
public:
@ -1098,7 +1095,7 @@ class PKCS8PrivateKey;
//! _
template <class GP>
class DL_PrivateKeyImpl : public DL_PrivateKey<CPP_TYPENAME GP::Element>, public DL_KeyImpl<PKCS8PrivateKey, GP>
class DL_PrivateKeyImpl : public DL_PrivateKey<typename GP::Element>, public DL_KeyImpl<PKCS8PrivateKey, GP>
{
public:
typedef typename GP::Element Element;
@ -1329,12 +1326,12 @@ protected:
};
//! \brief Discrete Log (DL) signature scheme base implementation
//! \tparam INTERFACE PK_Signer or PK_Verifier derived class
//! \tparam INTFACE PK_Signer or PK_Verifier derived class
//! \tparam DL_Base key base used in the scheme
//! \details DL_SignatureSchemeBase provides common functions for signers and verifiers.
//! DL_Base<DL_PrivateKey> is used for signers, and DL_Base<DL_PublicKey> is used for verifiers.
template <class INTERFACE, class KEY_INTERFACE>
class CRYPTOPP_NO_VTABLE DL_SignatureSchemeBase : public INTERFACE, public DL_Base<KEY_INTERFACE>
template <class INTFACE, class KEY_INTFACE>
class CRYPTOPP_NO_VTABLE DL_SignatureSchemeBase : public INTFACE, public DL_Base<KEY_INTFACE>
{
public:
virtual ~DL_SignatureSchemeBase() {}
@ -1379,7 +1376,7 @@ protected:
size_t MessageRepresentativeLength() const {return BitsToBytes(MessageRepresentativeBitLength());}
size_t MessageRepresentativeBitLength() const {return this->GetAbstractGroupParameters().GetSubgroupOrder().BitCount();}
virtual const DL_ElgamalLikeSignatureAlgorithm<CPP_TYPENAME KEY_INTERFACE::Element> & GetSignatureAlgorithm() const =0;
virtual const DL_ElgamalLikeSignatureAlgorithm<typename KEY_INTFACE::Element> & GetSignatureAlgorithm() const =0;
virtual const PK_SignatureMessageEncodingMethod & GetMessageEncodingInterface() const =0;
virtual HashIdentifier GetHashIdentifier() const =0;
virtual size_t GetDigestSize() const =0;
@ -1736,11 +1733,11 @@ protected:
HashIdentifier GetHashIdentifier() const
{
typedef typename SchemeOptions::MessageEncodingMethod::HashIdentifierLookup HashLookup;
return HashLookup::template HashIdentifierLookup2<CPP_TYPENAME SchemeOptions::HashFunction>::Lookup();
return HashLookup::template HashIdentifierLookup2<typename SchemeOptions::HashFunction>::Lookup();
}
size_t GetDigestSize() const
{
typedef CPP_TYPENAME SchemeOptions::HashFunction H;
typedef typename SchemeOptions::HashFunction H;
return H::DIGESTSIZE;
}
@ -1762,17 +1759,17 @@ public:
protected:
const DL_ElgamalLikeSignatureAlgorithm<Element> & GetSignatureAlgorithm() const
{return Singleton<CPP_TYPENAME SCHEME_OPTIONS::SignatureAlgorithm>().Ref();}
{return Singleton<typename SCHEME_OPTIONS::SignatureAlgorithm>().Ref();}
const DL_KeyAgreementAlgorithm<Element> & GetKeyAgreementAlgorithm() const
{return Singleton<CPP_TYPENAME SCHEME_OPTIONS::KeyAgreementAlgorithm>().Ref();}
{return Singleton<typename SCHEME_OPTIONS::KeyAgreementAlgorithm>().Ref();}
const DL_KeyDerivationAlgorithm<Element> & GetKeyDerivationAlgorithm() const
{return Singleton<CPP_TYPENAME SCHEME_OPTIONS::KeyDerivationAlgorithm>().Ref();}
{return Singleton<typename SCHEME_OPTIONS::KeyDerivationAlgorithm>().Ref();}
const DL_SymmetricEncryptionAlgorithm & GetSymmetricEncryptionAlgorithm() const
{return Singleton<CPP_TYPENAME SCHEME_OPTIONS::SymmetricEncryptionAlgorithm>().Ref();}
{return Singleton<typename SCHEME_OPTIONS::SymmetricEncryptionAlgorithm>().Ref();}
HashIdentifier GetHashIdentifier() const
{return HashIdentifier();}
const PK_SignatureMessageEncodingMethod & GetMessageEncodingInterface() const
{return Singleton<CPP_TYPENAME SCHEME_OPTIONS::MessageEncodingMethod>().Ref();}
{return Singleton<typename SCHEME_OPTIONS::MessageEncodingMethod>().Ref();}
};
//! \brief Discrete Log (DL) signer implementation
@ -1783,7 +1780,7 @@ class DL_SignerImpl : public DL_ObjectImpl<DL_SignerBase<typename SCHEME_OPTIONS
public:
PK_MessageAccumulator * NewSignatureAccumulator(RandomNumberGenerator &rng) const
{
member_ptr<PK_MessageAccumulatorBase> p(new PK_MessageAccumulatorImpl<CPP_TYPENAME SCHEME_OPTIONS::HashFunction>);
member_ptr<PK_MessageAccumulatorBase> p(new PK_MessageAccumulatorImpl<typename SCHEME_OPTIONS::HashFunction>);
this->RestartMessageAccumulator(rng, *p);
return p.release();
}
@ -1797,7 +1794,7 @@ class DL_VerifierImpl : public DL_ObjectImpl<DL_VerifierBase<typename SCHEME_OPT
public:
PK_MessageAccumulator * NewVerificationAccumulator() const
{
return new PK_MessageAccumulatorImpl<CPP_TYPENAME SCHEME_OPTIONS::HashFunction>;
return new PK_MessageAccumulatorImpl<typename SCHEME_OPTIONS::HashFunction>;
}
};
@ -2042,10 +2039,10 @@ struct SignatureStandard {};
//! \tparam STANDARD standard
//! \tparam KEYS keys used in the encryption scheme
//! \tparam ALG_INFO algorithm information
template <class STANDARD, class KEYS, class ALG_INFO>
template <class KEYS, class STANDARD, class ALG_INFO>
class TF_ES;
template <class STANDARD, class KEYS, class ALG_INFO = TF_ES<STANDARD, KEYS, int> >
template <class KEYS, class STANDARD, class ALG_INFO = TF_ES<KEYS, STANDARD, int> >
class TF_ES : public KEYS
{
typedef typename STANDARD::EncryptionMessageEncodingMethod MessageEncodingMethod;
@ -2069,10 +2066,10 @@ public:
//! \tparam H hash function
//! \tparam KEYS keys used in the signature scheme
//! \tparam ALG_INFO algorithm information
template <class STANDARD, class H, class KEYS, class ALG_INFO> // VC60 workaround: doesn't work if KEYS is first parameter
template <class KEYS, class STANDARD, class H, class ALG_INFO>
class TF_SS;
template <class STANDARD, class H, class KEYS, class ALG_INFO = TF_SS<STANDARD, H, KEYS, int> > // VC60 workaround: doesn't work if KEYS is first parameter
template <class KEYS, class STANDARD, class H, class ALG_INFO = TF_SS<KEYS, STANDARD, H, int> >
class TF_SS : public KEYS
{
public:

View File

@ -90,13 +90,13 @@ struct Rabin
//! Rabin encryption
template <class STANDARD>
struct RabinES : public TF_ES<STANDARD, Rabin>
struct RabinES : public TF_ES<Rabin, STANDARD>
{
};
//! Rabin signature
template <class STANDARD, class H>
struct RabinSS : public TF_SS<STANDARD, H, Rabin>
struct RabinSS : public TF_SS<Rabin, STANDARD, H>
{
};

View File

@ -6,13 +6,6 @@
#include "rijndael.h"
// VC60 workaround: gives a C4786 warning without this function
// when runtime lib is set to multithread debug DLL
// even though warning 4786 is disabled!
void Rijndael_VC60Workaround()
{
}
NAMESPACE_BEGIN(CryptoPP)
/*

6
rsa.h
View File

@ -168,7 +168,7 @@ struct CRYPTOPP_DLL RSA
//! \sa <a href="http://www.weidai.com/scan-mirror/ca.html#RSA">RSA cryptosystem</a>
//! \since Crypto++ 1.0
template <class STANDARD>
struct RSAES : public TF_ES<STANDARD, RSA>
struct RSAES : public TF_ES<RSA, STANDARD>
{
};
@ -180,7 +180,7 @@ struct RSAES : public TF_ES<STANDARD, RSA>
//! \sa <a href="http://www.weidai.com/scan-mirror/sig.html#RSA">RSA signature scheme with appendix</a>
//! \since Crypto++ 1.0
template <class STANDARD, class H>
struct RSASS : public TF_SS<STANDARD, H, RSA>
struct RSASS : public TF_SS<RSA, STANDARD, H>
{
};
@ -199,7 +199,7 @@ struct CRYPTOPP_DLL RSA_ISO
//! \tparam H hash transformation
//! \since Crypto++ 1.0
template <class H>
struct RSASS_ISO : public TF_SS<P1363_EMSA2, H, RSA_ISO>
struct RSASS_ISO : public TF_SS<RSA_ISO, P1363_EMSA2, H>
{
};

2
rw.h
View File

@ -119,7 +119,7 @@ struct RW
//! \class RWSS
//! \brief Rabin-Williams signature scheme
template <class STANDARD, class H>
struct RWSS : public TF_SS<STANDARD, H, RW>
struct RWSS : public TF_SS<RW, STANDARD, H>
{
};

View File

@ -90,29 +90,25 @@ void SHARK::Enc::InitForKeySetup()
#endif
}
typedef word64 ArrayOf256Word64s[256];
template <const byte *sbox, const ArrayOf256Word64s *cbox>
struct SharkProcessAndXorBlock{ // VC60 workaround: problem with template functions
inline SharkProcessAndXorBlock(const word64 *roundKeys, unsigned int rounds, const byte *inBlock, const byte *xorBlock, byte *outBlock)
void SHARK::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const
{
CRYPTOPP_ASSERT(IsAlignedOn(inBlock,GetAlignmentOf<word64>()));
word64 tmp = *(word64 *)(void *)inBlock ^ roundKeys[0];
word64 tmp = *(word64 *)(void *)inBlock ^ m_roundKeys[0];
ByteOrder order = GetNativeByteOrder();
tmp = cbox[0][GetByte(order, tmp, 0)] ^ cbox[1][GetByte(order, tmp, 1)]
^ cbox[2][GetByte(order, tmp, 2)] ^ cbox[3][GetByte(order, tmp, 3)]
^ cbox[4][GetByte(order, tmp, 4)] ^ cbox[5][GetByte(order, tmp, 5)]
^ cbox[6][GetByte(order, tmp, 6)] ^ cbox[7][GetByte(order, tmp, 7)]
^ roundKeys[1];
^ m_roundKeys[1];
for(unsigned int i=2; i<rounds; i++)
for(unsigned int i=2; i<m_rounds; i++)
{
tmp = cbox[0][GETBYTE(tmp, 7)] ^ cbox[1][GETBYTE(tmp, 6)]
^ cbox[2][GETBYTE(tmp, 5)] ^ cbox[3][GETBYTE(tmp, 4)]
^ cbox[4][GETBYTE(tmp, 3)] ^ cbox[5][GETBYTE(tmp, 2)]
^ cbox[6][GETBYTE(tmp, 1)] ^ cbox[7][GETBYTE(tmp, 0)]
^ roundKeys[i];
^ m_roundKeys[i];
}
PutBlock<byte, BigEndian>(xorBlock, outBlock)
@ -126,17 +122,42 @@ inline SharkProcessAndXorBlock(const word64 *roundKeys, unsigned int rounds, con
(sbox[GETBYTE(tmp, 0)]);
CRYPTOPP_ASSERT(IsAlignedOn(outBlock,GetAlignmentOf<word64>()));
*(word64 *)(void *)outBlock ^= roundKeys[rounds];
}};
void SHARK::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const
{
SharkProcessAndXorBlock<sbox, cbox>(m_roundKeys, m_rounds, inBlock, xorBlock, outBlock);
*(word64 *)(void *)outBlock ^= m_roundKeys[m_rounds];
}
void SHARK::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const
{
SharkProcessAndXorBlock<sbox, cbox>(m_roundKeys, m_rounds, inBlock, xorBlock, outBlock);
CRYPTOPP_ASSERT(IsAlignedOn(inBlock,GetAlignmentOf<word64>()));
word64 tmp = *(word64 *)(void *)inBlock ^ m_roundKeys[0];
ByteOrder order = GetNativeByteOrder();
tmp = cbox[0][GetByte(order, tmp, 0)] ^ cbox[1][GetByte(order, tmp, 1)]
^ cbox[2][GetByte(order, tmp, 2)] ^ cbox[3][GetByte(order, tmp, 3)]
^ cbox[4][GetByte(order, tmp, 4)] ^ cbox[5][GetByte(order, tmp, 5)]
^ cbox[6][GetByte(order, tmp, 6)] ^ cbox[7][GetByte(order, tmp, 7)]
^ m_roundKeys[1];
for(unsigned int i=2; i<m_rounds; i++)
{
tmp = cbox[0][GETBYTE(tmp, 7)] ^ cbox[1][GETBYTE(tmp, 6)]
^ cbox[2][GETBYTE(tmp, 5)] ^ cbox[3][GETBYTE(tmp, 4)]
^ cbox[4][GETBYTE(tmp, 3)] ^ cbox[5][GETBYTE(tmp, 2)]
^ cbox[6][GETBYTE(tmp, 1)] ^ cbox[7][GETBYTE(tmp, 0)]
^ m_roundKeys[i];
}
PutBlock<byte, BigEndian>(xorBlock, outBlock)
(sbox[GETBYTE(tmp, 7)])
(sbox[GETBYTE(tmp, 6)])
(sbox[GETBYTE(tmp, 5)])
(sbox[GETBYTE(tmp, 4)])
(sbox[GETBYTE(tmp, 3)])
(sbox[GETBYTE(tmp, 2)])
(sbox[GETBYTE(tmp, 1)])
(sbox[GETBYTE(tmp, 0)]);
CRYPTOPP_ASSERT(IsAlignedOn(outBlock,GetAlignmentOf<word64>()));
*(word64 *)(void *)outBlock ^= m_roundKeys[m_rounds];
}
NAMESPACE_END

View File

@ -62,7 +62,7 @@ protected:
//! \brief Stream cipher policy object
//! \tparam POLICY class implementing AbstractPolicyHolder
//! \tparam BASE class or type to use as a base class
template <class POLICY, class BASE, class POLICY_INTERFACE = CPP_TYPENAME BASE::PolicyInterface>
template <class POLICY, class BASE, class POLICY_INTERFACE = typename BASE::PolicyInterface>
class ConcretePolicyHolder : public BASE, protected POLICY
{
public:

View File

@ -50,12 +50,7 @@ void Tiger::Transform (word64 *digest, const word64 *X)
INTEL_NOPREFIX
AS_PUSH_IF86(bx)
#else
#if _MSC_VER < 1300
const word64 *t = table;
AS2( mov edx, t)
#else
AS2( lea edx, [table])
#endif
AS2( mov eax, digest)
AS2( mov esi, X)
#endif

View File

@ -1714,17 +1714,14 @@ bool TestRDSEED()
}
#endif
// VC50 workaround
typedef auto_ptr<BlockTransformation> apbt;
class CipherFactory
{
public:
virtual unsigned int BlockSize() const =0;
virtual unsigned int KeyLength() const =0;
virtual apbt NewEncryption(const byte *keyStr) const =0;
virtual apbt NewDecryption(const byte *keyStr) const =0;
virtual BlockTransformation* NewEncryption(const byte *keyStr) const =0;
virtual BlockTransformation* NewDecryption(const byte *keyStr) const =0;
};
template <class E, class D> class FixedRoundsCipherFactory : public CipherFactory
@ -1734,10 +1731,10 @@ public:
unsigned int BlockSize() const {return E::BLOCKSIZE;}
unsigned int KeyLength() const {return m_keylen;}
apbt NewEncryption(const byte *keyStr) const
{return apbt(new E(keyStr, m_keylen));}
apbt NewDecryption(const byte *keyStr) const
{return apbt(new D(keyStr, m_keylen));}
BlockTransformation* NewEncryption(const byte *keyStr) const
{return new E(keyStr, m_keylen);}
BlockTransformation* NewDecryption(const byte *keyStr) const
{return new D(keyStr, m_keylen);}
unsigned int m_keylen;
};
@ -1750,10 +1747,10 @@ public:
unsigned int BlockSize() const {return E::BLOCKSIZE;}
unsigned int KeyLength() const {return m_keylen;}
apbt NewEncryption(const byte *keyStr) const
{return apbt(new E(keyStr, m_keylen, m_rounds));}
apbt NewDecryption(const byte *keyStr) const
{return apbt(new D(keyStr, m_keylen, m_rounds));}
BlockTransformation* NewEncryption(const byte *keyStr) const
{return new E(keyStr, m_keylen, m_rounds);}
BlockTransformation* NewDecryption(const byte *keyStr) const
{return new D(keyStr, m_keylen, m_rounds);}
unsigned int m_keylen, m_rounds;
};
@ -1771,11 +1768,11 @@ bool BlockTransformationTest(const CipherFactory &cg, BufferedTransformation &va
valdata.Get(plain, cg.BlockSize());
valdata.Get(cipher, cg.BlockSize());
apbt transE = cg.NewEncryption(key);
member_ptr<BlockTransformation> transE(cg.NewEncryption(key));
transE->ProcessBlock(plain, out);
fail = memcmp(out, cipher, cg.BlockSize()) != 0;
apbt transD = cg.NewDecryption(key);
member_ptr<BlockTransformation> transD(cg.NewDecryption(key));
transD->ProcessBlock(out, outplain);
fail=fail || memcmp(outplain, plain, cg.BlockSize());
@ -2239,11 +2236,11 @@ bool ValidateRC2()
valdata.Get(plain, RC2Encryption::BLOCKSIZE);
valdata.Get(cipher, RC2Encryption::BLOCKSIZE);
apbt transE(new RC2Encryption(key, keyLen, effectiveLen));
member_ptr<BlockTransformation> transE(new RC2Encryption(key, keyLen, effectiveLen));
transE->ProcessBlock(plain, out);
fail = memcmp(out, cipher, RC2Encryption::BLOCKSIZE) != 0;
apbt transD(new RC2Decryption(key, keyLen, effectiveLen));
member_ptr<BlockTransformation> transD(new RC2Decryption(key, keyLen, effectiveLen));
transD->ProcessBlock(out, outplain);
fail=fail || memcmp(outplain, plain, RC2Encryption::BLOCKSIZE);
@ -2386,7 +2383,6 @@ bool ValidateARC4()
0x9e,0x27,0x55,0xab,0x18,0x1a,0xb7,0xe9,0x40,0xb0,
0xc0};
// VC60 workaround: auto_ptr lacks reset()
member_ptr<Weak::ARC4> arc4;
bool pass=true, fail;
unsigned int i;

View File

@ -196,7 +196,7 @@ VMAC_Base::VHASH_Update_SSE2(const word64 *data, size_t blocksRemainingInWord64,
AS2( mov %1, %%ebx)
INTEL_NOPREFIX
#else
#if _MSC_VER < 1300 || defined(__INTEL_COMPILER)
#if defined(__INTEL_COMPILER)
char isFirstBlock = m_isFirstBlock;
AS2( mov ebx, [L1KeyLength])
AS2( mov dl, [isFirstBlock])
@ -540,9 +540,7 @@ VMAC_Base::VHASH_Update_SSE2(const word64 *data, size_t blocksRemainingInWord64,
}
#endif
#if !(defined(_MSC_VER) && _MSC_VER < 1300)
template <bool T_128BitTag>
#endif
void VMAC_Base::VHASH_Update_Template(const word64 *data, size_t blocksRemainingInWord64)
{
CRYPTOPP_ASSERT(IsAlignedOn(m_polyState(),GetAlignmentOf<word64>()));
@ -556,9 +554,6 @@ void VMAC_Base::VHASH_Update_Template(const word64 *data, size_t blocksRemaining
AccumulateNH(nhB, d0+nhK[i+2*j+2], d1+nhK[i+2*j+3]);\
}
#if (defined(_MSC_VER) && _MSC_VER < 1300)
bool T_128BitTag = m_is128;
#endif
size_t L1KeyLengthInWord64 = m_L1KeyLength / 8;
size_t innerLoopEnd = L1KeyLengthInWord64;
const word64 *nhK = m_nhKey();
@ -816,14 +811,10 @@ inline void VMAC_Base::VHASH_Update(const word64 *data, size_t blocksRemainingIn
else
#endif
{
#if defined(_MSC_VER) && _MSC_VER < 1300
VHASH_Update_Template(data, blocksRemainingInWord64);
#else
if (m_is128)
VHASH_Update_Template<true>(data, blocksRemainingInWord64);
else
VHASH_Update_Template<false>(data, blocksRemainingInWord64);
#endif
}
}

4
vmac.h
View File

@ -48,10 +48,8 @@ protected:
word64* DataBuf() {return (word64 *)(void*)m_data();}
void VHASH_Update_SSE2(const word64 *data, size_t blocksRemainingInWord64, int tagPart);
#if !(defined(_MSC_VER) && _MSC_VER < 1300) // can't use function template here with VC6
template <bool T_128BitTag>
#endif
void VHASH_Update_Template(const word64 *data, size_t blockRemainingInWord128);
void VHASH_Update_Template(const word64 *data, size_t blockRemainingInWord128);
void VHASH_Update(const word64 *data, size_t blocksRemainingInWord128);
CRYPTOPP_BLOCK_1(polyState, word64, 4*(m_is128+1))

View File

@ -422,9 +422,6 @@ void Whirlpool::Transform(word64 *digest, const word64 *block)
AS_PUSH_IF86( bx)
AS2( mov AS_REG_6, WORD_REG(ax))
#else
#if _MSC_VER < 1300
AS_PUSH_IF86( bx)
#endif
AS2( lea AS_REG_6, [Whirlpool_C])
AS2( mov WORD_REG(cx), digest)
AS2( mov WORD_REG(dx), block)
@ -586,7 +583,7 @@ void Whirlpool::Transform(word64 *digest, const word64 *block)
AS_POP_IF86( sp)
AS1( emms)
#if defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER < 1300)
#if defined(__GNUC__)
AS_POP_IF86( bx)
#endif
#ifdef __GNUC__