From 4a2b40dd704e7763a00a174dac932f0cf14d01d3 Mon Sep 17 00:00:00 2001 From: weidai Date: Fri, 18 Jul 2003 03:19:37 +0000 Subject: fix wrong error message in FIPS140_SampleApplication fix DLL startup problem on Windows 9x git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@100 57ff6487-cd31-0410-9ec3-f628ee90f5f0 --- dlltest.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'dlltest.cpp') diff --git a/dlltest.cpp b/dlltest.cpp index 5a49513..ae7e1c3 100644 --- a/dlltest.cpp +++ b/dlltest.cpp @@ -156,7 +156,8 @@ void FIPS140_SampleApplication() // try to use an invalid key length try { - encryption_DES_EDE3_CBC.SetKey(key, 5); + ECB_Mode::Encryption encryption_DES_EDE3_ECB; + encryption_DES_EDE3_ECB.SetKey(key, 5); // should not be here cerr << "DES-EDE3 implementation did not detect use of invalid key length.\n"; @@ -171,6 +172,29 @@ void FIPS140_SampleApplication() cout << "\nFIPS 140-2 Sample Application completed normally.\n"; } +#ifdef CRYPTOPP_IMPORTS + +static PNew s_pNew = NULL; +static PDelete s_pDelete = NULL; + +extern "C" __declspec(dllexport) void CRYPTOPP_CDECL SetNewAndDeleteFromCryptoPP(PNew pNew, PDelete pDelete, PSetNewHandler pSetNewHandler) +{ + s_pNew = pNew; + s_pDelete = pDelete; +} + +void * CRYPTOPP_CDECL operator new (size_t size) +{ + return s_pNew(size); +} + +void CRYPTOPP_CDECL operator delete (void * p) +{ + s_pDelete(p); +} + +#endif + #ifdef CRYPTOPP_DLL_ONLY int CRYPTOPP_CDECL main() -- cgit v1.2.1