]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
global: rename GNUTLS_NO_EXPLICIT_INIT to GNUTLS_NO_IMPLICIT_INIT
authorDaiki Ueno <ueno@gnu.org>
Mon, 3 May 2021 15:27:56 +0000 (17:27 +0200)
committerDaiki Ueno <ueno@gnu.org>
Mon, 3 May 2021 15:28:20 +0000 (17:28 +0200)
The old envvar still has effect but has been marked as deprecated.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
NEWS
doc/cha-gtls-app.texi
lib/global.c

diff --git a/NEWS b/NEWS
index c1db7910d22c1250fff373ba06a8a90c56c8fcf2..16ee97fb878e6c7013ac4c14419f449c2f5394e6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,10 @@ See the end for copying conditions.
 ** certtool: When signing a CSR, CRL distribution point (CDP) is no longer
    copied from the signing CA by default (#1126).
 
+** libgnutls: The GNUTLS_NO_EXPLICIT_INIT envvar has been renamed to
+   GNUTLS_NO_IMPLICIT_INIT to reflect the purpose (#1178). The former is now
+   deprecated and will be removed in the future releases.
+
 * Version 3.7.1 (released 2021-03-10)
 
 ** libgnutls: Fixed potential use-after-free in sending "key_share"
index 2399bf82eb8eb9d9b01ca5f167db87995b33dd22..7fd831b3db977029a4298aef3374ed2e47f2c566 100644 (file)
@@ -362,7 +362,7 @@ library.
 
 The GnuTLS library is initialized on load; prior to 3.3.0 was initialized by calling @funcref{gnutls_global_init}@footnote{
 The original behavior of requiring explicit initialization can obtained by setting the
-GNUTLS_NO_EXPLICIT_INIT environment variable to 1, or by using the macro GNUTLS_SKIP_GLOBAL_INIT
+GNUTLS_NO_IMPLICIT_INIT environment variable to 1, or by using the macro GNUTLS_SKIP_GLOBAL_INIT
 in a global section of your program --the latter works in systems with
 support for weak symbols only.}. @funcref{gnutls_global_init} in
 versions after 3.3.0 is thread-safe (see @ref{Thread safety}).
index d1bd668269bd534bf5c7caea029fa9531d52281e..a11523150f7d618299674a37fee8e8a086c1ee7e 100644 (file)
@@ -199,7 +199,7 @@ static int _gnutls_init_ret = 0;
  *
  * Since GnuTLS 3.3.0 this function is no longer necessary to be explicitly
  * called. To disable the implicit call (in a library constructor) of this
- * function set the environment variable %GNUTLS_NO_EXPLICIT_INIT to 1.
+ * function set the environment variable %GNUTLS_NO_IMPLICIT_INIT to 1.
  *
  * This function performs any required precalculations, detects
  * the supported CPU capabilities and initializes the underlying
@@ -487,14 +487,22 @@ const char *gnutls_check_version(const char *req_version)
 
 static void _CONSTRUCTOR lib_init(void)
 {
-int ret;
-const char *e;
+       int ret;
+       const char *e;
 
        if (_gnutls_global_init_skip() != 0)
                return;
 
+       e = secure_getenv("GNUTLS_NO_IMPLICIT_INIT");
+       if (e != NULL) {
+               ret = atoi(e);
+               if (ret == 1)
+                       return;
+       }
+
        e = secure_getenv("GNUTLS_NO_EXPLICIT_INIT");
        if (e != NULL) {
+               _gnutls_debug_log("GNUTLS_NO_EXPLICIT_INIT is deprecated; use GNUTLS_NO_IMPLICIT_INIT\n");
                ret = atoi(e);
                if (ret == 1)
                        return;
@@ -509,14 +517,23 @@ const char *e;
 
 static void _DESTRUCTOR lib_deinit(void)
 {
+       int ret;
        const char *e;
 
        if (_gnutls_global_init_skip() != 0)
                return;
 
+       e = secure_getenv("GNUTLS_NO_IMPLICIT_INIT");
+       if (e != NULL) {
+               ret = atoi(e);
+               if (ret == 1)
+                       return;
+       }
+
        e = secure_getenv("GNUTLS_NO_EXPLICIT_INIT");
        if (e != NULL) {
-               int ret = atoi(e);
+               _gnutls_debug_log("GNUTLS_NO_EXPLICIT_INIT is deprecated; use GNUTLS_NO_IMPLICIT_INIT\n");
+               ret = atoi(e);
                if (ret == 1)
                        return;
        }