summaryrefslogtreecommitdiff
path: root/lib/gnutls_global.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gnutls_global.c')
-rw-r--r--lib/gnutls_global.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/gnutls_global.c b/lib/gnutls_global.c
index 6dbc534dc0..12912f73d9 100644
--- a/lib/gnutls_global.c
+++ b/lib/gnutls_global.c
@@ -32,6 +32,7 @@
#include <system.h>
#include <accelerated/cryptodev.h>
#include <accelerated/accelerated.h>
+#include <fips.h>
#include "sockets.h"
#include "gettext.h"
@@ -201,6 +202,8 @@ int gnutls_global_init(void)
if (_gnutls_init++)
goto out;
+
+ _gnutls_switch_fips_state(FIPS_STATE_INIT);
e = getenv("GNUTLS_DEBUG_LEVEL");
if (e != NULL) {
@@ -279,8 +282,17 @@ int gnutls_global_init(void)
#endif
_gnutls_cryptodev_init();
+
+ if (_gnutls_fips_mode_enabled()) {
+ result = _gnutls_fips_perform_self_checks();
+ if (result < 0) {
+ gnutls_assert();
+ goto out;
+ }
+ _gnutls_switch_fips_state(FIPS_STATE_OPERATIONAL);
+ }
- out:
+out:
return result;
}