diff options
author | Richard Levitte <levitte@openssl.org> | 2001-11-15 19:48:42 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2001-11-15 19:48:42 +0100 |
commit | e1a00d7d1d10ea38c5dc17026653787576809bfc (patch) | |
tree | 3a76d586f269ef53ea610451176951da4d12e563 /apps | |
parent | At least for the two common Unixly DSO loading methods, include the (diff) | |
download | openssl-e1a00d7d1d10ea38c5dc17026653787576809bfc.tar.xz openssl-e1a00d7d1d10ea38c5dc17026653787576809bfc.zip |
If an engine isn't built in, try loading it as a shareable library
instead. This also makes it possible for users to simply give said
shareable library as argument for the -engine option.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/apps.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/apps/apps.c b/apps/apps.c index e1e29f8689..666a7a7000 100644 --- a/apps/apps.c +++ b/apps/apps.c @@ -1197,6 +1197,22 @@ X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath) return NULL; } +/* 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; @@ -1209,9 +1225,11 @@ ENGINE *setup_engine(BIO *err, const char *engine, int debug) 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); + ERR_print_errors(err); return NULL; } if (debug) @@ -1223,10 +1241,11 @@ ENGINE *setup_engine(BIO *err, const char *engine, int debug) if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) { BIO_printf(err,"can't use that engine\n"); + ERR_print_errors(err); return NULL; } - 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); |