summaryrefslogtreecommitdiff
path: root/src/fips.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2008-09-05 16:00:51 +0000
committerWerner Koch <wk@gnupg.org>2008-09-05 16:00:51 +0000
commite80c91cb97c555a11fa321b4c5590ce80081704a (patch)
treee861e40d259f0cb1ce943b1fd80a851a1d9cfac5 /src/fips.c
parent5109c0c8041b1d5453feebc3ae3df74a65d9d890 (diff)
downloadlibgcrypt-e80c91cb97c555a11fa321b4c5590ce80081704a.tar.gz
Let the test suite run the selftests even in non-fips mode.
Diffstat (limited to 'src/fips.c')
-rw-r--r--src/fips.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/fips.c b/src/fips.c
index 04b34d87..73a5816a 100644
--- a/src/fips.c
+++ b/src/fips.c
@@ -200,8 +200,8 @@ unlock_fsm (void)
/* This function returns true if fips mode is enabled. This is
independent of the fips required finite state machine and only used
- to enable run fips specific code. Please use the fips_mode macro
- instead of calling this fucntion directly. */
+ to enable fips specific code. Please use the fips_mode macro
+ instead of calling this function directly. */
int
_gcry_fips_mode (void)
{
@@ -520,12 +520,14 @@ check_binary_integrity (void)
/* Run the self-tests. */
-void
+gpg_err_code_t
_gcry_fips_run_selftests (void)
{
enum module_states result = STATE_ERROR;
+ gcry_err_code_t ec = GPG_ERR_SELFTEST_FAILED;
- fips_new_state (STATE_SELFTEST);
+ if (fips_mode ())
+ fips_new_state (STATE_SELFTEST);
if (run_cipher_selftests ())
goto leave;
@@ -549,9 +551,13 @@ _gcry_fips_run_selftests (void)
/* All selftests passed. */
result = STATE_OPERATIONAL;
+ ec = 0;
leave:
- fips_new_state (result);
+ if (fips_mode ())
+ fips_new_state (result);
+
+ return ec;
}