summaryrefslogtreecommitdiff
path: root/fipstest.cpp
diff options
context:
space:
mode:
authorweidai <weidai11@users.noreply.github.com>2003-10-14 09:43:14 +0000
committerweidai <weidai11@users.noreply.github.com>2003-10-14 09:43:14 +0000
commit6de6ad385c599dc2c3183a449c81bda9a44b18dc (patch)
tree1d8676eb5a14fd37c16587e2b17c12e8c79e0a26 /fipstest.cpp
parent852394c4e04e7287e661c19c62544922acb6a4ee (diff)
downloadcryptopp-git-6de6ad385c599dc2c3183a449c81bda9a44b18dc.tar.gz
reduce source file dependencies
Diffstat (limited to 'fipstest.cpp')
-rw-r--r--fipstest.cpp40
1 files changed, 39 insertions, 1 deletions
diff --git a/fipstest.cpp b/fipstest.cpp
index ae277ebf..f4fb694b 100644
--- a/fipstest.cpp
+++ b/fipstest.cpp
@@ -474,6 +474,44 @@ done:
return;
}
+#ifdef CRYPTOPP_WIN32_AVAILABLE
+
+static const byte s_moduleMac[CryptoPP::HMAC<CryptoPP::SHA1>::DIGESTSIZE] = "reserved for mac";
+static HMODULE s_hModule = NULL;
+
+void DoDllPowerUpSelfTest()
+{
+ char moduleFileName[MAX_PATH];
+ GetModuleFileNameA(s_hModule, moduleFileName, sizeof(moduleFileName));
+ CryptoPP::DoPowerUpSelfTest(moduleFileName, s_moduleMac);
+}
+
+#else
+
+void DoDllPowerUpSelfTest()
+{
+ throw NotImplemented("DoDllPowerUpSelfTest() only available on Windows");
+}
+
+#endif // #ifdef CRYPTOPP_WIN32_AVAILABLE
+
NAMESPACE_END
-#endif
+#ifdef CRYPTOPP_WIN32_AVAILABLE
+
+// DllMain needs to be in the global namespace
+BOOL APIENTRY DllMain(HANDLE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved)
+{
+ if (ul_reason_for_call == DLL_PROCESS_ATTACH)
+ {
+ CryptoPP::s_hModule = (HMODULE)hModule;
+ CryptoPP::DoDllPowerUpSelfTest();
+ }
+ return TRUE;
+}
+
+#endif // #ifdef CRYPTOPP_WIN32_AVAILABLE
+
+#endif // #ifndef CRYPTOPP_IMPORTS