From 6de6ad385c599dc2c3183a449c81bda9a44b18dc Mon Sep 17 00:00:00 2001 From: weidai Date: Tue, 14 Oct 2003 09:43:14 +0000 Subject: reduce source file dependencies --- fipstest.cpp | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'fipstest.cpp') 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::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 -- cgit v1.2.1