diff options
author | David von Oheimb <David.von.Oheimb@siemens.com> | 2017-08-28 19:14:47 +0200 |
---|---|---|
committer | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-05-15 20:24:11 +0200 |
commit | 538404d2186954d58c04c46232f985ddf9675b6f (patch) | |
tree | 9c2a6ce443576fd0d8bfd44a784be63067020960 /apps/lib | |
parent | 8c10e1b660be1286439e15c9a955461f25b53616 (diff) |
Add 'methods' parameter to setup_engine() in apps.c for individual method defaults
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/4277)
Diffstat (limited to 'apps/lib')
-rw-r--r-- | apps/lib/apps.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/apps/lib/apps.c b/apps/lib/apps.c index 8063a0e272..4337cc6c87 100644 --- a/apps/lib/apps.c +++ b/apps/lib/apps.c @@ -1115,29 +1115,28 @@ static ENGINE *try_load_engine(const char *engine) } #endif -ENGINE *setup_engine(const char *engine, int debug) +ENGINE *setup_engine_methods(const char *id, unsigned int methods, int debug) { ENGINE *e = NULL; #ifndef OPENSSL_NO_ENGINE - if (engine != NULL) { - if (strcmp(engine, "auto") == 0) { + if (id != NULL) { + if (strcmp(id, "auto") == 0) { BIO_printf(bio_err, "Enabling auto ENGINE support\n"); ENGINE_register_all_complete(); return NULL; } - if ((e = ENGINE_by_id(engine)) == NULL - && (e = try_load_engine(engine)) == NULL) { - BIO_printf(bio_err, "Invalid engine \"%s\"\n", engine); + if ((e = ENGINE_by_id(id)) == NULL + && (e = try_load_engine(id)) == NULL) { + BIO_printf(bio_err, "Invalid engine \"%s\"\n", id); ERR_print_errors(bio_err); return NULL; } - if (debug) { - ENGINE_ctrl(e, ENGINE_CTRL_SET_LOGSTREAM, 0, bio_err, 0); - } - ENGINE_ctrl_cmd(e, "SET_USER_INTERFACE", 0, (void *)get_ui_method(), - 0, 1); - if (!ENGINE_set_default(e, ENGINE_METHOD_ALL)) { + if (debug) + (void)ENGINE_ctrl(e, ENGINE_CTRL_SET_LOGSTREAM, 0, bio_err, 0); + if (!ENGINE_ctrl_cmd(e, "SET_USER_INTERFACE", 0, + (void *)get_ui_method(), 0, 1) + || !ENGINE_set_default(e, methods)) { BIO_printf(bio_err, "Cannot use engine \"%s\"\n", ENGINE_get_id(e)); ERR_print_errors(bio_err); ENGINE_free(e); |