In addition, I am compiling the code in VS2003 using MFC in a Shared
DLL and using the Default option for Basic Runtime Checks.
On Mar 14, 5:00 pm, "cleohm" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> The following piece of code I am using is resulting in a
> _CrtIsValidHeapPointer debug assertion error at dbgheap.c, line 1132
> during runtime upon completion of the last main function statement.
> Compilation has no errors too. Does anyone know why?
>
> static PNew s_pNew = NULL;
> static PDelete s_pDelete = NULL;
>
> extern "C" __declspec(dllexport) void __cdecl
> SetNewAndDeleteFromCryptoPP(PNew pNew, PDelete pDelete, PSetNewHandler
> pSetNewHandler)
> {
> s_pNew = pNew;
> s_pDelete = pDelete;
>
> }
>
> void * __cdecl operator new (size_t size)
> {
> return s_pNew(size);
>
> }
>
> void __cdecl operator delete (void * p)
> {
> s_pDelete(p);
>
> }
>
> int __cdecl main(int argc, _TCHAR* argv[])
> {
> byte key[AES_KEYLEN];
> byte iv[AES_BLOCKSIZE];
>
> memset(key, 0x00, AES_KEYLEN);
> memset(iv, 0x00, AES_BLOCKSIZE);
>
> AES::Encryption aesEncryption(key, AES_KEYLEN);
> CBC_Mode_ExternalCipher::Encryption cbcEncryption(aesEncryption, iv);
>
> string plaintext = "test";
> string ciphertext;
> StreamTransformationFilter stfEncryptor(cbcEncryption, new
> StringSink(ciphertext));
> stfEncryptor.Put(reinterpret_cast<const unsigned
> char*>(plaintext.data()), plaintext.length()+1);
> stfEncryptor.MessageEnd();
>
>
>
> }- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [EMAIL PROTECTED]
More information about Crypto++ and this group is available at
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---