3#define CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES
4#define CRYPTOPP_DEFAULT_NO_DLL
12#if defined(CRYPTOPP_MSC_VERSION)
14# pragma warning(disable: 4191)
17#if defined(CRYPTOPP_EXPORTS) && defined(CRYPTOPP_WIN32_AVAILABLE)
21#ifndef CRYPTOPP_IMPORTS
27template<>
const byte PKCS_DigestDecoration<SHA1>::decoration[] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14};
30template<>
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};
33template<>
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};
36template<>
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};
39template<>
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};
44template<>
const byte PKCS_DigestDecoration<SHA3_256>::decoration[] = {0x30,0x31,0x30,0x0d, 0x06,0x09,0x60,0x86, 0x48,0x01,0x65,0x03, 0x04,0x02,0x08,0x05, 0x00,0x04,0x20};
47template<>
const byte PKCS_DigestDecoration<SHA3_384>::decoration[] = {0x30,0x41,0x30,0x0d, 0x06,0x09,0x60,0x86, 0x48,0x01,0x65,0x03, 0x04,0x02,0x09,0x05, 0x00,0x04,0x30};
50template<>
const byte PKCS_DigestDecoration<SHA3_512>::decoration[] = {0x30,0x51,0x30,0x0d, 0x06,0x09,0x60,0x86, 0x48,0x01,0x65,0x03, 0x04,0x02,0x0a,0x05, 0x00,0x04,0x40};
65#ifdef CRYPTOPP_EXPORTS
69using std::set_new_handler;
71static PNew s_pNew = NULLPTR;
72static PDelete s_pDelete = NULLPTR;
74static void * New (
size_t size)
77 while ((p = malloc(size)) == NULLPTR)
83static void SetNewAndDeleteFunctionPointers()
86 HMODULE hModule = NULLPTR;
87 MEMORY_BASIC_INFORMATION mbi;
91 VirtualQuery(p, &mbi,
sizeof(mbi));
93 if (p >= (
char *)mbi.BaseAddress + mbi.RegionSize)
96 p = (
char *)mbi.BaseAddress + mbi.RegionSize;
98 if (!mbi.AllocationBase || mbi.AllocationBase == hModule)
101 hModule = HMODULE(mbi.AllocationBase);
102 PGetNewAndDelete pGetNewAndDelete = (PGetNewAndDelete)GetProcAddress(hModule,
"GetNewAndDeleteForCryptoPP");
103 if (pGetNewAndDelete)
105 pGetNewAndDelete(s_pNew, s_pDelete);
109 PSetNewAndDelete pSetNewAndDelete = (PSetNewAndDelete)GetProcAddress(hModule,
"SetNewAndDeleteFromCryptoPP");
110 if (pSetNewAndDelete)
114 pSetNewAndDelete(s_pNew, s_pDelete, &set_new_handler);
121 hModule = GetModuleHandle(
"msvcrtd");
123 hModule = GetModuleHandle(
"msvcrt");
127 s_pNew = (PNew)GetProcAddress(hModule,
"??2@YAPAXI@Z");
128 s_pDelete = (PDelete)GetProcAddress(hModule,
"??3@YAXPAX@Z");
129 if (s_pNew && s_pDelete)
133 s_pNew = (PNew)GetProcAddress(hModule,
"??2@YAPEAX_K@Z");
134 s_pDelete = (PDelete)GetProcAddress(hModule,
"??3@YAXPEAX@Z");
135 if (s_pNew && s_pDelete)
139 OutputDebugStringA(
"Crypto++ DLL was not able to obtain new and delete function pointers.\n");
144#pragma warning(default: 4191)
146void *
operator new (
size_t size)
149 SetNewAndDeleteFunctionPointers();
154void operator delete (
void * p)
159void *
operator new [] (
size_t size)
161 return operator new (size);
164void operator delete [] (
void * p)
CRYPTOPP_DLL void CallNewHandler()
Attempts to reclaim unused memory.
PKCS #1 decoration data structure.
Library configuration file.
Functions and definitions required for building the FIPS-140 DLL on Windows.
Classes and functions for various padding schemes used in public key algorithms.
Base classes for iterated hashes.
Crypto++ library namespace.
Classes for PKCS padding schemes.