Hi,
I have debug assertions in EVP_PKEY_free() using the following code:
-------------------------
#include <windows.h>
#include <string>
#include <iostream>
#include "openssl/ssl.h"
#include "openssl/conf.h"
#include "openssl/engine.h"
#include "openssl/pkcs12.h"
using namespace std;
int main()
{
ENGINE *m_engine;
EVP_PKEY *m_pkey;
int rtc;
string pin="****";
string key_id;
SSL_load_error_strings(); // Initialisierung Fehlerstrings
SSL_library_init(); // Initialisierung Library
PKCS12_PBE_add(); // Initialisierung PKCS#12-Library
OPENSSL_config(NULL); // Einlesen der Konfiguration (ueber
Environment OPENSSL_CONF)
// actions_to_seed_PRNG();
try
{
m_engine = ENGINE_by_id("pkcs11");
if(!m_engine)
{
throw 1;
}
// Engine initialisieren
rtc = ENGINE_init(m_engine);
if(rtc <= 0)
{
ENGINE_free(m_engine);
m_engine = NULL;
throw 2;
}
// PIN an die Engine uebergeben
rtc = ENGINE_ctrl_cmd_string(m_engine, "PIN", pin.c_str(), 0);
if(rtc <= 0)
{
ENGINE_finish(m_engine);
ENGINE_free(m_engine);
m_engine = NULL;
throw 3;
}
// Der Engine den privaten Schluessel bekannt machen
m_pkey = ENGINE_load_private_key(m_engine, key_id.c_str(),
NULL, NULL);
if (m_pkey == NULL)
{
ENGINE_finish(m_engine);
ENGINE_free(m_engine);
m_engine = NULL;
throw 4;
}
}
catch (int e)
{
cout << "Exception " << e << " occured" << endl;
return -1;
}
EVP_PKEY_free(m_pkey);
m_pkey = NULL;
}
-------------------------
In summary, I get 5 debug assertions:
1.) Expression: _CrtIsValidHeapPointer(pUserData)
2.) Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
3.) DAMAGE: before Free block (#262147) at 0x00BF8488
4.) DAMAGE: after Free block (#262147) at 0x00BF8488
5.) Expression: pHead->nBlockUse == nBlockUse
My environment: Windows XP SP2, MS Visual Studio .NET 2003 with active
configuration "Debug", OpenSSL 0.9.8e
Any suggestions?
Greetings,
Stefan Blomen
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [EMAIL PROTECTED]