diff options
author | Richard Levitte <levitte@openssl.org> | 2021-10-04 15:33:37 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2021-10-27 12:41:15 +0200 |
commit | dc010ca6ec01d313a84c3c4b040232655a1772ad (patch) | |
tree | b925e2db5fad6f5c06e5bbac180fe15c223ae8b7 /include/internal | |
parent | 433e13455ede1a39d415b690b8a564b4f36b8dee (diff) | |
download | openssl-dc010ca6ec01d313a84c3c4b040232655a1772ad.tar.gz |
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)
Diffstat (limited to 'include/internal')
-rw-r--r-- | include/internal/core.h | 4 | ||||
-rw-r--r-- | include/internal/property.h | 13 |
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 *)); |