summaryrefslogtreecommitdiffstats
path: root/crypto/core_namemap.c
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2022-03-14 08:13:12 +0000
committerPauli <pauli@openssl.org>2022-04-01 10:49:19 +1100
commit927d0566ded0dff9d6c5abc8a40bb84068446b76 (patch)
treec6d898a04aaa2062c9a74cb9c89ce25fa9680a41 /crypto/core_namemap.c
parent9c140a33663f319ad4000a6a985c3e14297c7389 (diff)
Refactor OSSL_LIB_CTX to avoid using CRYPTO_EX_DATA
This refactors OSSL_LIB_CTX to avoid using CRYPTO_EX_DATA. The assorted objects to be managed by OSSL_LIB_CTX are hardcoded and are initialized eagerly rather than lazily, which avoids the need for locking on access in most cases. Fixes #17116. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17881)
Diffstat (limited to 'crypto/core_namemap.c')
-rw-r--r--crypto/core_namemap.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/crypto/core_namemap.c b/crypto/core_namemap.c
index f058e629f3..d8de0af3ff 100644
--- a/crypto/core_namemap.c
+++ b/crypto/core_namemap.c
@@ -13,6 +13,7 @@
#include "crypto/lhash.h" /* ossl_lh_strcasehash */
#include "internal/tsan_assist.h"
#include "internal/sizes.h"
+#include "crypto/context.h"
/*-
* The namenum entry
@@ -61,7 +62,7 @@ static void namenum_free(NAMENUM_ENTRY *n)
/* OSSL_LIB_CTX_METHOD functions for a namemap stored in a library context */
-static void *stored_namemap_new(OSSL_LIB_CTX *libctx)
+void *ossl_stored_namemap_new(OSSL_LIB_CTX *libctx)
{
OSSL_NAMEMAP *namemap = ossl_namemap_new();
@@ -71,7 +72,7 @@ static void *stored_namemap_new(OSSL_LIB_CTX *libctx)
return namemap;
}
-static void stored_namemap_free(void *vnamemap)
+void ossl_stored_namemap_free(void *vnamemap)
{
OSSL_NAMEMAP *namemap = vnamemap;
@@ -82,12 +83,6 @@ static void stored_namemap_free(void *vnamemap)
}
}
-static const OSSL_LIB_CTX_METHOD stored_namemap_method = {
- OSSL_LIB_CTX_METHOD_DEFAULT_PRIORITY,
- stored_namemap_new,
- stored_namemap_free,
-};
-
/*-
* API functions
* =============
@@ -469,8 +464,7 @@ OSSL_NAMEMAP *ossl_namemap_stored(OSSL_LIB_CTX *libctx)
int nms;
#endif
OSSL_NAMEMAP *namemap =
- ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_NAMEMAP_INDEX,
- &stored_namemap_method);
+ ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_NAMEMAP_INDEX);
if (namemap == NULL)
return NULL;