From: Nikos Mavrogiannopoulos Date: Thu, 28 Nov 2013 16:35:18 +0000 (+0100) Subject: Added destructor and moved both *structors to fips.c X-Git-Tag: gnutls_3_3_0pre0~520^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=de3500e67e61310fa13099f1f8d57cf4208f9b1a;p=thirdparty%2Fgnutls.git Added destructor and moved both *structors to fips.c --- diff --git a/lib/fips.c b/lib/fips.c index 690c4cddd8..a8beda02d4 100644 --- a/lib/fips.c +++ b/lib/fips.c @@ -326,6 +326,21 @@ error: return GNUTLS_E_SELF_TEST_ERROR; } + +__attribute__((constructor)) +static void lib_init(void) +{ + if (gnutls_global_init2(GNUTLS_GLOBAL_INIT_MINIMAL|GNUTLS_GLOBAL_INIT_CRYPTO) < 0) { + fprintf(stderr, "Error in GnuTLS initialization"); + abort(); + } +} + +__attribute__((destructor)) +static void lib_deinit(void) +{ + gnutls_global_deinit(); +} #endif /** diff --git a/lib/gnutls_global.c b/lib/gnutls_global.c index 57bd116f53..52aa0819b9 100644 --- a/lib/gnutls_global.c +++ b/lib/gnutls_global.c @@ -338,18 +338,6 @@ out: return result; } -#ifdef ENABLE_FIPS140 -__attribute__((constructor)) -static void lib_init(void) -{ - if (gnutls_global_init2(GNUTLS_GLOBAL_INIT_MINIMAL|GNUTLS_GLOBAL_INIT_CRYPTO) < 0) { - fprintf(stderr, "Error in GnuTLS initialization"); - abort(); - } -} -#endif - - /** * gnutls_global_init: *