diff options
author | Matt Caswell <matt@openssl.org> | 2021-04-29 16:37:42 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2021-05-11 14:59:43 +0100 |
commit | 8c627075656cf2709680eeb5aa1826f00db2e483 (patch) | |
tree | e9c1e8ac25bf22bfefa28d3a5871b1a67ac16eda /include | |
parent | 3b85bcfa14988cb383d94e5dee16645ce1ad39ed (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')
-rw-r--r-- | include/internal/cryptlib.h | 4 | ||||
-rw-r--r-- | include/internal/provider.h | 8 | ||||
-rw-r--r-- | include/openssl/core_dispatch.h | 6 |
3 files changed, 15 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); diff --git a/include/openssl/core_dispatch.h b/include/openssl/core_dispatch.h index c2c6c45976..5c453eaac0 100644 --- a/include/openssl/core_dispatch.h +++ b/include/openssl/core_dispatch.h @@ -189,6 +189,8 @@ OSSL_CORE_MAKE_FUNC(void, cleanup_nonce, (const OSSL_CORE_HANDLE *handle, #define OSSL_FUNC_PROVIDER_NAME 107 #define OSSL_FUNC_PROVIDER_GET0_PROVIDER_CTX 108 #define OSSL_FUNC_PROVIDER_GET0_DISPATCH 109 +#define OSSL_FUNC_PROVIDER_UP_REF 110 +#define OSSL_FUNC_PROVIDER_FREE 111 OSSL_CORE_MAKE_FUNC(int, provider_register_child_cb, (const OSSL_CORE_HANDLE *handle, @@ -203,6 +205,10 @@ OSSL_CORE_MAKE_FUNC(void *, provider_get0_provider_ctx, (const OSSL_CORE_HANDLE *prov)) OSSL_CORE_MAKE_FUNC(const OSSL_DISPATCH *, provider_get0_dispatch, (const OSSL_CORE_HANDLE *prov)) +OSSL_CORE_MAKE_FUNC(int, provider_up_ref, + (const OSSL_CORE_HANDLE *prov, int activate)) +OSSL_CORE_MAKE_FUNC(int, provider_free, + (const OSSL_CORE_HANDLE *prov, int deactivate)) /* Functions provided by the provider to the Core, reserved numbers 1024-1535 */ # define OSSL_FUNC_PROVIDER_TEARDOWN 1024 |