2015-11-05 06:59:46 +00:00
|
|
|
#ifndef CRYPTOPP_VALIDATE_H
|
|
|
|
#define CRYPTOPP_VALIDATE_H
|
|
|
|
|
|
|
|
#include "cryptlib.h"
|
2015-12-29 12:16:44 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <iomanip>
|
2015-11-05 06:59:46 +00:00
|
|
|
|
|
|
|
bool ValidateAll(bool thorough);
|
|
|
|
bool TestSettings();
|
|
|
|
bool TestOS_RNG();
|
|
|
|
bool TestAutoSeeded();
|
2016-01-03 17:53:46 +00:00
|
|
|
bool TestAutoSeededX917();
|
2015-11-18 20:32:28 +00:00
|
|
|
|
|
|
|
#if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
|
2015-11-05 06:59:46 +00:00
|
|
|
bool TestRDRAND();
|
|
|
|
bool TestRDSEED();
|
2015-11-18 20:32:28 +00:00
|
|
|
#endif
|
2015-11-05 06:59:46 +00:00
|
|
|
|
2015-11-18 20:32:28 +00:00
|
|
|
bool ValidateBaseCode();
|
2015-11-05 06:59:46 +00:00
|
|
|
bool ValidateCRC32();
|
2016-04-24 17:24:45 +00:00
|
|
|
bool ValidateCRC32C();
|
2015-11-05 06:59:46 +00:00
|
|
|
bool ValidateAdler32();
|
|
|
|
bool ValidateMD2();
|
|
|
|
bool ValidateMD4();
|
|
|
|
bool ValidateMD5();
|
|
|
|
bool ValidateSHA();
|
|
|
|
bool ValidateSHA2();
|
|
|
|
bool ValidateTiger();
|
|
|
|
bool ValidateRIPEMD();
|
|
|
|
bool ValidatePanama();
|
|
|
|
bool ValidateWhirlpool();
|
2016-11-27 20:31:50 +00:00
|
|
|
|
|
|
|
bool ValidatePoly1305();
|
2016-04-18 06:39:10 +00:00
|
|
|
bool ValidateBLAKE2s();
|
|
|
|
bool ValidateBLAKE2b();
|
2015-11-05 06:59:46 +00:00
|
|
|
|
|
|
|
bool ValidateHMAC();
|
|
|
|
bool ValidateTTMAC();
|
|
|
|
|
|
|
|
bool ValidateCipherModes();
|
|
|
|
bool ValidatePBKDF();
|
|
|
|
bool ValidateHKDF();
|
|
|
|
|
|
|
|
bool ValidateDES();
|
|
|
|
bool ValidateIDEA();
|
|
|
|
bool ValidateSAFER();
|
|
|
|
bool ValidateRC2();
|
|
|
|
bool ValidateARC4();
|
|
|
|
|
|
|
|
bool ValidateRC5();
|
|
|
|
bool ValidateBlowfish();
|
|
|
|
bool ValidateThreeWay();
|
|
|
|
bool ValidateGOST();
|
|
|
|
bool ValidateSHARK();
|
|
|
|
bool ValidateSEAL();
|
|
|
|
bool ValidateCAST();
|
|
|
|
bool ValidateSquare();
|
|
|
|
bool ValidateSKIPJACK();
|
|
|
|
bool ValidateRC6();
|
|
|
|
bool ValidateMARS();
|
|
|
|
bool ValidateRijndael();
|
|
|
|
bool ValidateTwofish();
|
|
|
|
bool ValidateSerpent();
|
|
|
|
bool ValidateSHACAL2();
|
|
|
|
bool ValidateCamellia();
|
|
|
|
bool ValidateSalsa();
|
|
|
|
bool ValidateSosemanuk();
|
|
|
|
bool ValidateVMAC();
|
|
|
|
bool ValidateCCM();
|
|
|
|
bool ValidateGCM();
|
|
|
|
bool ValidateCMAC();
|
|
|
|
|
|
|
|
bool ValidateBBS();
|
|
|
|
bool ValidateDH();
|
|
|
|
bool ValidateMQV();
|
2016-07-04 17:05:38 +00:00
|
|
|
bool ValidateHMQV();
|
|
|
|
bool ValidateFHMQV();
|
2015-11-05 06:59:46 +00:00
|
|
|
bool ValidateRSA();
|
|
|
|
bool ValidateElGamal();
|
|
|
|
bool ValidateDLIES();
|
|
|
|
bool ValidateNR();
|
|
|
|
bool ValidateDSA(bool thorough);
|
|
|
|
bool ValidateLUC();
|
|
|
|
bool ValidateLUC_DL();
|
|
|
|
bool ValidateLUC_DH();
|
|
|
|
bool ValidateXTR_DH();
|
|
|
|
bool ValidateRabin();
|
|
|
|
bool ValidateRW();
|
|
|
|
//bool ValidateBlumGoldwasser();
|
|
|
|
bool ValidateECP();
|
|
|
|
bool ValidateEC2N();
|
|
|
|
bool ValidateECDSA();
|
|
|
|
bool ValidateESIGN();
|
|
|
|
|
2016-10-18 02:00:31 +00:00
|
|
|
#if defined(CRYPTOPP_DEBUG)
|
2015-12-28 05:11:52 +00:00
|
|
|
bool TestSecBlock();
|
2015-11-18 20:32:28 +00:00
|
|
|
bool TestPolynomialMod2();
|
2016-08-21 07:18:26 +00:00
|
|
|
bool TestHuffmanCodes();
|
2015-11-18 20:32:28 +00:00
|
|
|
#endif
|
|
|
|
|
2015-12-29 12:16:44 +00:00
|
|
|
// Coverity finding
|
2015-11-18 20:32:28 +00:00
|
|
|
template <class T, bool NON_NEGATIVE>
|
|
|
|
T StringToValue(const std::string& str);
|
2015-12-29 12:16:44 +00:00
|
|
|
|
|
|
|
// Coverity finding
|
2015-11-18 20:32:28 +00:00
|
|
|
template<>
|
|
|
|
int StringToValue<int, true>(const std::string& str);
|
|
|
|
|
2015-12-29 12:16:44 +00:00
|
|
|
// Coverity finding
|
|
|
|
class StreamState
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
StreamState(std::ostream& out)
|
|
|
|
: m_out(out), m_fmt(out.flags()), m_prec(out.precision())
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
~StreamState()
|
|
|
|
{
|
|
|
|
m_out.precision(m_prec);
|
|
|
|
m_out.flags(m_fmt);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::ostream& m_out;
|
|
|
|
std::ios_base::fmtflags m_fmt;
|
|
|
|
std::streamsize m_prec;
|
|
|
|
};
|
|
|
|
|
2015-11-18 20:32:28 +00:00
|
|
|
// Functions that need a RNG; uses AES inf CFB mode with Seed.
|
2015-11-05 06:59:46 +00:00
|
|
|
CryptoPP::RandomNumberGenerator & GlobalRNG();
|
2015-11-18 20:32:28 +00:00
|
|
|
|
2015-11-05 06:59:46 +00:00
|
|
|
bool RunTestDataFile(const char *filename, const CryptoPP::NameValuePairs &overrideParameters=CryptoPP::g_nullNameValuePairs, bool thorough=true);
|
|
|
|
|
|
|
|
#endif
|