err: get rid of err_free_strings_int()
authorDr. Matthias St. Pierre <matthias.st.pierre@ncp-e.com>
Tue, 29 Mar 2022 19:50:21 +0000 (21:50 +0200)
committerDr. Matthias St. Pierre <matthias.st.pierre@ncp-e.com>
Tue, 10 May 2022 07:47:54 +0000 (09:47 +0200)
Even though the function is not part of the public api, it is not
entirely removed, in order to minimize the chance of breakage,
because it is exported from libcrypto. Instead, we keep a dummy
implementation.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17974)

crypto/err/err.c
crypto/init.c
ssl/ssl_init.c

index 041aab4cb8b75ba0bfced13ab469d0fed1ae47d7..02fae89746a7e7e19503ab23aa8091c51566a50b 100644 (file)
@@ -327,8 +327,7 @@ int ERR_unload_strings(int lib, ERR_STRING_DATA *str)
 
 void err_free_strings_int(void)
 {
-    if (!RUN_ONCE(&err_string_init, do_err_strings_init))
-        return;
+    /* obsolete */
 }
 
 /********************************************************/
index 6f7c443d59d42bd82b2928b79d0fb6d8f8b48307..8d51a1329b9859530d356c0a8ba5dc5978cfb78d 100644 (file)
@@ -170,7 +170,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_load_crypto_nodelete)
 }
 
 static CRYPTO_ONCE load_crypto_strings = CRYPTO_ONCE_STATIC_INIT;
-static int load_crypto_strings_inited = 0;
+
 DEFINE_RUN_ONCE_STATIC(ossl_init_load_crypto_strings)
 {
     int ret = 1;
@@ -181,7 +181,6 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_load_crypto_strings)
 #if !defined(OPENSSL_NO_ERR) && !defined(OPENSSL_NO_AUTOERRINIT)
     OSSL_TRACE(INIT, "ossl_err_load_crypto_strings()\n");
     ret = ossl_err_load_crypto_strings();
-    load_crypto_strings_inited = 1;
 #endif
     return ret;
 }
@@ -397,11 +396,6 @@ void OPENSSL_cleanup(void)
         async_deinit();
     }
 
-    if (load_crypto_strings_inited) {
-        OSSL_TRACE(INIT, "OPENSSL_cleanup: err_free_strings_int()\n");
-        err_free_strings_int();
-    }
-
     /*
      * Note that cleanup order is important:
      * - ossl_rand_cleanup_int could call an ENGINE's RAND cleanup function so
index a8bcaa907d1e798604127567ef09c16633c0269a..cef57356c592eb070aa9b838277a322a2e1087ac 100644 (file)
@@ -46,7 +46,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_ssl_base)
 }
 
 static CRYPTO_ONCE ssl_strings = CRYPTO_ONCE_STATIC_INIT;
-static int ssl_strings_inited = 0;
+
 DEFINE_RUN_ONCE_STATIC(ossl_init_load_ssl_strings)
 {
     /*
@@ -56,7 +56,6 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_load_ssl_strings)
 #if !defined(OPENSSL_NO_ERR) && !defined(OPENSSL_NO_AUTOERRINIT)
     OSSL_TRACE(INIT, "ossl_init_load_ssl_strings: ossl_err_load_SSL_strings()\n");
     ossl_err_load_SSL_strings();
-    ssl_strings_inited = 1;
 #endif
     return 1;
 }
@@ -82,17 +81,6 @@ static void ssl_library_stop(void)
         ssl_comp_free_compression_methods_int();
 #endif
     }
-
-    if (ssl_strings_inited) {
-        OSSL_TRACE(INIT, "ssl_library_stop: err_free_strings_int()\n");
-        /*
-         * If both crypto and ssl error strings are inited we will end up
-         * calling err_free_strings_int() twice - but that's ok. The second
-         * time will be a no-op. It's easier to do that than to try and track
-         * between the two libraries whether they have both been inited.
-         */
-        err_free_strings_int();
-    }
 }
 
 /*