Removed remaining dummy parameters for VC6.0 workarounds (Issue 342)
parent
7c73f25f12
commit
86b89cd18b
62
factory.h
62
factory.h
|
|
@ -1,5 +1,8 @@
|
||||||
// factory.h - written and placed in the public domain by Wei Dai
|
// factory.h - written and placed in the public domain by Wei Dai
|
||||||
|
|
||||||
|
//! \file factory.h
|
||||||
|
//! \brief Classes and functions for registering and locating library objects
|
||||||
|
|
||||||
#ifndef CRYPTOPP_OBJFACT_H
|
#ifndef CRYPTOPP_OBJFACT_H
|
||||||
#define CRYPTOPP_OBJFACT_H
|
#define CRYPTOPP_OBJFACT_H
|
||||||
|
|
||||||
|
|
@ -9,7 +12,9 @@
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
//! _
|
//! \class ObjectFactory
|
||||||
|
//! \brief Object factory interface for registering objects
|
||||||
|
//! \tparam AbstractClass Base class interface of the object
|
||||||
template <class AbstractClass>
|
template <class AbstractClass>
|
||||||
class ObjectFactory
|
class ObjectFactory
|
||||||
{
|
{
|
||||||
|
|
@ -18,7 +23,10 @@ public:
|
||||||
virtual AbstractClass * CreateObject() const =0;
|
virtual AbstractClass * CreateObject() const =0;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! _
|
//! \class DefaultObjectFactory
|
||||||
|
//! \brief Object factory for registering objects
|
||||||
|
//! \tparam AbstractClass Base class interface of the object
|
||||||
|
//! \tparam ConcreteClass Class object
|
||||||
template <class AbstractClass, class ConcreteClass>
|
template <class AbstractClass, class ConcreteClass>
|
||||||
class DefaultObjectFactory : public ObjectFactory<AbstractClass>
|
class DefaultObjectFactory : public ObjectFactory<AbstractClass>
|
||||||
{
|
{
|
||||||
|
|
@ -29,7 +37,10 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//! _
|
//! \class ObjectFactoryRegistry
|
||||||
|
//! \brief Object factory registry
|
||||||
|
//! \tparam AbstractClass Base class interface of the object
|
||||||
|
//! \tparam instance unique identifier
|
||||||
template <class AbstractClass, int instance=0>
|
template <class AbstractClass, int instance=0>
|
||||||
class ObjectFactoryRegistry
|
class ObjectFactoryRegistry
|
||||||
{
|
{
|
||||||
|
|
@ -94,6 +105,11 @@ ObjectFactoryRegistry<AbstractClass, instance> & ObjectFactoryRegistry<AbstractC
|
||||||
return s_registry;
|
return s_registry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \class RegisterDefaultFactoryFor
|
||||||
|
//! \brief Object factory registry helper
|
||||||
|
//! \tparam AbstractClass Base class interface of the object
|
||||||
|
//! \tparam ConcreteClass Class object
|
||||||
|
//! \tparam instance unique identifier
|
||||||
template <class AbstractClass, class ConcreteClass, int instance = 0>
|
template <class AbstractClass, class ConcreteClass, int instance = 0>
|
||||||
struct RegisterDefaultFactoryFor
|
struct RegisterDefaultFactoryFor
|
||||||
{
|
{
|
||||||
|
|
@ -106,34 +122,58 @@ struct RegisterDefaultFactoryFor
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//! \fn RegisterAsymmetricCipherDefaultFactories
|
||||||
|
//! \brief Register asymmetric ciphers
|
||||||
|
//! \tparam SchemeClass interface of the object under a scheme
|
||||||
|
//! \details Schemes include asymmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>),
|
||||||
|
//! signature schemes (registers <tt>SchemeClass::Signer</tt> and <tt>SchemeClass::Verifier</tt>),
|
||||||
|
//! symmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>),
|
||||||
|
//! authenticated symmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>), etc.
|
||||||
template <class SchemeClass>
|
template <class SchemeClass>
|
||||||
void RegisterAsymmetricCipherDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL)
|
void RegisterAsymmetricCipherDefaultFactories(const char *name=NULL)
|
||||||
{
|
{
|
||||||
CRYPTOPP_UNUSED(dummy);
|
|
||||||
RegisterDefaultFactoryFor<PK_Encryptor, typename SchemeClass::Encryptor>((const char *)name);
|
RegisterDefaultFactoryFor<PK_Encryptor, typename SchemeClass::Encryptor>((const char *)name);
|
||||||
RegisterDefaultFactoryFor<PK_Decryptor, typename SchemeClass::Decryptor>((const char *)name);
|
RegisterDefaultFactoryFor<PK_Decryptor, typename SchemeClass::Decryptor>((const char *)name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \fn RegisterSignatureSchemeDefaultFactories
|
||||||
|
//! \brief Register signature schemes
|
||||||
|
//! \tparam SchemeClass interface of the object under a scheme
|
||||||
|
//! \details Schemes include asymmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>),
|
||||||
|
//! signature schemes (registers <tt>SchemeClass::Signer</tt> and <tt>SchemeClass::Verifier</tt>),
|
||||||
|
//! symmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>),
|
||||||
|
//! authenticated symmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>), etc.
|
||||||
template <class SchemeClass>
|
template <class SchemeClass>
|
||||||
void RegisterSignatureSchemeDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL)
|
void RegisterSignatureSchemeDefaultFactories(const char *name=NULL)
|
||||||
{
|
{
|
||||||
CRYPTOPP_UNUSED(dummy);
|
|
||||||
RegisterDefaultFactoryFor<PK_Signer, typename SchemeClass::Signer>((const char *)name);
|
RegisterDefaultFactoryFor<PK_Signer, typename SchemeClass::Signer>((const char *)name);
|
||||||
RegisterDefaultFactoryFor<PK_Verifier, typename SchemeClass::Verifier>((const char *)name);
|
RegisterDefaultFactoryFor<PK_Verifier, typename SchemeClass::Verifier>((const char *)name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \fn RegisterSymmetricCipherDefaultFactories
|
||||||
|
//! \brief Register symmetric ciphers
|
||||||
|
//! \tparam SchemeClass interface of the object under a scheme
|
||||||
|
//! \details Schemes include asymmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>),
|
||||||
|
//! signature schemes (registers <tt>SchemeClass::Signer</tt> and <tt>SchemeClass::Verifier</tt>),
|
||||||
|
//! symmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>),
|
||||||
|
//! authenticated symmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>), etc.
|
||||||
template <class SchemeClass>
|
template <class SchemeClass>
|
||||||
void RegisterSymmetricCipherDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL)
|
void RegisterSymmetricCipherDefaultFactories(const char *name=NULL)
|
||||||
{
|
{
|
||||||
CRYPTOPP_UNUSED(dummy);
|
|
||||||
RegisterDefaultFactoryFor<SymmetricCipher, typename SchemeClass::Encryption, ENCRYPTION>((const char *)name);
|
RegisterDefaultFactoryFor<SymmetricCipher, typename SchemeClass::Encryption, ENCRYPTION>((const char *)name);
|
||||||
RegisterDefaultFactoryFor<SymmetricCipher, typename SchemeClass::Decryption, DECRYPTION>((const char *)name);
|
RegisterDefaultFactoryFor<SymmetricCipher, typename SchemeClass::Decryption, DECRYPTION>((const char *)name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \fn RegisterAuthenticatedSymmetricCipherDefaultFactories
|
||||||
|
//! \brief Register authenticated symmetric ciphers
|
||||||
|
//! \tparam SchemeClass interface of the object under a scheme
|
||||||
|
//! \details Schemes include asymmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>),
|
||||||
|
//! signature schemes (registers <tt>SchemeClass::Signer</tt> and <tt>SchemeClass::Verifier</tt>),
|
||||||
|
//! symmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>),
|
||||||
|
//! authenticated symmetric ciphers (registers <tt>SchemeClass::Encryptor</tt> and <tt>SchemeClass::Decryptor</tt>), etc.
|
||||||
template <class SchemeClass>
|
template <class SchemeClass>
|
||||||
void RegisterAuthenticatedSymmetricCipherDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL)
|
void RegisterAuthenticatedSymmetricCipherDefaultFactories(const char *name=NULL)
|
||||||
{
|
{
|
||||||
CRYPTOPP_UNUSED(dummy);
|
|
||||||
RegisterDefaultFactoryFor<AuthenticatedSymmetricCipher, typename SchemeClass::Encryption, ENCRYPTION>((const char *)name);
|
RegisterDefaultFactoryFor<AuthenticatedSymmetricCipher, typename SchemeClass::Encryption, ENCRYPTION>((const char *)name);
|
||||||
RegisterDefaultFactoryFor<AuthenticatedSymmetricCipher, typename SchemeClass::Decryption, DECRYPTION>((const char *)name);
|
RegisterDefaultFactoryFor<AuthenticatedSymmetricCipher, typename SchemeClass::Decryption, DECRYPTION>((const char *)name);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
20
fipstest.cpp
20
fipstest.cpp
|
|
@ -93,10 +93,8 @@ void X917RNG_KnownAnswerTest(
|
||||||
const char *key,
|
const char *key,
|
||||||
const char *seed,
|
const char *seed,
|
||||||
const char *deterministicTimeVector,
|
const char *deterministicTimeVector,
|
||||||
const char *output,
|
const char *output)
|
||||||
CIPHER *dummy = NULL)
|
|
||||||
{
|
{
|
||||||
CRYPTOPP_UNUSED(dummy);
|
|
||||||
#ifdef OS_RNG_AVAILABLE
|
#ifdef OS_RNG_AVAILABLE
|
||||||
std::string decodedKey, decodedSeed, decodedDeterministicTimeVector;
|
std::string decodedKey, decodedSeed, decodedDeterministicTimeVector;
|
||||||
StringSource(key, true, new HexDecoder(new StringSink(decodedKey)));
|
StringSource(key, true, new HexDecoder(new StringSink(decodedKey)));
|
||||||
|
|
@ -134,10 +132,8 @@ void SymmetricEncryptionKnownAnswerTest(
|
||||||
const char *cbc,
|
const char *cbc,
|
||||||
const char *cfb,
|
const char *cfb,
|
||||||
const char *ofb,
|
const char *ofb,
|
||||||
const char *ctr,
|
const char *ctr)
|
||||||
CIPHER *dummy = NULL)
|
|
||||||
{
|
{
|
||||||
CRYPTOPP_UNUSED(dummy);
|
|
||||||
std::string decodedKey;
|
std::string decodedKey;
|
||||||
StringSource(key, true, new HexDecoder(new StringSink(decodedKey)));
|
StringSource(key, true, new HexDecoder(new StringSink(decodedKey)));
|
||||||
|
|
||||||
|
|
@ -170,17 +166,15 @@ void KnownAnswerTest(HashTransformation &hash, const char *message, const char *
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class HASH>
|
template <class HASH>
|
||||||
void SecureHashKnownAnswerTest(const char *message, const char *digest, HASH *dummy = NULL)
|
void SecureHashKnownAnswerTest(const char *message, const char *digest)
|
||||||
{
|
{
|
||||||
CRYPTOPP_UNUSED(dummy);
|
|
||||||
HASH hash;
|
HASH hash;
|
||||||
KnownAnswerTest(hash, message, digest);
|
KnownAnswerTest(hash, message, digest);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MAC>
|
template <class MAC>
|
||||||
void MAC_KnownAnswerTest(const char *key, const char *message, const char *digest, MAC *dummy = NULL)
|
void MAC_KnownAnswerTest(const char *key, const char *message, const char *digest)
|
||||||
{
|
{
|
||||||
CRYPTOPP_UNUSED(dummy);
|
|
||||||
std::string decodedKey;
|
std::string decodedKey;
|
||||||
StringSource(key, true, new HexDecoder(new StringSink(decodedKey)));
|
StringSource(key, true, new HexDecoder(new StringSink(decodedKey)));
|
||||||
|
|
||||||
|
|
@ -189,12 +183,11 @@ void MAC_KnownAnswerTest(const char *key, const char *message, const char *diges
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class SCHEME>
|
template <class SCHEME>
|
||||||
void SignatureKnownAnswerTest(const char *key, const char *message, const char *signature, SCHEME *dummy = NULL)
|
void SignatureKnownAnswerTest(const char *key, const char *message, const char *signature)
|
||||||
{
|
{
|
||||||
typename SCHEME::Signer signer(StringSource(key, true, new HexDecoder).Ref());
|
typename SCHEME::Signer signer(StringSource(key, true, new HexDecoder).Ref());
|
||||||
typename SCHEME::Verifier verifier(signer);
|
typename SCHEME::Verifier verifier(signer);
|
||||||
|
|
||||||
CRYPTOPP_UNUSED(dummy);
|
|
||||||
RandomPool rng;
|
RandomPool rng;
|
||||||
EqualityComparisonFilter comparison;
|
EqualityComparisonFilter comparison;
|
||||||
|
|
||||||
|
|
@ -267,12 +260,11 @@ void SignaturePairwiseConsistencyTest(const PK_Signer &signer, const PK_Verifier
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class SCHEME>
|
template <class SCHEME>
|
||||||
void SignaturePairwiseConsistencyTest(const char *key, SCHEME *dummy = NULL)
|
void SignaturePairwiseConsistencyTest(const char *key)
|
||||||
{
|
{
|
||||||
typename SCHEME::Signer signer(StringSource(key, true, new HexDecoder).Ref());
|
typename SCHEME::Signer signer(StringSource(key, true, new HexDecoder).Ref());
|
||||||
typename SCHEME::Verifier verifier(signer);
|
typename SCHEME::Verifier verifier(signer);
|
||||||
|
|
||||||
CRYPTOPP_UNUSED(dummy);
|
|
||||||
SignaturePairwiseConsistencyTest(signer, verifier);
|
SignaturePairwiseConsistencyTest(signer, verifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue