Step 11c of move of engines: Time to make the changes to support
automatic load of dynamic engines. Change the iterator to try to load the requested engine dynamically. The environment variable OPENSSL_ENGINES can be used to override the internal default directory where one can expect to find dynamically loadable engines. Note: The changes in step 11 have all been made by Geoff Thorpe. Credit where credit is due.
This commit is contained in:
parent
02acf1409e
commit
aae329c447
@ -351,6 +351,7 @@ static void engine_cpy(ENGINE *dest, const ENGINE *src)
|
|||||||
ENGINE *ENGINE_by_id(const char *id)
|
ENGINE *ENGINE_by_id(const char *id)
|
||||||
{
|
{
|
||||||
ENGINE *iterator;
|
ENGINE *iterator;
|
||||||
|
char *load_dir = NULL;
|
||||||
if(id == NULL)
|
if(id == NULL)
|
||||||
{
|
{
|
||||||
ENGINEerr(ENGINE_F_ENGINE_BY_ID,
|
ENGINEerr(ENGINE_F_ENGINE_BY_ID,
|
||||||
@ -384,6 +385,7 @@ ENGINE *ENGINE_by_id(const char *id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
CRYPTO_r_unlock(CRYPTO_LOCK_ENGINE);
|
CRYPTO_r_unlock(CRYPTO_LOCK_ENGINE);
|
||||||
|
#if 0
|
||||||
if(iterator == NULL)
|
if(iterator == NULL)
|
||||||
{
|
{
|
||||||
ENGINEerr(ENGINE_F_ENGINE_BY_ID,
|
ENGINEerr(ENGINE_F_ENGINE_BY_ID,
|
||||||
@ -391,4 +393,26 @@ ENGINE *ENGINE_by_id(const char *id)
|
|||||||
ERR_add_error_data(2, "id=", id);
|
ERR_add_error_data(2, "id=", id);
|
||||||
}
|
}
|
||||||
return iterator;
|
return iterator;
|
||||||
|
#else
|
||||||
|
/* EEK! Experimental code starts */
|
||||||
|
if(iterator) return iterator;
|
||||||
|
#ifdef OPENSSL_SYS_VMS
|
||||||
|
if((load_dir = getenv("OPENSSL_ENGINES")) == 0) load_dir = "SSLROOT:[ENGINES]";
|
||||||
|
#else
|
||||||
|
if((load_dir = getenv("OPENSSL_ENGINES")) == 0) load_dir = OPENSSLDIR "/engines";
|
||||||
|
#endif
|
||||||
|
iterator = ENGINE_by_id("dynamic");
|
||||||
|
if(!iterator || !ENGINE_ctrl_cmd_string(iterator, "ID", id, 0) ||
|
||||||
|
!ENGINE_ctrl_cmd_string(iterator, "DIR_LOAD", "2", 0) ||
|
||||||
|
!ENGINE_ctrl_cmd_string(iterator, "DIR_ADD",
|
||||||
|
load_dir, 0) ||
|
||||||
|
!ENGINE_ctrl_cmd_string(iterator, "LOAD", NULL, 0))
|
||||||
|
goto notfound;
|
||||||
|
return iterator;
|
||||||
|
notfound:
|
||||||
|
ENGINEerr(ENGINE_F_ENGINE_BY_ID,ENGINE_R_NO_SUCH_ENGINE);
|
||||||
|
ERR_add_error_data(2, "id=", id);
|
||||||
|
return NULL;
|
||||||
|
/* EEK! Experimental code ends */
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user