2 * Copyright (C) 2013 Red Hat
4 * Author: Nikos Mavrogiannopoulos
6 * This file is part of GnuTLS.
8 * The GnuTLS is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>
26 #include <gnutls_int.h>
27 #include <gnutls/gnutls.h>
29 #define FIPS140_RND_KEY_SIZE 32
35 LIB_STATE_OPERATIONAL,
40 /* do not access directly */
41 extern unsigned int _gnutls_lib_mode;
44 void _gnutls_switch_lib_state(gnutls_lib_state_t state)
46 /* Once into zombie state no errors can change us */
47 _gnutls_lib_mode = state;
50 inline static gnutls_lib_state_t _gnutls_get_lib_state(void)
52 return _gnutls_lib_mode;
55 int _gnutls_fips_perform_self_checks(void);
58 unsigned _gnutls_fips_mode_enabled(void);
60 # define _gnutls_fips_mode_enabled() 0
63 # define FAIL_IF_LIB_ERROR \
64 if (_gnutls_get_lib_state() != LIB_STATE_OPERATIONAL && \
65 _gnutls_get_lib_state() != LIB_STATE_SELFTEST) \
66 return GNUTLS_E_LIB_IN_ERROR_STATE
68 void _gnutls_switch_lib_state(gnutls_lib_state_t state);
70 void _gnutls_lib_simulate_error(void);