diff options
author | Richard Levitte <levitte@openssl.org> | 2016-12-11 07:06:13 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2017-06-29 11:55:32 +0200 |
commit | fa66949c26ad4381cbc90746c71597f2311f90a3 (patch) | |
tree | 64adeae0cf143bbca62891030f871b3129a5e9cc /apps/engine.c | |
parent | f91ded1fc40bbe3950ae3e971d4c84a2edf039f8 (diff) |
engine app: print out information on STORE loaders and STORE FILE handlers
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3542)
Diffstat (limited to 'apps/engine.c')
-rw-r--r-- | apps/engine.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/apps/engine.c b/apps/engine.c index 49f53ee34f..7724084255 100644 --- a/apps/engine.c +++ b/apps/engine.c @@ -19,6 +19,7 @@ NON_EMPTY_TRANSLATION_UNIT # include <openssl/err.h> # include <openssl/engine.h> # include <openssl/ssl.h> +# include <openssl/store.h> typedef enum OPTION_choice { OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, @@ -258,6 +259,25 @@ static void util_do_cmds(ENGINE *e, STACK_OF(OPENSSL_STRING) *cmds, } } +struct util_store_cap_data { + ENGINE *engine; + char **cap_buf; + int *cap_size; + int ok; +}; +static void util_store_cap(const OSSL_STORE_LOADER *loader, void *arg) +{ + struct util_store_cap_data *ctx = arg; + + if (OSSL_STORE_LOADER_get0_engine(loader) == ctx->engine) { + char buf[256]; + BIO_snprintf(buf, sizeof(buf), "STORE(%s)", + OSSL_STORE_LOADER_get0_scheme(loader)); + if (!append_buf(ctx->cap_buf, ctx->cap_size, buf)) + ctx->ok = 0; + } +} + int engine_main(int argc, char **argv) { int ret = 1, i; @@ -405,6 +425,18 @@ int engine_main(int argc, char **argv) if (!append_buf(&cap_buf, &cap_size, OBJ_nid2sn(nids[k]))) goto end; skip_pmeths: + { + struct util_store_cap_data store_ctx; + + store_ctx.engine = e; + store_ctx.cap_buf = &cap_buf; + store_ctx.cap_size = &cap_size; + store_ctx.ok = 1; + + OSSL_STORE_do_all_loaders(util_store_cap, &store_ctx); + if (!store_ctx.ok) + goto end; + } if (cap_buf != NULL && (*cap_buf != '\0')) BIO_printf(out, " [%s]\n", cap_buf); |