diff options
author | Dmitry Belyavskiy <beldmit@gmail.com> | 2022-04-13 12:32:14 +0200 |
---|---|---|
committer | Dmitry Belyavskiy <beldmit@gmail.com> | 2022-04-22 11:34:41 +0200 |
commit | 4b2bd2722b8294a6b27c9e1fcf7d76f7d9de9b44 (patch) | |
tree | 0d88b8de3e2a7ef5e6c0fe8efa13d64c4e802771 /crypto/init.c | |
parent | 5adddcd96255112ff04b350d661518302159e7e2 (diff) | |
download | openssl-4b2bd2722b8294a6b27c9e1fcf7d76f7d9de9b44.tar.gz |
Public API functions OPENSSL_str[n]casecmp
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18069)
Diffstat (limited to 'crypto/init.c')
-rw-r--r-- | crypto/init.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/crypto/init.c b/crypto/init.c index b7d7ad0ea3..d859bd42c6 100644 --- a/crypto/init.c +++ b/crypto/init.c @@ -32,6 +32,7 @@ #include "crypto/store.h" #include <openssl/cmp_util.h> /* for OSSL_CMP_log_close() */ #include <openssl/trace.h> +#include "crypto/ctype.h" static int stopped = 0; static uint64_t optsdone = 0; @@ -270,6 +271,15 @@ 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) @@ -387,6 +397,11 @@ void OPENSSL_cleanup(void) async_deinit(); } + if (casecmp_inited) { + OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_deinit_casecmp()\n"); + ossl_deinit_casecmp(); + } + if (load_crypto_strings_inited) { OSSL_TRACE(INIT, "OPENSSL_cleanup: err_free_strings_int()\n"); err_free_strings_int(); @@ -459,6 +474,9 @@ 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) { |