summaryrefslogtreecommitdiffstats
path: root/doc
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 /doc
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 'doc')
-rw-r--r--doc/internal/man3/OSSL_METHOD_STORE.pod22
-rw-r--r--doc/internal/man3/ossl_method_construct.pod26
2 files changed, 25 insertions, 23 deletions
diff --git a/doc/internal/man3/OSSL_METHOD_STORE.pod b/doc/internal/man3/OSSL_METHOD_STORE.pod
index 7d9b80778d..5d9219fd0e 100644
--- a/doc/internal/man3/OSSL_METHOD_STORE.pod
+++ b/doc/internal/man3/OSSL_METHOD_STORE.pod
@@ -27,14 +27,14 @@ ossl_method_store_flush_cache
int nid, const void *method);
int ossl_method_store_fetch(OSSL_METHOD_STORE *store,
int nid, const char *properties,
- void **method);
- int ossl_method_store_cache_get(OSSL_METHOD_STORE *store, int nid,
- const char *prop_query, void **method);
- int ossl_method_store_cache_set(OSSL_METHOD_STORE *store, int nid,
- const char *prop_query, void *method,
+ void **method, const OSSL_PROVIDER **prov_rw);
+ int ossl_method_store_cache_get(OSSL_METHOD_STORE *store, OSSL_PROVIDER *prov,
+ int nid, const char *prop_query, void **method);
+ int ossl_method_store_cache_set(OSSL_METHOD_STORE *store, OSSL_PROVIDER *prov,
+ int nid, const char *prop_query, void *method,
int (*method_up_ref)(void *),
void (*method_destruct)(void *));
- void ossl_method_store_flush_cache(OSSL_METHOD_STORE *store);
+ void ossl_method_store_flush_cache(OSSL_METHOD_STORE *store, int all);
=head1 DESCRIPTION
@@ -79,7 +79,9 @@ I<store>.
ossl_method_store_fetch() queries I<store> for a method identified by I<nid>
that matches the property query I<prop_query>.
-The result, if any, is returned in I<method>.
+I<*prop> may be a pointer to a provider, which will narrow the search
+to methods from that provider.
+The result, if any, is returned in I<*method>, and its provider in I<*prov>.
ossl_method_store_flush_cache() flushes all cached entries associated with
I<store>.
@@ -89,10 +91,12 @@ I<store>.
ossl_method_store_cache_get() queries the cache associated with the I<store>
for a method identified by I<nid> that matches the property query
I<prop_query>.
+Additionally, if I<prov> isn't NULL, it will be used to narrow the search
+to only include methods from that provider.
The result, if any, is returned in I<method>.
-ossl_method_store_cache_set() sets a cache entry identified by I<nid> with the
-property query I<prop_query> in the I<store>.
+ossl_method_store_cache_set() sets a cache entry identified by I<nid> from the
+provider I<prov>, with the property query I<prop_query> in the I<store>.
Future calls to ossl_method_store_cache_get() will return the specified I<method>.
The I<method_up_ref> function is called to increment the
reference count of the method and the I<method_destruct> function is called
diff --git a/doc/internal/man3/ossl_method_construct.pod b/doc/internal/man3/ossl_method_construct.pod
index f30e5609dc..3683798b06 100644
--- a/doc/internal/man3/ossl_method_construct.pod
+++ b/doc/internal/man3/ossl_method_construct.pod
@@ -13,16 +13,15 @@ OSSL_METHOD_CONSTRUCT_METHOD, ossl_method_construct
/* 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);
+ int (*put)(void *store, void *method, const OSSL_PROVIDER *prov,
+ const char *name, const char *propdef, void *data);
/* Construct a new method */
- void *(*construct)(const char *name, const OSSL_DISPATCH *fns,
- OSSL_PROVIDER *prov, void *data);
+ void *(*construct)(const OSSL_ALGORITHM *algodef, OSSL_PROVIDER *prov,
+ void *data);
/* Destruct a method */
- void (*destruct)(void *method);
+ void (*destruct)(void *method, void *data);
};
typedef struct ossl_method_construct_method OSSL_METHOD_CONSTRUCT_METHOD;
@@ -75,17 +74,13 @@ function pointers:
=over 4
-=item alloc_tmp_store()
+=item get_tmp_store()
Create a temporary method store in the scope of the library context I<ctx>.
This store is used to temporarily store methods for easier lookup, for
when the provider doesn't want its dispatch table stored in a longer
term cache.
-=item dealloc_tmp_store()
-
-Remove a temporary store.
-
=item get()
Look up an already existing method from a store by name.
@@ -100,7 +95,10 @@ The method to be looked up should be identified with data found in I<data>
In other words, the ossl_method_construct() caller is entirely responsible
for ensuring the necesssary data is made available.
-This function is expected to increment the method's reference count.
+Optionally, I<prov> may be given as a search criterion, to narrow down the
+search of a method belonging to just one provider.
+
+This function is expected to increment the resulting method's reference count.
=item put()
@@ -112,7 +110,7 @@ NULL is a valid value and means that a subsystem default store
must be used.
This default store should be stored in the library context I<libctx>.
-The method should be associated with the given I<operation_id>,
+The method should be associated with the given provider I<prov>,
I<name> and property definition I<propdef> as well as any
identification data given through I<data> (which is the I<mcm_data>
that was passed to ossl_construct_method()).