summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2021-10-04 15:33:37 +0200
committerRichard Levitte <levitte@openssl.org>2021-10-27 12:46:16 +0200
commit6e87830ebcbab6b03970da6a4f1070adb938a5ec (patch)
tree3229ee62d8ad969a623ab2d98b8c8c89508f8f30 /include
parent29a007870ed639fb6ba7547095d53f241a3ee7fd (diff)
CORE: Encure that cached fetches can be done per provider
This mostly entails passing around a provider pointer, and handling queries that includes a pointer to a provider, where NULL means "any". This also means that there's a need to pass the provider pointer, not just down to the cache functions, but also be able to get it from ossl_method_store_fetch(). To this end, that function's OSSL_PROVIDER pointer argument is modified to be a pointer reference, so the function can answer back what provider the method comes from. Test added. Fixes #16614 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16725) (cherry picked from commit dc010ca6ec01d313a84c3c4b040232655a1772ad)
Diffstat (limited to 'include')
-rw-r--r--include/internal/core.h4
-rw-r--r--include/internal/property.h13
2 files changed, 9 insertions, 8 deletions
diff --git a/include/internal/core.h b/include/internal/core.h
index 277f2bdac5..d9dc424164 100644
--- a/include/internal/core.h
+++ b/include/internal/core.h
@@ -31,7 +31,7 @@ typedef struct ossl_method_construct_method_st {
/* Get a temporary store */
void *(*get_tmp_store)(void *data);
/* Get an already existing method from a store */
- void *(*get)(void *store, void *data);
+ void *(*get)(void *store, const OSSL_PROVIDER **prov, void *data);
/* Store a method in a store */
int (*put)(void *store, void *method, const OSSL_PROVIDER *prov,
const char *name, const char *propdef, void *data);
@@ -43,7 +43,7 @@ typedef struct ossl_method_construct_method_st {
} OSSL_METHOD_CONSTRUCT_METHOD;
void *ossl_method_construct(OSSL_LIB_CTX *ctx, int operation_id,
- OSSL_PROVIDER *prov, int force_cache,
+ OSSL_PROVIDER **provider_rw, int force_cache,
OSSL_METHOD_CONSTRUCT_METHOD *mcm, void *mcm_data);
void ossl_algorithm_do_all(OSSL_LIB_CTX *libctx, int operation_id,
diff --git a/include/internal/property.h b/include/internal/property.h
index dd9a2dc2d8..8211974595 100644
--- a/include/internal/property.h
+++ b/include/internal/property.h
@@ -61,18 +61,19 @@ int ossl_method_store_remove(OSSL_METHOD_STORE *store, int nid,
void ossl_method_store_do_all(OSSL_METHOD_STORE *store,
void (*fn)(int id, void *method, void *fnarg),
void *fnarg);
-int ossl_method_store_fetch(OSSL_METHOD_STORE *store, int nid,
- const char *prop_query, void **method);
+int ossl_method_store_fetch(OSSL_METHOD_STORE *store,
+ int nid, const char *prop_query,
+ const OSSL_PROVIDER **prov, void **method);
/* Get the global properties associate with the specified library context */
OSSL_PROPERTY_LIST **ossl_ctx_global_properties(OSSL_LIB_CTX *ctx,
int loadconfig);
/* property query cache functions */
-int ossl_method_store_cache_get(OSSL_METHOD_STORE *store, int nid,
- const char *prop_query, void **result);
-int ossl_method_store_cache_set(OSSL_METHOD_STORE *store, int nid,
- const char *prop_query, void *result,
+int ossl_method_store_cache_get(OSSL_METHOD_STORE *store, OSSL_PROVIDER *prov,
+ int nid, const char *prop_query, void **result);
+int ossl_method_store_cache_set(OSSL_METHOD_STORE *store, OSSL_PROVIDER *prov,
+ int nid, const char *prop_query, void *result,
int (*method_up_ref)(void *),
void (*method_destruct)(void *));