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
69static PNew s_pNew = NULLPTR;
70static PDelete s_pDelete = NULLPTR;
72static void * New (
size_t size)
75 while ((p = malloc(size)) == NULLPTR)
81static void SetNewAndDeleteFunctionPointers()
84 HMODULE hModule = NULLPTR;
85 MEMORY_BASIC_INFORMATION mbi;
89 VirtualQuery(p, &mbi,
sizeof(mbi));
91 if (p >= (
char *)mbi.BaseAddress + mbi.RegionSize)
94 p = (
char *)mbi.BaseAddress + mbi.RegionSize;
96 if (!mbi.AllocationBase || mbi.AllocationBase == hModule)
99 hModule = HMODULE(mbi.AllocationBase);
100 PGetNewAndDelete pGetNewAndDelete = (PGetNewAndDelete)GetProcAddress(hModule,
"GetNewAndDeleteForCryptoPP");
101 if (pGetNewAndDelete)
103 pGetNewAndDelete(s_pNew, s_pDelete);
107 PSetNewAndDelete pSetNewAndDelete = (PSetNewAndDelete)GetProcAddress(hModule,
"SetNewAndDeleteFromCryptoPP");
108 if (pSetNewAndDelete)
112 pSetNewAndDelete(s_pNew, s_pDelete, &std::set_new_handler);
119 hModule = GetModuleHandle(
"msvcrtd");
121 hModule = GetModuleHandle(
"msvcrt");
125 s_pNew = (PNew)GetProcAddress(hModule,
"??2@YAPAXI@Z");
126 s_pDelete = (PDelete)GetProcAddress(hModule,
"??3@YAXPAX@Z");
127 if (s_pNew && s_pDelete)
131 s_pNew = (PNew)GetProcAddress(hModule,
"??2@YAPEAX_K@Z");
132 s_pDelete = (PDelete)GetProcAddress(hModule,
"??3@YAXPEAX@Z");
133 if (s_pNew && s_pDelete)
137 OutputDebugStringA(
"Crypto++ DLL was not able to obtain new and delete function pointers.\n");
142#pragma warning(default: 4191)
144void *
operator new (
size_t size)
147 SetNewAndDeleteFunctionPointers();
152void operator delete (
void * p)
157void *
operator new [] (
size_t size)
159 return operator new (size);
162void 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.