summaryrefslogtreecommitdiffstats
path: root/include/internal
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2021-04-26 11:35:17 +0100
committerMatt Caswell <matt@openssl.org>2021-05-11 14:56:55 +0100
commita16d21744df686a7c005d1f129915d9083476e14 (patch)
tree1ea4d25a974b2f7cfcaafe65a03f9557b8ddc780 /include/internal
parentd07af736de592602f2831f8559d0302cb116e190 (diff)
Add the ability for ex_data to have a priority
Where an object has multiple ex_data associated with it, then we free that ex_data in order of priority (high priority first). 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.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/internal/cryptlib.h b/include/internal/cryptlib.h
index d583153b89..94d93abda2 100644
--- a/include/internal/cryptlib.h
+++ b/include/internal/cryptlib.h
@@ -120,6 +120,7 @@ size_t OPENSSL_instrument_bus2(unsigned int *, size_t, size_t);
struct ex_callback_st {
long argl; /* Arbitrary long */
void *argp; /* Arbitrary void * */
+ int priority; /* Priority ordering for freeing */
CRYPTO_EX_new *new_func;
CRYPTO_EX_free *free_func;
CRYPTO_EX_dup *dup_func;
@@ -166,7 +167,10 @@ typedef struct ossl_ex_data_global_st {
# define OSSL_LIB_CTX_BIO_CORE_INDEX 17
# define OSSL_LIB_CTX_MAX_INDEXES 18
+# define OSSL_LIB_CTX_METHOD_DEFAULT_PRIORITY 0
+# define OSSL_LIB_CTX_METHOD_HIGH_PRIORITY 1
typedef struct ossl_lib_ctx_method {
+ int priority;
void *(*new_func)(OSSL_LIB_CTX *ctx);
void (*free_func)(void *);
} OSSL_LIB_CTX_METHOD;
@@ -196,7 +200,8 @@ int ossl_crypto_get_ex_new_index_ex(OSSL_LIB_CTX *ctx, int class_index,
long argl, void *argp,
CRYPTO_EX_new *new_func,
CRYPTO_EX_dup *dup_func,
- CRYPTO_EX_free *free_func);
+ CRYPTO_EX_free *free_func,
+ int priority);
int ossl_crypto_free_ex_index_ex(OSSL_LIB_CTX *ctx, int class_index, int idx);
/* Function for simple binary search */