summaryrefslogtreecommitdiff
path: root/fipstest.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2016-10-02 18:40:28 -0400
committerJeffrey Walton <noloader@gmail.com>2016-10-02 18:40:28 -0400
commit1dd0b07a1ebc6a321bd2d33ce415fea4a0995ad3 (patch)
tree18a53f91dc08b5049e374d1ba8f8654119999988 /fipstest.cpp
parente3c4ccb0fcf730e6139eb8048d36ce58b4da48f1 (diff)
downloadcryptopp-git-1dd0b07a1ebc6a321bd2d33ce415fea4a0995ad3.tar.gz
Improve OutputDebugString messages (Issue 314)
Diffstat (limited to 'fipstest.cpp')
-rw-r--r--fipstest.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/fipstest.cpp b/fipstest.cpp
index 1c2fe1e6..44d3821b 100644
--- a/fipstest.cpp
+++ b/fipstest.cpp
@@ -42,6 +42,7 @@ extern "C" {void __cdecl _CRT_DEBUGGER_HOOK(int); }
#endif
#endif
+#include <sstream>
#include <iostream>
#if CRYPTOPP_MSC_VERSION
@@ -330,11 +331,19 @@ bool IntegrityCheckModule(const char *moduleFilename, const byte *expectedModule
#endif
}
- if (h != g_BaseAddressOfMAC)
+ if (h == g_BaseAddressOfMAC)
+ {
+ std::ostringstream oss;
+ oss << "Crypto++ DLL loaded at base address 0x" << std::hex << h << ".\n";
+#ifdef CRYPTOPP_WIN32_AVAILABLE
+ OutputDebugString(oss.str().c_str());
+#endif
+ }
+ else
{
std::ostringstream oss;
oss << "Crypto++ DLL integrity check may fail. Expected module base address is 0x";
- oss << std::hex << g_BaseAddressOfMAC << ", but module loaded at 0x" << h << "\n";
+ oss << std::hex << g_BaseAddressOfMAC << ", but module loaded at 0x" << h << ".\n";
#ifdef CRYPTOPP_WIN32_AVAILABLE
OutputDebugString(oss.str().c_str());
#endif
@@ -456,7 +465,7 @@ bool IntegrityCheckModule(const char *moduleFilename, const byte *expectedModule
#ifdef CRYPTOPP_WIN32_AVAILABLE
std::string hexMac;
HexEncoder(new StringSink(hexMac)).PutMessageEnd(actualMac, actualMac.size());
- OutputDebugString((("Crypto++ DLL integrity check failed. Actual MAC is: " + hexMac) + "\n").c_str());
+ OutputDebugString((("Crypto++ DLL integrity check failed. Actual MAC is: " + hexMac) + ".\n").c_str());
#endif
return false;
}