From 5efb019d8bdc593b3c1a0b57d615b170c7dab02a Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Wed, 1 Mar 2017 06:10:06 -0500 Subject: Add C++ nullptr support (Issue 383) --- fipstest.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'fipstest.cpp') diff --git a/fipstest.cpp b/fipstest.cpp index 5721bc82..ccaed1b3 100644 --- a/fipstest.cpp +++ b/fipstest.cpp @@ -67,7 +67,7 @@ static const byte s_moduleMac[CryptoPP::HMAC::DIGESTSIZE] = CRYP CRYPTOPP_COMPILE_ASSERT(sizeof(s_moduleMac) == CryptoPP::SHA1::DIGESTSIZE); #ifdef CRYPTOPP_WIN32_AVAILABLE -static HMODULE s_hModule = NULL; +static HMODULE s_hModule = NULLPTR; #endif const byte * CRYPTOPP_API GetActualMacAndLocation(unsigned int &macSize, unsigned int &fileLocation) @@ -197,7 +197,7 @@ void SignatureKnownAnswerTest(const char *key, const char *message, const char * comparison.ChannelMessageSeriesEnd("0"); comparison.ChannelMessageSeriesEnd("1"); - SignatureVerificationFilter verifierFilter(verifier, NULL, SignatureVerificationFilter::SIGNATURE_AT_BEGIN | SignatureVerificationFilter::THROW_EXCEPTION); + SignatureVerificationFilter verifierFilter(verifier, NULLPTR, SignatureVerificationFilter::SIGNATURE_AT_BEGIN | SignatureVerificationFilter::THROW_EXCEPTION); StringSource(signature, true, new HexDecoder(new Redirector(verifierFilter, Redirector::DATA_ONLY))); StringSource(message, true, new Redirector(verifierFilter)); } @@ -250,7 +250,7 @@ void SignaturePairwiseConsistencyTest(const PK_Signer &signer, const PK_Verifier new SignerFilter( rng, signer, - new SignatureVerificationFilter(verifier, NULL, SignatureVerificationFilter::THROW_EXCEPTION), + new SignatureVerificationFilter(verifier, NULLPTR, SignatureVerificationFilter::THROW_EXCEPTION), true)); } catch (...) @@ -292,11 +292,11 @@ bool IntegrityCheckModule(const char *moduleFilename, const byte *expectedModule std::ifstream moduleStream; #ifdef CRYPTOPP_WIN32_AVAILABLE - HMODULE h = NULL; + HMODULE h = NULLPTR; { const size_t FIPS_MODULE_MAX_PATH = 2*MAX_PATH; char moduleFilenameBuf[FIPS_MODULE_MAX_PATH] = ""; - if (moduleFilename == NULL) + if (moduleFilename == NULLPTR) { #if (_MSC_VER >= 1400 && !defined(_STLPORT_VERSION)) // ifstream doesn't support wide filename on other compilers wchar_t wideModuleFilename[FIPS_MODULE_MAX_PATH]; @@ -313,12 +313,12 @@ bool IntegrityCheckModule(const char *moduleFilename, const byte *expectedModule } } #endif - if (moduleFilename != NULL) + if (moduleFilename != NULLPTR) { moduleStream.open(moduleFilename, std::ios::in | std::ios::binary); #ifdef CRYPTOPP_WIN32_AVAILABLE h = GetModuleHandleA(moduleFilename); - moduleFilename = NULL; + moduleFilename = NULLPTR; } #endif } @@ -467,7 +467,7 @@ void DoPowerUpSelfTest(const char *moduleFilename, const byte *expectedModuleMac try { - if (FIPS_140_2_ComplianceEnabled() || expectedModuleMac != NULL) + if (FIPS_140_2_ComplianceEnabled() || expectedModuleMac != NULLPTR) { if (!IntegrityCheckModule(moduleFilename, expectedModuleMac, &g_actualMac, &g_macFileLocation)) throw 0; // throw here so we break in the debugger, this will be caught right away @@ -509,16 +509,16 @@ void DoPowerUpSelfTest(const char *moduleFilename, const byte *expectedModuleMac "7649abac8119b246cee98e9b12e9197d5086cb9b507219ee95db113a917678b273bed6b8e3c1743b7116e69e222295163ff1caa1681fac09120eca307586e1a7", // cbc "3b3fd92eb72dad20333449f8e83cfb4ac8a64537a0b3a93fcde3cdad9f1ce58b26751f67a3cbb140b1808cf187a4f4dfc04b05357c5d1c0eeac4c66f9ff7f2e6", // cfb "3b3fd92eb72dad20333449f8e83cfb4a7789508d16918f03f53c52dac54ed8259740051e9c5fecf64344f7a82260edcc304c6528f659c77866a510d9c1d6ae5e", // ofb - NULL); + NULLPTR); SymmetricEncryptionKnownAnswerTest( "2b7e151628aed2a6abf7158809cf4f3c", "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff", "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710", - NULL, - NULL, - NULL, - NULL, + NULLPTR, + NULLPTR, + NULLPTR, + NULLPTR, "874d6191b620e3261bef6864990db6ce9806f66b7970fdff8617187bb9fffdff5ae4df3edbd5d35e5b4f09020db03eab1e031dda2fbe03d1792170a0f3009cee"); // ctr @@ -615,7 +615,7 @@ done: void DoDllPowerUpSelfTest() { - CryptoPP::DoPowerUpSelfTest(NULL, s_moduleMac); + CryptoPP::DoPowerUpSelfTest(NULLPTR, s_moduleMac); } #else -- cgit v1.2.1