When the "dynamic" ENGINE loads another ENGINE from a shared-library, it

essentially overwrites itself with the new ENGINE, with the exception of
reference counts, ex_data structures, and other 'admin' elements. However
if the new ENGINE doesn't populate certain elements, there's the risk of
the "dynamic" ENGINE's elements showing through - the "cmd_defns" were just
one of the possibilities. This implements a more comprehensive cleanup.
This commit is contained in:
Geoff Thorpe
2001-11-22 09:13:18 +00:00
parent 329636d6e3
commit e4a6cf421a
3 changed files with 31 additions and 3 deletions

View File

@@ -81,6 +81,29 @@ ENGINE *ENGINE_new(void)
return ret;
}
/* Placed here (close proximity to ENGINE_new) so that modifications to the
* elements of the ENGINE structure are more likely to be caught and changed
* here. */
void engine_set_all_null(ENGINE *e)
{
e->id = NULL;
e->name = NULL;
e->rsa_meth = NULL;
e->dsa_meth = NULL;
e->dh_meth = NULL;
e->rand_meth = NULL;
e->ciphers = NULL;
e->digests = NULL;
e->destroy = NULL;
e->init = NULL;
e->finish = NULL;
e->ctrl = NULL;
e->load_privkey = NULL;
e->load_pubkey = NULL;
e->cmd_defns = NULL;
e->flags = 0;
}
int engine_free_util(ENGINE *e, int locked)
{
int i;