static int fips_selftest_fail;
static int fips_mode;
+static int fips_started = 0;
static const void *fips_rand_check;
+static int fips_is_owning_thread(void);
+static int fips_set_owning_thread(void);
+static int fips_clear_owning_thread(void);
+static unsigned char *fips_signature_witness(void);
+
+static void fips_w_lock(void) { CRYPTO_w_lock(CRYPTO_LOCK_FIPS); }
+static void fips_w_unlock(void) { CRYPTO_w_unlock(CRYPTO_LOCK_FIPS); }
+static void fips_r_lock(void) { CRYPTO_r_lock(CRYPTO_LOCK_FIPS); }
+static void fips_r_unlock(void) { CRYPTO_r_unlock(CRYPTO_LOCK_FIPS); }
+
static void fips_set_mode(int onoff)
{
int owning_thread = fips_is_owning_thread();
- if (fips_is_started())
+ if (fips_started)
{
if (!owning_thread) fips_w_lock();
fips_mode = onoff;
{
int owning_thread = fips_is_owning_thread();
- if (fips_is_started())
+ if (fips_started)
{
if (!owning_thread) fips_w_lock();
fips_rand_check = rand_check;
int ret = 0;
int owning_thread = fips_is_owning_thread();
- if (fips_is_started())
+ if (fips_started)
{
if (!owning_thread) fips_r_lock();
ret = fips_mode;
const void *ret = 0;
int owning_thread = fips_is_owning_thread();
- if (fips_is_started())
+ if (fips_started)
{
if (!owning_thread) fips_r_lock();
ret = fips_rand_check;
int FIPS_selftest_failed(void)
{
int ret = 0;
- if (fips_is_started())
+ if (fips_started)
{
int owning_thread = fips_is_owning_thread();
int ret = 0;
fips_w_lock();
- fips_set_started();
+ fips_started = 1;
fips_set_owning_thread();
if(onoff)
return ret;
}
-void fips_w_lock(void) { CRYPTO_w_lock(CRYPTO_LOCK_FIPS); }
-void fips_w_unlock(void) { CRYPTO_w_unlock(CRYPTO_LOCK_FIPS); }
-void fips_r_lock(void) { CRYPTO_r_lock(CRYPTO_LOCK_FIPS); }
-void fips_r_unlock(void) { CRYPTO_r_unlock(CRYPTO_LOCK_FIPS); }
-
-static int fips_started = 0;
static CRYPTO_THREADID fips_thread;
static int fips_thread_set = 0;
-void fips_set_started(void)
- {
- fips_started = 1;
- }
-
-int fips_is_started(void)
- {
- return fips_started;
- }
-
-int fips_is_owning_thread(void)
+static int fips_is_owning_thread(void)
{
int ret = 0;
- if (fips_is_started())
+ if (fips_started)
{
CRYPTO_r_lock(CRYPTO_LOCK_FIPS2);
if (fips_thread_set)
{
int ret = 0;
- if (fips_is_started())
+ if (fips_started)
{
CRYPTO_w_lock(CRYPTO_LOCK_FIPS2);
if (!fips_thread_set)
{
int ret = 0;
- if (fips_is_started())
+ if (fips_started)
{
CRYPTO_w_lock(CRYPTO_LOCK_FIPS2);
if (fips_thread_set)
extern "C" {
#endif
-void fips_w_lock(void);
-void fips_w_unlock(void);
-void fips_r_lock(void);
-void fips_r_unlock(void);
-int fips_is_started(void);
-void fips_set_started(void);
-int fips_is_owning_thread(void);
-int fips_set_owning_thread(void);
-int fips_clear_owning_thread(void);
-unsigned char *fips_signature_witness(void);
-
#define FIPS_MAX_CIPHER_TEST_SIZE 16
#ifdef __cplusplus
/* FIPS locking callbacks */
-void (*fips_lck_cb)(int mode, int type,const char *file,int line) = 0;
+static void (*fips_lck_cb)(int mode, int type,const char *file,int line) = 0;
void FIPS_lock(int mode, int type,const char *file,int line)
{