Change from NDEBUG to CRYPTOPP_DEBUG in source files to ensure all debug behavior pivots on CRYPTOPP_DEBUG, and not NDEBUG (Issue 277, CVE-2016-7420)
parent
6847978f0a
commit
91ca6c117d
2
3way.cpp
2
3way.cpp
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
void ThreeWay_TestInstantiations()
|
void ThreeWay_TestInstantiations()
|
||||||
{
|
{
|
||||||
ThreeWay::Encryption x1;
|
ThreeWay::Encryption x1;
|
||||||
|
|
|
||||||
2
arc4.cpp
2
arc4.cpp
|
|
@ -13,7 +13,7 @@
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
namespace Weak1 {
|
namespace Weak1 {
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
void ARC4_TestInstantiations()
|
void ARC4_TestInstantiations()
|
||||||
{
|
{
|
||||||
ARC4 x;
|
ARC4 x;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,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(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
void ChaCha_TestInstantiations()
|
void ChaCha_TestInstantiations()
|
||||||
{
|
{
|
||||||
ChaCha8::Encryption x1;
|
ChaCha8::Encryption x1;
|
||||||
|
|
|
||||||
2
dh.cpp
2
dh.cpp
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
void DH_TestInstantiations()
|
void DH_TestInstantiations()
|
||||||
{
|
{
|
||||||
DH dh1;
|
DH dh1;
|
||||||
|
|
|
||||||
2
dh2.cpp
2
dh2.cpp
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
void DH2_TestInstantiations()
|
void DH2_TestInstantiations()
|
||||||
{
|
{
|
||||||
DH2 dh(*(SimpleKeyAgreementDomain*)NULL);
|
DH2 dh(*(SimpleKeyAgreementDomain*)NULL);
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
static void ECDSA_TestInstantiations()
|
static void ECDSA_TestInstantiations()
|
||||||
{
|
{
|
||||||
ECDSA<EC2N>::Signer t1;
|
ECDSA<EC2N>::Signer t1;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
void ElGamal_TestInstantiations()
|
void ElGamal_TestInstantiations()
|
||||||
{
|
{
|
||||||
ElGamalEncryptor test1(1, 1, 1);
|
ElGamalEncryptor test1(1, 1, 1);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
void ESIGN_TestInstantiations()
|
void ESIGN_TestInstantiations()
|
||||||
{
|
{
|
||||||
ESIGN<SHA>::Verifier x1(1, 1);
|
ESIGN<SHA>::Verifier x1(1, 1);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
void Files_TestInstantiations()
|
void Files_TestInstantiations()
|
||||||
{
|
{
|
||||||
FileStore f0;
|
FileStore f0;
|
||||||
|
|
|
||||||
2
gf2n.cpp
2
gf2n.cpp
|
|
@ -325,7 +325,7 @@ PolynomialMod2 PolynomialMod2::Modulo(const PolynomialMod2 &b) const
|
||||||
|
|
||||||
PolynomialMod2& PolynomialMod2::operator<<=(unsigned int n)
|
PolynomialMod2& PolynomialMod2::operator<<=(unsigned int n)
|
||||||
{
|
{
|
||||||
#if !defined(NDEBUG)
|
#if CRYPTOPP_DEBUG
|
||||||
int x; CRYPTOPP_UNUSED(x);
|
int x; CRYPTOPP_UNUSED(x);
|
||||||
CRYPTOPP_ASSERT(SafeConvert(n,x));
|
CRYPTOPP_ASSERT(SafeConvert(n,x));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
void TestInstantiations_gfpcrypt()
|
void TestInstantiations_gfpcrypt()
|
||||||
{
|
{
|
||||||
GDSA<SHA>::Signer test;
|
GDSA<SHA>::Signer test;
|
||||||
|
|
|
||||||
12
integer.cpp
12
integer.cpp
|
|
@ -206,10 +206,10 @@ class DWord
|
||||||
public:
|
public:
|
||||||
// Converity finding on default ctor. We've isntrumented the code,
|
// Converity finding on default ctor. We've isntrumented the code,
|
||||||
// and cannot uncover a case where it affects a result.
|
// and cannot uncover a case where it affects a result.
|
||||||
#if (defined(__COVERITY__) || !defined(NDEBUG)) && defined(CRYPTOPP_NATIVE_DWORD_AVAILABLE)
|
#if (defined(__COVERITY__) || CRYPTOPP_DEBUG) && defined(CRYPTOPP_NATIVE_DWORD_AVAILABLE)
|
||||||
// Repeating pattern of 1010 for debug builds to break things...
|
// Repeating pattern of 1010 for debug builds to break things...
|
||||||
DWord() : m_whole(0) {memset(&m_whole, 0xa, sizeof(m_whole));}
|
DWord() : m_whole(0) {memset(&m_whole, 0xa, sizeof(m_whole));}
|
||||||
#elif (defined(__COVERITY__) || !defined(NDEBUG)) && !defined(CRYPTOPP_NATIVE_DWORD_AVAILABLE)
|
#elif (defined(__COVERITY__) || CRYPTOPP_DEBUG) && !defined(CRYPTOPP_NATIVE_DWORD_AVAILABLE)
|
||||||
// Repeating pattern of 1010 for debug builds to break things...
|
// Repeating pattern of 1010 for debug builds to break things...
|
||||||
DWord() : m_halfs() {memset(&m_halfs, 0xaa, sizeof(m_halfs));}
|
DWord() : m_halfs() {memset(&m_halfs, 0xaa, sizeof(m_halfs));}
|
||||||
#else
|
#else
|
||||||
|
|
@ -346,7 +346,7 @@ public:
|
||||||
// and cannot uncover a case where it affects a result.
|
// and cannot uncover a case where it affects a result.
|
||||||
#if defined(__COVERITY__)
|
#if defined(__COVERITY__)
|
||||||
Word() : m_whole(0) {}
|
Word() : m_whole(0) {}
|
||||||
#elif !defined(NDEBUG)
|
#elif CRYPTOPP_DEBUG
|
||||||
// Repeating pattern of 1010 for debug builds to break things...
|
// Repeating pattern of 1010 for debug builds to break things...
|
||||||
Word() : m_whole(0) {memset(&m_whole, 0xaa, sizeof(m_whole));}
|
Word() : m_whole(0) {memset(&m_whole, 0xaa, sizeof(m_whole));}
|
||||||
#else
|
#else
|
||||||
|
|
@ -2076,7 +2076,7 @@ static void SetFunctionPointers()
|
||||||
#if CRYPTOPP_INTEGER_SSE2
|
#if CRYPTOPP_INTEGER_SSE2
|
||||||
if (HasSSE2())
|
if (HasSSE2())
|
||||||
{
|
{
|
||||||
#if _MSC_VER != 1200 || defined(NDEBUG)
|
#if _MSC_VER != 1200 || !(CRYPTOPP_DEBUG)
|
||||||
if (IsP4())
|
if (IsP4())
|
||||||
{
|
{
|
||||||
s_pAdd = &SSE2_Add;
|
s_pAdd = &SSE2_Add;
|
||||||
|
|
@ -2614,7 +2614,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]);
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#if CRYPTOPP_DEBUG
|
||||||
// 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];
|
||||||
|
|
@ -2633,7 +2633,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();
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#if CRYPTOPP_DEBUG
|
||||||
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
|
||||||
|
|
|
||||||
2
luc.cpp
2
luc.cpp
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
void LUC_TestInstantiations()
|
void LUC_TestInstantiations()
|
||||||
{
|
{
|
||||||
LUC_HMP<SHA>::Signer t1;
|
LUC_HMP<SHA>::Signer t1;
|
||||||
|
|
|
||||||
2
md5.cpp
2
md5.cpp
|
|
@ -9,7 +9,7 @@
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
namespace Weak1 {
|
namespace Weak1 {
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
void MD5_TestInstantiations()
|
void MD5_TestInstantiations()
|
||||||
{
|
{
|
||||||
MD5 x;
|
MD5 x;
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,13 @@
|
||||||
#include "modes.h"
|
#include "modes.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
//#ifndef NDEBUG
|
//#if CRYPTOPP_DEBUG
|
||||||
#include "des.h"
|
#include "des.h"
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
void Modes_TestInstantiations()
|
void Modes_TestInstantiations()
|
||||||
{
|
{
|
||||||
CFB_Mode<DES>::Encryption m0;
|
CFB_Mode<DES>::Encryption m0;
|
||||||
|
|
|
||||||
2
mqv.cpp
2
mqv.cpp
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
void TestInstantiations_MQV()
|
void TestInstantiations_MQV()
|
||||||
{
|
{
|
||||||
MQV mqv;
|
MQV mqv;
|
||||||
|
|
|
||||||
2
rsa.cpp
2
rsa.cpp
|
|
@ -10,7 +10,7 @@
|
||||||
#include "algparam.h"
|
#include "algparam.h"
|
||||||
#include "fips140.h"
|
#include "fips140.h"
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) && !defined(CRYPTOPP_IS_DLL)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING) && !defined(CRYPTOPP_IS_DLL)
|
||||||
#include "pssr.h"
|
#include "pssr.h"
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
void RSA_TestInstantiations()
|
void RSA_TestInstantiations()
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
void Salsa20_TestInstantiations()
|
void Salsa20_TestInstantiations()
|
||||||
{
|
{
|
||||||
Salsa20::Encryption x1;
|
Salsa20::Encryption x1;
|
||||||
|
|
|
||||||
2
seal.cpp
2
seal.cpp
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
void SEAL_TestInstantiations()
|
void SEAL_TestInstantiations()
|
||||||
{
|
{
|
||||||
SEAL<>::Encryption x;
|
SEAL<>::Encryption x;
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ bool ValidateAll(bool thorough)
|
||||||
pass=TestRDSEED() && pass;
|
pass=TestRDSEED() && pass;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_IMPORTS)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_IMPORTS)
|
||||||
// http://github.com/weidai11/cryptopp/issues/92
|
// http://github.com/weidai11/cryptopp/issues/92
|
||||||
pass=TestSecBlock() && pass;
|
pass=TestSecBlock() && pass;
|
||||||
// http://github.com/weidai11/cryptopp/issues/64
|
// http://github.com/weidai11/cryptopp/issues/64
|
||||||
|
|
@ -334,7 +334,7 @@ bool TestSettings()
|
||||||
return pass;
|
return pass;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_IMPORTS)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_IMPORTS)
|
||||||
bool TestSecBlock()
|
bool TestSecBlock()
|
||||||
{
|
{
|
||||||
cout << "\nTesting SecBlock...\n\n";
|
cout << "\nTesting SecBlock...\n\n";
|
||||||
|
|
@ -1268,7 +1268,7 @@ bool TestSecBlock()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_IMPORTS)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_IMPORTS)
|
||||||
bool TestHuffmanCodes()
|
bool TestHuffmanCodes()
|
||||||
{
|
{
|
||||||
cout << "\nTesting Huffman codes...\n\n";
|
cout << "\nTesting Huffman codes...\n\n";
|
||||||
|
|
|
||||||
|
|
@ -799,7 +799,7 @@ bool ValidateBlumGoldwasser()
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_IMPORTS)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_IMPORTS)
|
||||||
// Issue 64: "PolynomialMod2::operator<<=", http://github.com/weidai11/cryptopp/issues/64
|
// Issue 64: "PolynomialMod2::operator<<=", http://github.com/weidai11/cryptopp/issues/64
|
||||||
bool TestPolynomialMod2()
|
bool TestPolynomialMod2()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ bool ValidateEC2N();
|
||||||
bool ValidateECDSA();
|
bool ValidateECDSA();
|
||||||
bool ValidateESIGN();
|
bool ValidateESIGN();
|
||||||
|
|
||||||
#if !defined(NDEBUG)
|
#if CRYPTOPP_DEBUG
|
||||||
bool TestSecBlock();
|
bool TestSecBlock();
|
||||||
bool TestPolynomialMod2();
|
bool TestPolynomialMod2();
|
||||||
bool TestHuffmanCodes();
|
bool TestHuffmanCodes();
|
||||||
|
|
|
||||||
2
wake.cpp
2
wake.cpp
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
void WAKE_TestInstantiations()
|
void WAKE_TestInstantiations()
|
||||||
{
|
{
|
||||||
WAKE_OFB<>::Encryption x2;
|
WAKE_OFB<>::Encryption x2;
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
void Whirlpool_TestInstantiations()
|
void Whirlpool_TestInstantiations()
|
||||||
{
|
{
|
||||||
Whirlpool x;
|
Whirlpool x;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue