pull/484/merge
Wyatt O'Day 2017-10-04 11:56:40 +00:00 committed by GitHub
commit 0d8a53bade
21 changed files with 28 additions and 22 deletions

View File

@ -7,7 +7,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
void ThreeWay_TestInstantiations() void ThreeWay_TestInstantiations()
{ {
ThreeWay::Encryption x1; ThreeWay::Encryption x1;

View File

@ -13,7 +13,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
namespace Weak1 { namespace Weak1 {
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
void ARC4_TestInstantiations() void ARC4_TestInstantiations()
{ {
ARC4 x; ARC4 x;

View File

@ -17,7 +17,7 @@ NAMESPACE_BEGIN(CryptoPP)
a += b; d ^= a; d = rotlFixed<word32>(d, 8); \ a += b; d ^= a; d = rotlFixed<word32>(d, 8); \
c += d; b ^= c; b = rotlFixed<word32>(b, 7); c += d; b ^= c; b = rotlFixed<word32>(b, 7);
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
void ChaCha_TestInstantiations() void ChaCha_TestInstantiations()
{ {
ChaCha8::Encryption x1; ChaCha8::Encryption x1;

View File

@ -137,6 +137,12 @@
# define CRYPTOPP_DEBUG 1 # define CRYPTOPP_DEBUG 1
#endif #endif
// CRYPTOPP_TEST_INSTANTIATIONS enables the class instantiation tests
// in each encryption source. For example, RSA_TestInstantiations().
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) && !defined(CRYPTOPP_NO_TESTS)
# define CRYPTOPP_TEST_INSTANTIATIONS 1
#endif
// ***************** Important Settings Again ******************** // ***************** Important Settings Again ********************
// But the defaults should be ok. // But the defaults should be ok.

2
dh.cpp
View File

@ -8,7 +8,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
void DH_TestInstantiations() void DH_TestInstantiations()
{ {
DH dh1; DH dh1;

View File

@ -7,7 +7,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
struct NullCryptoParameters : public CryptoParameters struct NullCryptoParameters : public CryptoParameters
{ {
void AssignFrom(const NameValuePairs &source) { void AssignFrom(const NameValuePairs &source) {

View File

@ -31,7 +31,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
#if 0 #if 0
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
static void ECDSA_TestInstantiations() static void ECDSA_TestInstantiations()
{ {
ECDSA<EC2N>::Signer t1; ECDSA<EC2N>::Signer t1;

View File

@ -7,7 +7,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
void ElGamal_TestInstantiations() void ElGamal_TestInstantiations()
{ {
ElGamalEncryptor test1(1, 1, 1); ElGamalEncryptor test1(1, 1, 1);

View File

@ -18,7 +18,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
void ESIGN_TestInstantiations() void ESIGN_TestInstantiations()
{ {
ESIGN<SHA1>::Verifier x1(1, 1); ESIGN<SHA1>::Verifier x1(1, 1);

View File

@ -10,7 +10,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
void Files_TestInstantiations() void Files_TestInstantiations()
{ {
FileStore f0; FileStore f0;

View File

@ -20,7 +20,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
void TestInstantiations_gfpcrypt() void TestInstantiations_gfpcrypt()
{ {
GDSA<SHA1>::Signer test; GDSA<SHA1>::Signer test;

View File

@ -2712,7 +2712,7 @@ static inline void AtomicDivide(word *Q, const word *A, const word *B)
Q[1] = SubatomicDivide(T+1, B[0], B[1]); Q[1] = SubatomicDivide(T+1, B[0], B[1]);
Q[0] = SubatomicDivide(T, B[0], B[1]); Q[0] = SubatomicDivide(T, B[0], B[1]);
#if defined(CRYPTOPP_DEBUG) #if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_NO_TESTS)
// multiply quotient and divisor and add remainder, make sure it equals dividend // multiply quotient and divisor and add remainder, make sure it equals dividend
CRYPTOPP_ASSERT(!T[2] && !T[3] && (T[1] < B[1] || (T[1]==B[1] && T[0]<B[0]))); CRYPTOPP_ASSERT(!T[2] && !T[3] && (T[1] < B[1] || (T[1]==B[1] && T[0]<B[0])));
word P[4]; word P[4];
@ -2731,7 +2731,7 @@ static inline void AtomicDivide(word *Q, const word *A, const word *B)
Q[0] = q.GetLowHalf(); Q[0] = q.GetLowHalf();
Q[1] = q.GetHighHalf(); Q[1] = q.GetHighHalf();
#if defined(CRYPTOPP_DEBUG) #if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_NO_TESTS)
if (B[0] || B[1]) if (B[0] || B[1])
{ {
// multiply quotient and divisor and add remainder, make sure it equals dividend // multiply quotient and divisor and add remainder, make sure it equals dividend

View File

@ -11,7 +11,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
void LUC_TestInstantiations() void LUC_TestInstantiations()
{ {
LUC_HMP<SHA1>::Signer t1; LUC_HMP<SHA1>::Signer t1;

View File

@ -9,7 +9,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
namespace Weak1 { namespace Weak1 {
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
void MD5_TestInstantiations() void MD5_TestInstantiations()
{ {
MD5 x; MD5 x;

View File

@ -7,13 +7,13 @@
#include "modes.h" #include "modes.h"
#include "misc.h" #include "misc.h"
#if defined(CRYPTOPP_DEBUG) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
#include "des.h" #include "des.h"
#endif #endif
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
void Modes_TestInstantiations() void Modes_TestInstantiations()
{ {
CFB_Mode<DES>::Encryption m0; CFB_Mode<DES>::Encryption m0;

View File

@ -9,7 +9,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
void TestInstantiations_MQV() void TestInstantiations_MQV()
{ {
MQV mqv; MQV mqv;

View File

@ -11,7 +11,7 @@
#include "fips140.h" #include "fips140.h"
#include "pkcspad.h" #include "pkcspad.h"
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) && !defined(CRYPTOPP_IS_DLL) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
#include "pssr.h" #include "pssr.h"
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
void RSA_TestInstantiations() void RSA_TestInstantiations()

View File

@ -30,7 +30,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
void Salsa20_TestInstantiations() void Salsa20_TestInstantiations()
{ {
Salsa20::Encryption x1; Salsa20::Encryption x1;

View File

@ -11,7 +11,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
void SEAL_TestInstantiations() void SEAL_TestInstantiations()
{ {
SEAL<>::Encryption x; SEAL<>::Encryption x;

View File

@ -7,7 +7,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
void WAKE_TestInstantiations() void WAKE_TestInstantiations()
{ {
WAKE_OFB<>::Encryption x2; WAKE_OFB<>::Encryption x2;

View File

@ -83,7 +83,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if defined(CRYPTOPP_TEST_INSTANTIATIONS)
void Whirlpool_TestInstantiations() void Whirlpool_TestInstantiations()
{ {
Whirlpool x; Whirlpool x;