3 #define CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES
4 #define CRYPTOPP_DEFAULT_NO_DLL
7 #pragma warning(default: 4660)
9 #if defined(CRYPTOPP_EXPORTS) && defined(CRYPTOPP_WIN32_AVAILABLE)
13 #ifndef CRYPTOPP_IMPORTS
15 NAMESPACE_BEGIN(CryptoPP)
17 template<> const byte
PKCS_DigestDecoration<
SHA1>::decoration[] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14};
20 template<>
const byte
PKCS_DigestDecoration<SHA224>::decoration[] = {0x30,0x2d,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x04,0x05,0x00,0x04,0x1c};
23 template<>
const byte
PKCS_DigestDecoration<SHA256>::decoration[] = {0x30,0x31,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0x04,0x20};
26 template<>
const byte
PKCS_DigestDecoration<SHA384>::decoration[] = {0x30,0x41,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x02,0x05,0x00,0x04,0x30};
29 template<>
const byte
PKCS_DigestDecoration<SHA512>::decoration[] = {0x30,0x51,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x03,0x05,0x00,0x04,0x40};
42 #ifdef CRYPTOPP_EXPORTS
44 USING_NAMESPACE(CryptoPP)
46 #if !(defined(_MSC_VER) && (_MSC_VER < 1300))
47 using std::set_new_handler;
50 static PNew s_pNew = NULL;
51 static PDelete s_pDelete = NULL;
53 static void * New (
size_t size)
56 while (!(p = malloc(size)))
62 static void SetNewAndDeleteFunctionPointers()
65 HMODULE hModule = NULL;
66 MEMORY_BASIC_INFORMATION mbi;
70 VirtualQuery(p, &mbi,
sizeof(mbi));
72 if (p >= (
char *)mbi.BaseAddress + mbi.RegionSize)
75 p = (
char *)mbi.BaseAddress + mbi.RegionSize;
77 if (!mbi.AllocationBase || mbi.AllocationBase == hModule)
80 hModule = HMODULE(mbi.AllocationBase);
82 PGetNewAndDelete pGetNewAndDelete = (PGetNewAndDelete)GetProcAddress(hModule,
"GetNewAndDeleteForCryptoPP");
85 pGetNewAndDelete(s_pNew, s_pDelete);
89 PSetNewAndDelete pSetNewAndDelete = (PSetNewAndDelete)GetProcAddress(hModule,
"SetNewAndDeleteFromCryptoPP");
94 pSetNewAndDelete(s_pNew, s_pDelete, &set_new_handler);
101 hModule = GetModuleHandle(
"msvcrtd");
103 hModule = GetModuleHandle(
"msvcrt");
107 s_pNew = (PNew)GetProcAddress(hModule,
"??2@YAPAXI@Z");
108 s_pDelete = (PDelete)GetProcAddress(hModule,
"??3@YAXPAX@Z");
109 if (s_pNew && s_pDelete)
113 s_pNew = (PNew)GetProcAddress(hModule,
"??2@YAPEAX_K@Z");
114 s_pDelete = (PDelete)GetProcAddress(hModule,
"??3@YAXPEAX@Z");
115 if (s_pNew && s_pDelete)
119 OutputDebugString(
"Crypto++ was not able to obtain new and delete function pointers.\n");
123 void *
operator new (
size_t size)
126 SetNewAndDeleteFunctionPointers();
131 void operator delete (
void * p)
136 void *
operator new [] (
size_t size)
138 return operator new (size);
141 void operator delete [] (
void * p)
146 #endif // #ifdef CRYPTOPP_EXPORTS