summaryrefslogtreecommitdiffstats
path: root/crypto/init.c
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2022-05-10 17:22:24 +0200
committerTomas Mraz <tomas@openssl.org>2022-05-13 08:30:48 +0200
commitf505be999f00232702aeb6918e4a1ffa0b9b588b (patch)
treefb37a5bf130bfc50bc5c655359be996d569944c4 /crypto/init.c
parent92d050167713f9a094c149c38435b07512c68936 (diff)
Always try locale initialization from OPENSSL_strcasecmp
Fixes #18172 Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18282)
Diffstat (limited to 'crypto/init.c')
-rw-r--r--crypto/init.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/crypto/init.c b/crypto/init.c
index 8d51a1329b..cca93df1a8 100644
--- a/crypto/init.c
+++ b/crypto/init.c
@@ -270,15 +270,6 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_async)
return 1;
}
-static CRYPTO_ONCE casecmp = CRYPTO_ONCE_STATIC_INIT;
-static int casecmp_inited = 0;
-DEFINE_RUN_ONCE_STATIC(ossl_init_casecmp)
-{
- int ret = ossl_init_casecmp_int();
-
- casecmp_inited = 1;
- return ret;
-}
#ifndef OPENSSL_NO_ENGINE
static CRYPTO_ONCE engine_openssl = CRYPTO_ONCE_STATIC_INIT;
DEFINE_RUN_ONCE_STATIC(ossl_init_engine_openssl)
@@ -451,10 +442,8 @@ void OPENSSL_cleanup(void)
OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_trace_cleanup()\n");
ossl_trace_cleanup();
- if (casecmp_inited) {
- OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_deinit_casecmp()\n");
- ossl_deinit_casecmp();
- }
+ OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_deinit_casecmp()\n");
+ ossl_deinit_casecmp();
base_inited = 0;
}
@@ -468,9 +457,6 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings)
{
uint64_t tmp;
int aloaddone = 0;
- if (!RUN_ONCE(&casecmp, ossl_init_casecmp))
- return 0;
-
/* Applications depend on 0 being returned when cleanup was already done */
if (stopped) {
@@ -498,6 +484,9 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings)
aloaddone = 1;
}
+ if (!ossl_init_casecmp())
+ return 0;
+
/*
* At some point we should look at this function with a view to moving
* most/all of this into OSSL_LIB_CTX.