summaryrefslogtreecommitdiffstats
path: root/include/internal
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2021-04-29 16:37:42 +0100
committerMatt Caswell <matt@openssl.org>2021-05-11 14:59:43 +0100
commit8c627075656cf2709680eeb5aa1826f00db2e483 (patch)
treee9c1e8ac25bf22bfefa28d3a5871b1a67ac16eda /include/internal
parent3b85bcfa14988cb383d94e5dee16645ce1ad39ed (diff)
Add support for child provider to up_ref/free their parent
If the ref counts on a child provider change, then this needs to be reflected in the parent so we add callbacks to do this. Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14991)
Diffstat (limited to 'include/internal')
-rw-r--r--include/internal/cryptlib.h4
-rw-r--r--include/internal/provider.h8
2 files changed, 9 insertions, 3 deletions
diff --git a/include/internal/cryptlib.h b/include/internal/cryptlib.h
index 9245a0b870..d943419a52 100644
--- a/include/internal/cryptlib.h
+++ b/include/internal/cryptlib.h
@@ -169,7 +169,9 @@ typedef struct ossl_ex_data_global_st {
# define OSSL_LIB_CTX_MAX_INDEXES 19
# define OSSL_LIB_CTX_METHOD_DEFAULT_PRIORITY 0
-# define OSSL_LIB_CTX_METHOD_HIGH_PRIORITY 1
+# define OSSL_LIB_CTX_METHOD_PRIORITY_1 1
+# define OSSL_LIB_CTX_METHOD_PRIORITY_2 2
+
typedef struct ossl_lib_ctx_method {
int priority;
void *(*new_func)(OSSL_LIB_CTX *ctx);
diff --git a/include/internal/provider.h b/include/internal/provider.h
index 13b72ad2de..7d5ccccbd1 100644
--- a/include/internal/provider.h
+++ b/include/internal/provider.h
@@ -41,7 +41,10 @@ int ossl_provider_set_fallback(OSSL_PROVIDER *prov);
int ossl_provider_set_module_path(OSSL_PROVIDER *prov, const char *module_path);
int ossl_provider_add_parameter(OSSL_PROVIDER *prov, const char *name,
const char *value);
-void ossl_provider_set_child(OSSL_PROVIDER *prov);
+int ossl_provider_set_child(OSSL_PROVIDER *prov, const OSSL_CORE_HANDLE *handle);
+const OSSL_CORE_HANDLE *ossl_provider_get_parent(OSSL_PROVIDER *prov);
+int ossl_provider_up_ref_parent(OSSL_PROVIDER *prov, int activate);
+int ossl_provider_free_parent(OSSL_PROVIDER *prov, int deactivate);
/* Disable fallback loading */
int ossl_provider_disable_fallback_loading(OSSL_LIB_CTX *libctx);
@@ -50,7 +53,8 @@ int ossl_provider_disable_fallback_loading(OSSL_LIB_CTX *libctx);
* Activate the Provider
* If the Provider is a module, the module will be loaded
*/
-int ossl_provider_activate(OSSL_PROVIDER *prov, int retain_fallbacks);
+int ossl_provider_activate(OSSL_PROVIDER *prov, int retain_fallbacks,
+ int upcalls);
int ossl_provider_deactivate(OSSL_PROVIDER *prov);
/* Check if the provider is available (activated) */
int ossl_provider_available(OSSL_PROVIDER *prov);