diff options
-rw-r--r-- | lib/fips.c | 15 | ||||
-rw-r--r-- | lib/gnutls_global.c | 19 |
2 files changed, 19 insertions, 15 deletions
diff --git a/lib/fips.c b/lib/fips.c index 6fb29835f4..1833a5db26 100644 --- a/lib/fips.c +++ b/lib/fips.c @@ -325,21 +325,6 @@ 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 2e89feb7a9..f96551c32e 100644 --- a/lib/gnutls_global.c +++ b/lib/gnutls_global.c @@ -430,3 +430,22 @@ const char *gnutls_check_version(const char *req_version) return NULL; } + +#if defined(__GNUC__) || defined(ENABLE_FIPS140) +__attribute__((constructor)) +#endif +static void lib_init(void) +{ + if (gnutls_global_init2(GNUTLS_GLOBAL_INIT_MINIMAL|GNUTLS_GLOBAL_INIT_CRYPTO) < 0) { + fprintf(stderr, "Error in GnuTLS initialization"); + _gnutls_switch_lib_state(LIB_STATE_ERROR); + } +} + +#if defined(__GNUC__) || defined(ENABLE_FIPS140) +__attribute__((destructor)) +#endif +static void lib_deinit(void) +{ + gnutls_global_deinit(); +} |