fix possible error during DLL startup self-test due to calling functions in ADVAPI32.DLL from DllMain() (http://sourceforge.net/apps/trac/cryptopp/ticket/4)
parent
a3f2091bcd
commit
05e42a01d9
21
fipstest.cpp
21
fipstest.cpp
|
|
@ -69,7 +69,7 @@ void X917RNG_KnownAnswerTest(
|
||||||
StringSource(seed, true, new HexDecoder(new StringSink(decodedSeed)));
|
StringSource(seed, true, new HexDecoder(new StringSink(decodedSeed)));
|
||||||
StringSource(deterministicTimeVector, true, new HexDecoder(new StringSink(decodedDeterministicTimeVector)));
|
StringSource(deterministicTimeVector, true, new HexDecoder(new StringSink(decodedDeterministicTimeVector)));
|
||||||
|
|
||||||
AutoSeededX917RNG<CIPHER> rng;
|
AutoSeededX917RNG<CIPHER> rng(false, false);
|
||||||
rng.Reseed((const byte *)decodedKey.data(), decodedKey.size(), (const byte *)decodedSeed.data(), (const byte *)decodedDeterministicTimeVector.data());
|
rng.Reseed((const byte *)decodedKey.data(), decodedKey.size(), (const byte *)decodedSeed.data(), (const byte *)decodedDeterministicTimeVector.data());
|
||||||
KnownAnswerTest(rng, output);
|
KnownAnswerTest(rng, output);
|
||||||
#else
|
#else
|
||||||
|
|
@ -154,15 +154,10 @@ 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, SCHEME *dummy = NULL)
|
||||||
{
|
{
|
||||||
#ifdef OS_RNG_AVAILABLE
|
|
||||||
DefaultAutoSeededRNG rng;
|
|
||||||
#else
|
|
||||||
RandomNumberGenerator &rng = NullRNG();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
RandomPool rng;
|
||||||
EqualityComparisonFilter comparison;
|
EqualityComparisonFilter comparison;
|
||||||
|
|
||||||
StringSource(message, true, new SignerFilter(rng, signer, new ChannelSwitch(comparison, "0")));
|
StringSource(message, true, new SignerFilter(rng, signer, new ChannelSwitch(comparison, "0")));
|
||||||
|
|
@ -180,11 +175,7 @@ void EncryptionPairwiseConsistencyTest(const PK_Encryptor &encryptor, const PK_D
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#ifdef OS_RNG_AVAILABLE
|
RandomPool rng;
|
||||||
DefaultAutoSeededRNG rng;
|
|
||||||
#else
|
|
||||||
RandomNumberGenerator &rng = NullRNG();
|
|
||||||
#endif
|
|
||||||
const char *testMessage ="test message";
|
const char *testMessage ="test message";
|
||||||
std::string ciphertext, decrypted;
|
std::string ciphertext, decrypted;
|
||||||
|
|
||||||
|
|
@ -220,11 +211,7 @@ void SignaturePairwiseConsistencyTest(const PK_Signer &signer, const PK_Verifier
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#ifdef OS_RNG_AVAILABLE
|
RandomPool rng;
|
||||||
DefaultAutoSeededRNG rng;
|
|
||||||
#else
|
|
||||||
RandomNumberGenerator &rng = NullRNG();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
StringSource(
|
StringSource(
|
||||||
"test message",
|
"test message",
|
||||||
|
|
|
||||||
4
osrng.h
4
osrng.h
|
|
@ -96,8 +96,8 @@ class AutoSeededX917RNG : public RandomNumberGenerator, public NotCopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! use blocking to choose seeding with BlockingRng or NonblockingRng. the parameter is ignored if only one of these is available
|
//! use blocking to choose seeding with BlockingRng or NonblockingRng. the parameter is ignored if only one of these is available
|
||||||
explicit AutoSeededX917RNG(bool blocking = false)
|
explicit AutoSeededX917RNG(bool blocking = false, bool autoSeed = true)
|
||||||
{Reseed(blocking);}
|
{if (autoSeed) Reseed(blocking);}
|
||||||
void Reseed(bool blocking = false, const byte *additionalEntropy = NULL, size_t length = 0);
|
void Reseed(bool blocking = false, const byte *additionalEntropy = NULL, size_t length = 0);
|
||||||
// exposed for testing
|
// exposed for testing
|
||||||
void Reseed(const byte *key, size_t keylength, const byte *seed, const byte *timeVector);
|
void Reseed(const byte *key, size_t keylength, const byte *seed, const byte *timeVector);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue