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 26 #if defined(CRYPTOPP_IS_DLL) 27 template<>
const byte
PKCS_DigestDecoration<SHA1>::decoration[] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14};
30 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};
33 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};
36 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};
39 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};
44 template<>
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};
47 template<>
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};
50 template<>
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};
59 #endif // CRYPTOPP_IS_DLL 65 #ifdef CRYPTOPP_EXPORTS 69 using std::set_new_handler;
71 static PNew s_pNew = NULLPTR;
72 static PDelete s_pDelete = NULLPTR;
74 static void * New (
size_t size)
77 while ((p = malloc(size)) == NULLPTR)
83 static 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) 146 void *
operator new (
size_t size)
149 SetNewAndDeleteFunctionPointers();
154 void operator delete (
void * p)
159 void *
operator new [] (
size_t size)
161 return operator new (size);
164 void operator delete [] (
void * p)
169 #endif // CRYPTOPP_EXPORTS Classes and functions for various padding schemes used in public key algorithms.
Library configuration file.
Classes for PKCS padding schemes.
void CallNewHandler()
Attempts to reclaim unused memory.
PKCS #1 decoration data structure.
Crypto++ library namespace.
Functions and definitions required for building the FIPS-140 DLL on Windows.