00001
00002
00003
#define CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES
00004
#define CRYPTOPP_DEFAULT_NO_DLL
00005
00006
#include "dll.h"
00007
#pragma warning(default: 4660)
00008
00009
#ifdef CRYPTOPP_WIN32_AVAILABLE
00010
#include <windows.h>
00011
#endif
00012
00013
#include "iterhash.cpp"
00014
#include "strciphr.cpp"
00015
#include "algebra.cpp"
00016
#include "eprecomp.cpp"
00017
#include "eccrypto.cpp"
00018
00019
#ifndef CRYPTOPP_IMPORTS
00020
00021 NAMESPACE_BEGIN(CryptoPP)
00022
00023 #ifdef __MWERKS__
00024
00025 CRYPTOPP_DLL_TEMPLATE_CLASS
DL_GroupParameters_EC<ECP>;
00026 CRYPTOPP_DLL_TEMPLATE_CLASS
DL_GroupParameters_EC<EC2N>;
00027 CRYPTOPP_DLL_TEMPLATE_CLASS DL_FixedBasePrecomputationImpl<Integer>;
00028 CRYPTOPP_STATIC_TEMPLATE_CLASS
IteratedHashBase<word64, HashTransformation>;
00029 CRYPTOPP_DLL_TEMPLATE_CLASS
IteratedHashBase<word32, HashTransformation>;
00030 CRYPTOPP_STATIC_TEMPLATE_CLASS
IteratedHashBase<word32, MessageAuthenticationCode>;
00031 CRYPTOPP_DLL_TEMPLATE_CLASS CFB_CipherTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> >;
00032 CRYPTOPP_DLL_TEMPLATE_CLASS CFB_EncryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> >;
00033 CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> >;
00034 CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate<>;
00035 CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate<AbstractPolicyHolder<AdditiveCipherAbstractPolicy, OFB_ModePolicy> >;
00036 CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate<AbstractPolicyHolder<AdditiveCipherAbstractPolicy, CTR_ModePolicy> >;
00037 CRYPTOPP_DLL_TEMPLATE_CLASS
AbstractEuclideanDomain<Integer>;
00038
#endif
00039
00040
template<>
const byte PKCS_DigestDecoration<SHA>::decoration[] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14};
00041
template<>
const unsigned int PKCS_DigestDecoration<SHA>::length =
sizeof(PKCS_DigestDecoration<SHA>::decoration);
00042
00043 NAMESPACE_END
00044
00045
#endif
00046
00047
#ifdef CRYPTOPP_EXPORTS
00048
00049 USING_NAMESPACE(CryptoPP)
00050
00051 #
if !(defined(_MSC_VER) && (_MSC_VER < 1300))
00052
using std::set_new_handler;
00053
#endif
00054
00055
static PNew s_pNew = NULL;
00056
static PDelete s_pDelete = NULL;
00057
00058
static void * CRYPTOPP_CDECL New (size_t size)
00059 {
00060
void *p;
00061
while (!(p = malloc(size)))
00062 CallNewHandler();
00063
00064
return p;
00065 }
00066
00067
static void SetNewAndDeleteFunctionPointers()
00068 {
00069
void *p = NULL;
00070 HMODULE hModule = NULL;
00071 MEMORY_BASIC_INFORMATION mbi;
00072
00073
while (
true)
00074 {
00075 VirtualQuery(p, &mbi,
sizeof(mbi));
00076
00077
if (p >= (
char *)mbi.BaseAddress + mbi.RegionSize)
00078
break;
00079
00080 p = (
char *)mbi.BaseAddress + mbi.RegionSize;
00081
00082
if (!mbi.AllocationBase || mbi.AllocationBase == hModule)
00083
continue;
00084
00085 hModule = HMODULE(mbi.AllocationBase);
00086
00087 PGetNewAndDelete pGetNewAndDelete = (PGetNewAndDelete)GetProcAddress(hModule,
"GetNewAndDeleteForCryptoPP");
00088
if (pGetNewAndDelete)
00089 {
00090 pGetNewAndDelete(s_pNew, s_pDelete);
00091
return;
00092 }
00093
00094 PSetNewAndDelete pSetNewAndDelete = (PSetNewAndDelete)GetProcAddress(hModule,
"SetNewAndDeleteFromCryptoPP");
00095
if (pSetNewAndDelete)
00096 {
00097 s_pNew = &New;
00098 s_pDelete = &free;
00099 pSetNewAndDelete(s_pNew, s_pDelete, &set_new_handler);
00100
return;
00101 }
00102 }
00103
00104 hModule = GetModuleHandle(
"msvcrtd");
00105
if (!hModule)
00106 hModule = GetModuleHandle(
"msvcrt");
00107
if (hModule)
00108 {
00109 s_pNew = (PNew)GetProcAddress(hModule,
"??2@YAPAXI@Z");
00110 s_pDelete = (PDelete)GetProcAddress(hModule,
"??3@YAXPAX@Z");
00111
return;
00112 }
00113
00114 OutputDebugString(
"Crypto++ was not able to obtain new and delete function pointers.\n");
00115
throw 0;
00116 }
00117
00118
void * CRYPTOPP_CDECL operator new (size_t size)
00119 {
00120
if (!s_pNew)
00121 SetNewAndDeleteFunctionPointers();
00122
00123
return s_pNew(size);
00124 }
00125
00126
void CRYPTOPP_CDECL operator delete (
void * p)
00127 {
00128 s_pDelete(p);
00129 }
00130
00131
void * CRYPTOPP_CDECL operator new [] (size_t size)
00132 {
00133
return operator new (size);
00134 }
00135
00136
void CRYPTOPP_CDECL operator delete [] (
void * p)
00137 {
00138 operator delete (p);
00139 }
00140
00141
#endif // #ifdef CRYPTOPP_EXPORTS