|
|
@ -79,9 +79,11 @@ namespace openssl { |
|
|
|
} |
|
|
|
} |
|
|
|
virtual ~Engine() { |
|
|
|
virtual ~Engine() { |
|
|
|
OPENSSL_LOG("log"); |
|
|
|
OPENSSL_LOG("log"); |
|
|
|
// removed EngineMapper::destroy because of crash:
|
|
|
|
if (_e) { |
|
|
|
// https://dev.marc.waeckerlin.org/projects/libpcscxx/ticket/25
|
|
|
|
OPENSSL_LOG("free the engine"); |
|
|
|
//OPENSSL_CHECK(ENGINE_free(_e));
|
|
|
|
OPENSSL_CHECK(ENGINE_free(_e)); |
|
|
|
|
|
|
|
_e = 0; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
virtual const char* id() = 0; |
|
|
|
virtual const char* id() = 0; |
|
|
|
virtual const char* name() = 0; |
|
|
|
virtual const char* name() = 0; |
|
|
@ -147,10 +149,8 @@ namespace openssl { |
|
|
|
_map[e->_e] = e; |
|
|
|
_map[e->_e] = e; |
|
|
|
OPENSSL_CHECK(ENGINE_set_id(e->_e, e->id())); |
|
|
|
OPENSSL_CHECK(ENGINE_set_id(e->_e, e->id())); |
|
|
|
OPENSSL_CHECK(ENGINE_set_name(e->_e, e->name())); |
|
|
|
OPENSSL_CHECK(ENGINE_set_name(e->_e, e->name())); |
|
|
|
// removed EngineMapper::destroy because of crash:
|
|
|
|
OPENSSL_CHECK(ENGINE_set_destroy_function |
|
|
|
// https://dev.marc.waeckerlin.org/projects/libpcscxx/ticket/25
|
|
|
|
(e->_e, EngineMapper::destroy)); |
|
|
|
//OPENSSL_CHECK(ENGINE_set_destroy_function
|
|
|
|
|
|
|
|
// (e->_e, EngineMapper::destroy));
|
|
|
|
|
|
|
|
OPENSSL_CHECK(ENGINE_set_init_function(e->_e, EngineMapper::init)); |
|
|
|
OPENSSL_CHECK(ENGINE_set_init_function(e->_e, EngineMapper::init)); |
|
|
|
OPENSSL_CHECK(ENGINE_set_finish_function(e->_e, EngineMapper::finish)); |
|
|
|
OPENSSL_CHECK(ENGINE_set_finish_function(e->_e, EngineMapper::finish)); |
|
|
|
OPENSSL_CHECK(ENGINE_set_ctrl_function(e->_e, EngineMapper::ctrl)); |
|
|
|
OPENSSL_CHECK(ENGINE_set_ctrl_function(e->_e, EngineMapper::ctrl)); |
|
|
@ -173,10 +173,15 @@ namespace openssl { |
|
|
|
|
|
|
|
|
|
|
|
static void remove(Engine *e) { |
|
|
|
static void remove(Engine *e) { |
|
|
|
OPENSSL_LOG("log"); |
|
|
|
OPENSSL_LOG("log"); |
|
|
|
OPENSSL_CHECK(ENGINE_remove(e->_e)); |
|
|
|
if (e) { |
|
|
|
OPENSSL_CHECK(ENGINE_finish(e->_e)); |
|
|
|
OPENSSL_LOG("call remove: e->_e = "<<((void*)e->_e)); |
|
|
|
_map.erase(e->_e); |
|
|
|
OPENSSL_CHECK(ENGINE_remove(e->_e)); |
|
|
|
delete e; |
|
|
|
OPENSSL_LOG("call finish"); |
|
|
|
|
|
|
|
OPENSSL_CHECK(ENGINE_finish(e->_e)); |
|
|
|
|
|
|
|
OPENSSL_LOG("erase from map"); |
|
|
|
|
|
|
|
_map.erase(e->_e); |
|
|
|
|
|
|
|
delete e; e=0; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
private: |
|
|
@ -193,6 +198,7 @@ namespace openssl { |
|
|
|
static int finish(ENGINE* e) { |
|
|
|
static int finish(ENGINE* e) { |
|
|
|
OPENSSL_LOG("log"); |
|
|
|
OPENSSL_LOG("log"); |
|
|
|
Map::iterator it(_map.find(e)); |
|
|
|
Map::iterator it(_map.find(e)); |
|
|
|
|
|
|
|
OPENSSL_LOG("finish: "<<(it!=_map.end()?"true":"false")); |
|
|
|
return it!=_map.end()?it->second->finish():0; |
|
|
|
return it!=_map.end()?it->second->finish():0; |
|
|
|
} |
|
|
|
} |
|
|
|
static int ctrl(ENGINE* e, int cmd, long i, void* p, void(*f)()) { |
|
|
|
static int ctrl(ENGINE* e, int cmd, long i, void* p, void(*f)()) { |
|
|
|