summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2016-12-11 07:02:06 +0100
committerRichard Levitte <levitte@openssl.org>2017-06-29 11:55:32 +0200
commitf91ded1fc40bbe3950ae3e971d4c84a2edf039f8 (patch)
tree0cc97813c1ce54d941eb2560d79b83147454e43c /crypto
parentTest that storeutl with a directory path works as expected (diff)
downloadopenssl-f91ded1fc40bbe3950ae3e971d4c84a2edf039f8.tar.xz
openssl-f91ded1fc40bbe3950ae3e971d4c84a2edf039f8.zip
STORE: add ENGINE information to loaders
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3542)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/store/loader_file.c1
-rw-r--r--crypto/store/store_locl.h1
-rw-r--r--crypto/store/store_register.c21
3 files changed, 22 insertions, 1 deletions
diff --git a/crypto/store/loader_file.c b/crypto/store/loader_file.c
index 27af752497..446f60c163 100644
--- a/crypto/store/loader_file.c
+++ b/crypto/store/loader_file.c
@@ -1041,6 +1041,7 @@ static int file_close(OSSL_STORE_LOADER_CTX *ctx)
static OSSL_STORE_LOADER file_loader =
{
"file",
+ NULL,
file_open,
NULL,
file_load,
diff --git a/crypto/store/store_locl.h b/crypto/store/store_locl.h
index 5797a365ea..a954c577c4 100644
--- a/crypto/store/store_locl.h
+++ b/crypto/store/store_locl.h
@@ -72,6 +72,7 @@ OSSL_STORE_LOADER *ossl_store_unregister_loader_int(const char *scheme);
/* loader stuff */
struct ossl_store_loader_st {
const char *scheme;
+ ENGINE *engine;
OSSL_STORE_open_fn open;
OSSL_STORE_ctrl_fn ctrl;
OSSL_STORE_load_fn load;
diff --git a/crypto/store/store_register.c b/crypto/store/store_register.c
index a138edc636..bde190e78e 100644
--- a/crypto/store/store_register.c
+++ b/crypto/store/store_register.c
@@ -28,7 +28,7 @@ DEFINE_RUN_ONCE_STATIC(do_registry_init)
* Functions for manipulating OSSL_STORE_LOADERs
*/
-OSSL_STORE_LOADER *OSSL_STORE_LOADER_new(const char *scheme)
+OSSL_STORE_LOADER *OSSL_STORE_LOADER_new(ENGINE *e, const char *scheme)
{
OSSL_STORE_LOADER *res = OPENSSL_zalloc(sizeof(*res));
@@ -49,10 +49,16 @@ OSSL_STORE_LOADER *OSSL_STORE_LOADER_new(const char *scheme)
return NULL;
}
+ res->engine = e;
res->scheme = scheme;
return res;
}
+const ENGINE *OSSL_STORE_LOADER_get0_engine(const OSSL_STORE_LOADER *loader)
+{
+ return loader->engine;
+}
+
const char *OSSL_STORE_LOADER_get0_scheme(const OSSL_STORE_LOADER *loader)
{
return loader->scheme;
@@ -257,3 +263,16 @@ void ossl_store_destroy_loaders_int(void)
CRYPTO_THREAD_lock_free(registry_lock);
registry_lock = NULL;
}
+
+/*
+ * Functions to list OSSL_STORE loaders
+ */
+
+IMPLEMENT_LHASH_DOALL_ARG_CONST(OSSL_STORE_LOADER, void);
+int OSSL_STORE_do_all_loaders(void (*do_function) (const OSSL_STORE_LOADER
+ *loader, void *do_arg),
+ void *do_arg)
+{
+ lh_OSSL_STORE_LOADER_doall_void(loader_register, do_function, do_arg);
+ return 1;
+}