summaryrefslogtreecommitdiffstats
path: root/crypto/store
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2021-03-11 18:02:52 +0100
committerTomas Mraz <tomas@openssl.org>2021-03-12 15:11:21 +0100
commit12b4e5821d59b5d0c35f830e078d842583be6486 (patch)
treeeeb47b387a932c61534473309439f075e641e443 /crypto/store
parent343475126e55b4e814acb495196b92680df70a88 (diff)
Use OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL) in libcrypto
Calling OPENSSL_init_crypto(0, NULL) is a no-op and will not properly initialize thread local handling. Only the calls that are needed to initialize thread locals are kept, the rest of the no-op calls are removed. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14497)
Diffstat (limited to 'crypto/store')
-rw-r--r--crypto/store/store_init.c16
-rw-r--r--crypto/store/store_local.h7
-rw-r--r--crypto/store/store_register.c7
3 files changed, 0 insertions, 30 deletions
diff --git a/crypto/store/store_init.c b/crypto/store/store_init.c
index d308dc5d0b..dc507c6751 100644
--- a/crypto/store/store_init.c
+++ b/crypto/store/store_init.c
@@ -7,25 +7,9 @@
* https://www.openssl.org/source/license.html
*/
-#include <openssl/err.h>
#include "crypto/store.h"
#include "store_local.h"
-static CRYPTO_ONCE store_init = CRYPTO_ONCE_STATIC_INIT;
-DEFINE_RUN_ONCE_STATIC(do_store_init)
-{
- return OPENSSL_init_crypto(0, NULL);
-}
-
-int ossl_store_init_once(void)
-{
- if (!RUN_ONCE(&store_init, do_store_init)) {
- ERR_raise(ERR_LIB_OSSL_STORE, ERR_R_MALLOC_FAILURE);
- return 0;
- }
- return 1;
-}
-
void ossl_store_cleanup_int(void)
{
ossl_store_destroy_loaders_int();
diff --git a/crypto/store/store_local.h b/crypto/store/store_local.h
index 56a90a125b..16989707d6 100644
--- a/crypto/store/store_local.h
+++ b/crypto/store/store_local.h
@@ -153,13 +153,6 @@ struct ossl_store_ctx_st {
};
/*-
- * OSSL_STORE init stuff
- * ---------------------
- */
-
-int ossl_store_init_once(void);
-
-/*-
* 'file' scheme stuff
* -------------------
*/
diff --git a/crypto/store/store_register.c b/crypto/store/store_register.c
index f426a82ecc..51bd591790 100644
--- a/crypto/store/store_register.c
+++ b/crypto/store/store_register.c
@@ -207,8 +207,6 @@ int ossl_store_register_loader_int(OSSL_STORE_LOADER *loader)
}
int OSSL_STORE_register_loader(OSSL_STORE_LOADER *loader)
{
- if (!ossl_store_init_once())
- return 0;
return ossl_store_register_loader_int(loader);
}
@@ -224,9 +222,6 @@ const OSSL_STORE_LOADER *ossl_store_get0_loader_int(const char *scheme)
template.close = NULL;
template.open_ex = NULL;
- if (!ossl_store_init_once())
- return NULL;
-
if (!RUN_ONCE(&registry_init, do_registry_init)) {
ERR_raise(ERR_LIB_OSSL_STORE, ERR_R_MALLOC_FAILURE);
return NULL;
@@ -275,8 +270,6 @@ OSSL_STORE_LOADER *ossl_store_unregister_loader_int(const char *scheme)
}
OSSL_STORE_LOADER *OSSL_STORE_unregister_loader(const char *scheme)
{
- if (!ossl_store_init_once())
- return 0;
return ossl_store_unregister_loader_int(scheme);
}