summaryrefslogtreecommitdiffstats
path: root/crypto/init.c
diff options
context:
space:
mode:
authorTodd Short <tshort@akamai.com>2021-04-12 15:51:59 -0400
committerTomas Mraz <tomas@openssl.org>2021-04-22 17:41:55 +0200
commit309c6fbaceb907e5b596a158f0891f42e6694bc2 (patch)
tree0a5939ab3a04539d0805203caced2961e49fcde3 /crypto/init.c
parent1fac27050176f7ed00da5649266024265678f70c (diff)
Add RUN_ONCE support to zlib init
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14940)
Diffstat (limited to 'crypto/init.c')
-rw-r--r--crypto/init.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/crypto/init.c b/crypto/init.c
index 788abe52e8..3170c60ac2 100644
--- a/crypto/init.c
+++ b/crypto/init.c
@@ -330,18 +330,6 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_engine_afalg)
# endif
#endif
-#ifndef OPENSSL_NO_COMP
-static CRYPTO_ONCE zlib = CRYPTO_ONCE_STATIC_INIT;
-
-static int zlib_inited = 0;
-DEFINE_RUN_ONCE_STATIC(ossl_init_zlib)
-{
- /* Do nothing - we need to know about this for the later cleanup */
- zlib_inited = 1;
- return 1;
-}
-#endif
-
void OPENSSL_cleanup(void)
{
OPENSSL_INIT_STOP *currhandler, *lasthandler;
@@ -384,10 +372,8 @@ void OPENSSL_cleanup(void)
*/
#ifndef OPENSSL_NO_COMP
- if (zlib_inited) {
- OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_comp_zlib_cleanup()\n");
- ossl_comp_zlib_cleanup();
- }
+ OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_comp_zlib_cleanup()\n");
+ ossl_comp_zlib_cleanup();
#endif
if (async_inited) {
@@ -644,12 +630,6 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings)
}
#endif
-#ifndef OPENSSL_NO_COMP
- if ((opts & OPENSSL_INIT_ZLIB)
- && !RUN_ONCE(&zlib, ossl_init_zlib))
- return 0;
-#endif
-
if (!CRYPTO_atomic_or(&optsdone, opts, &tmp, init_lock))
return 0;