fix for Unix
parent
12157494b2
commit
cadf4f866a
2
config.h
2
config.h
|
|
@ -264,11 +264,13 @@ NAMESPACE_END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CRYPTOPP_API __stdcall
|
#define CRYPTOPP_API __stdcall
|
||||||
|
#define CRYPTOPP_CDECL _cdecl
|
||||||
|
|
||||||
#else // CRYPTOPP_WIN32_AVAILABLE
|
#else // CRYPTOPP_WIN32_AVAILABLE
|
||||||
|
|
||||||
#define CRYPTOPP_DLL
|
#define CRYPTOPP_DLL
|
||||||
#define CRYPTOPP_API
|
#define CRYPTOPP_API
|
||||||
|
#define CRYPTOPP_CDECL
|
||||||
|
|
||||||
#endif // CRYPTOPP_WIN32_AVAILABLE
|
#endif // CRYPTOPP_WIN32_AVAILABLE
|
||||||
|
|
||||||
|
|
|
||||||
8
dll.cpp
8
dll.cpp
|
|
@ -6,7 +6,9 @@
|
||||||
#include "dll.h"
|
#include "dll.h"
|
||||||
#pragma warning(default: 4660)
|
#pragma warning(default: 4660)
|
||||||
|
|
||||||
|
#ifdef CRYPTOPP_WIN32_AVAILABLE
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "iterhash.cpp"
|
#include "iterhash.cpp"
|
||||||
#include "strciphr.cpp"
|
#include "strciphr.cpp"
|
||||||
|
|
@ -23,13 +25,19 @@ template<> const byte PKCS_DigestDecoration<SHA>::decoration[] = {0x30,0x21,0x30
|
||||||
template<> const unsigned int PKCS_DigestDecoration<SHA>::length = sizeof(PKCS_DigestDecoration<SHA>::decoration);
|
template<> const unsigned int PKCS_DigestDecoration<SHA>::length = sizeof(PKCS_DigestDecoration<SHA>::decoration);
|
||||||
|
|
||||||
static const byte s_moduleMac[CryptoPP::HMAC<CryptoPP::SHA1>::DIGESTSIZE] = "reserved for mac";
|
static const byte s_moduleMac[CryptoPP::HMAC<CryptoPP::SHA1>::DIGESTSIZE] = "reserved for mac";
|
||||||
|
#ifdef CRYPTOPP_WIN32_AVAILABLE
|
||||||
static HMODULE s_hModule = NULL;
|
static HMODULE s_hModule = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
void DoDllPowerUpSelfTest()
|
void DoDllPowerUpSelfTest()
|
||||||
{
|
{
|
||||||
|
#ifdef CRYPTOPP_WIN32_AVAILABLE
|
||||||
char moduleFileName[MAX_PATH];
|
char moduleFileName[MAX_PATH];
|
||||||
GetModuleFileNameA(s_hModule, moduleFileName, sizeof(moduleFileName));
|
GetModuleFileNameA(s_hModule, moduleFileName, sizeof(moduleFileName));
|
||||||
CryptoPP::DoPowerUpSelfTest(moduleFileName, s_moduleMac);
|
CryptoPP::DoPowerUpSelfTest(moduleFileName, s_moduleMac);
|
||||||
|
#else
|
||||||
|
throw NotImplemented("DoDllPowerUpSelfTest() only available on Windows");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
NAMESPACE_END
|
NAMESPACE_END
|
||||||
|
|
|
||||||
10
dll.h
10
dll.h
|
|
@ -55,11 +55,11 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||||
using std::new_handler;
|
using std::new_handler;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef void * (_cdecl * PNew)(size_t);
|
typedef void * (CRYPTOPP_CDECL * PNew)(size_t);
|
||||||
typedef void (_cdecl * PDelete)(void *);
|
typedef void (CRYPTOPP_CDECL * PDelete)(void *);
|
||||||
typedef void (_cdecl * PGetNewAndDelete)(PNew &, PDelete &);
|
typedef void (CRYPTOPP_CDECL * PGetNewAndDelete)(PNew &, PDelete &);
|
||||||
typedef new_handler (_cdecl * PSetNewHandler)(new_handler);
|
typedef new_handler (CRYPTOPP_CDECL * PSetNewHandler)(new_handler);
|
||||||
typedef void (_cdecl * PSetNewAndDelete)(PNew, PDelete, PSetNewHandler);
|
typedef void (CRYPTOPP_CDECL * PSetNewAndDelete)(PNew, PDelete, PSetNewHandler);
|
||||||
|
|
||||||
CRYPTOPP_DLL void DoDllPowerUpSelfTest();
|
CRYPTOPP_DLL void DoDllPowerUpSelfTest();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ void FIPS140_SampleApplication()
|
||||||
|
|
||||||
#ifdef CRYPTOPP_DLL_ONLY
|
#ifdef CRYPTOPP_DLL_ONLY
|
||||||
|
|
||||||
int __cdecl main()
|
int CRYPTOPP_CDECL main()
|
||||||
{
|
{
|
||||||
FIPS140_SampleApplication();
|
FIPS140_SampleApplication();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
4
test.cpp
4
test.cpp
|
|
@ -85,10 +85,8 @@ int (*AdhocTest)(int argc, char *argv[]) = NULL;
|
||||||
|
|
||||||
#ifdef __BCPLUSPLUS__
|
#ifdef __BCPLUSPLUS__
|
||||||
int cmain(int argc, char *argv[])
|
int cmain(int argc, char *argv[])
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
int __cdecl main(int argc, char *argv[])
|
|
||||||
#else
|
#else
|
||||||
int main(int argc, char *argv[])
|
int CRYPTOPP_CDECL main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef _CRTDBG_LEAK_CHECK_DF
|
#ifdef _CRTDBG_LEAK_CHECK_DF
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue