summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2011-02-04 17:56:57 +0000
committerDr. Stephen Henson <steve@openssl.org>2011-02-04 17:56:57 +0000
commit7e95116064658bfbcedaceee60c0db43a02942e9 (patch)
treec9056962ee6d62534ba89bd748b56921287f67ab
parent06b433acade4732a7f647faace14dfd6950ac49c (diff)
Remove unneeded functions, make some functions and variables static.
-rw-r--r--fips/fips.c47
-rw-r--r--fips/fips_locl.h11
-rw-r--r--fips/utl/fips_lck.c2
-rw-r--r--fips/utl/fips_mem.c2
4 files changed, 23 insertions, 39 deletions
diff --git a/fips/fips.c b/fips/fips.c
index 83b72e577f..6a88661a0c 100644
--- a/fips/fips.c
+++ b/fips/fips.c
@@ -70,13 +70,24 @@
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;
@@ -88,7 +99,7 @@ static void fips_set_rand_check(const void *rand_check)
{
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;
@@ -101,7 +112,7 @@ int FIPS_mode(void)
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;
@@ -115,7 +126,7 @@ const void *FIPS_rand_check(void)
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;
@@ -127,7 +138,7 @@ const void *FIPS_rand_check(void)
int FIPS_selftest_failed(void)
{
int ret = 0;
- if (fips_is_started())
+ if (fips_started)
{
int owning_thread = fips_is_owning_thread();
@@ -256,7 +267,7 @@ int FIPS_mode_set(int onoff)
int ret = 0;
fips_w_lock();
- fips_set_started();
+ fips_started = 1;
fips_set_owning_thread();
if(onoff)
@@ -344,30 +355,14 @@ end:
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)
@@ -386,7 +381,7 @@ int fips_set_owning_thread(void)
{
int ret = 0;
- if (fips_is_started())
+ if (fips_started)
{
CRYPTO_w_lock(CRYPTO_LOCK_FIPS2);
if (!fips_thread_set)
@@ -403,7 +398,7 @@ int fips_clear_owning_thread(void)
{
int ret = 0;
- if (fips_is_started())
+ if (fips_started)
{
CRYPTO_w_lock(CRYPTO_LOCK_FIPS2);
if (fips_thread_set)
diff --git a/fips/fips_locl.h b/fips/fips_locl.h
index 06cb64d832..b79865e469 100644
--- a/fips/fips_locl.h
+++ b/fips/fips_locl.h
@@ -53,17 +53,6 @@
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
diff --git a/fips/utl/fips_lck.c b/fips/utl/fips_lck.c
index 63b4c0da73..32a44431c2 100644
--- a/fips/utl/fips_lck.c
+++ b/fips/utl/fips_lck.c
@@ -58,7 +58,7 @@
/* 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)
{
diff --git a/fips/utl/fips_mem.c b/fips/utl/fips_mem.c
index 3d5c907f1a..e0bd0a8265 100644
--- a/fips/utl/fips_mem.c
+++ b/fips/utl/fips_mem.c
@@ -72,7 +72,7 @@ static void fips_free_def(void *x)
static void *(*fips_malloc_cb)(int num, const char *file, int line) =
fips_malloc_def;
-void (*fips_free_cb)(void *) =
+static void (*fips_free_cb)(void *) =
fips_free_def;
void *FIPS_malloc(int num, const char *file, int line)