instead. This also makes it possible for users to simply give said
shareable library as argument for the -engine option.
+/* Try to load an engine in a shareable library */
+ENGINE *try_load_engine(BIO *err, const char *engine, int debug)
+ {
+ ENGINE *e = ENGINE_by_id("dynamic");
+ if (e)
+ {
+ if (!ENGINE_ctrl_cmd_string(e, "SO_PATH", engine, 0)
+ || !ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0))
+ {
+ ENGINE_free(e);
+ e = NULL;
+ }
+ }
+ return e;
+ }
+
ENGINE *setup_engine(BIO *err, const char *engine, int debug)
{
ENGINE *e = NULL;
ENGINE *setup_engine(BIO *err, const char *engine, int debug)
{
ENGINE *e = NULL;
ENGINE_register_all_complete();
return NULL;
}
ENGINE_register_all_complete();
return NULL;
}
- if((e = ENGINE_by_id(engine)) == NULL)
+ if((e = ENGINE_by_id(engine)) == NULL
+ && (e = try_load_engine(err, engine, debug)) == NULL)
{
BIO_printf(err,"invalid engine \"%s\"\n", engine);
{
BIO_printf(err,"invalid engine \"%s\"\n", engine);
return NULL;
}
if (debug)
return NULL;
}
if (debug)
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
{
BIO_printf(err,"can't use that engine\n");
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
{
BIO_printf(err,"can't use that engine\n");
- BIO_printf(err,"engine \"%s\" set.\n", engine);
+ BIO_printf(err,"engine \"%s\" set.\n", ENGINE_get_id(e));
/* Free our "structural" reference. */
ENGINE_free(e);
/* Free our "structural" reference. */
ENGINE_free(e);