return gnutls_assert_val(ret);
ctx->pid = getpid();
-
+
return 0;
}
{
/* Basic initialization is required to initialize mutexes and
do a few checks on the implementation. */
- static int initialized = 0;
struct fips_ctx* ctx;
int ret;
- if (initialized != 0)
- return 0;
- initialized = 1;
-
ret = gnutls_mutex_init(&rnd_mutex);
if (ret < 0)
return gnutls_assert_val(ret);
return ret;
}
+static void _rngfips_deinit(void * _ctx)
+{
+struct fips_ctx* ctx = _ctx;
+ zeroize_key(ctx, sizeof(*ctx));
+ free(ctx);
+ gnutls_mutex_deinit(&rnd_mutex);
+ rnd_mutex = NULL;
+}
+
+static void _rngfips_refresh(void *_ctx)
+{
+ /* this is predictable RNG. Don't refresh */
+ return;
+}
+
+
/* Run a Know-Answer-Test using a dedicated test context. Note that
we can't use the samples from the NISR RNGVS document because they
don't take the requirement to throw away the first block and use
return ret;
}
-static void _rngfips_deinit(void * _ctx)
-{
-struct fips_ctx* ctx = _ctx;
-
- zeroize_key(ctx, sizeof(*ctx));
- free(ctx);
- gnutls_mutex_deinit(&rnd_mutex);
- rnd_mutex = NULL;
-}
-
-static void _rngfips_refresh(void *_ctx)
-{
- /* this is predictable RNG. Don't refresh */
- return;
-}
-
int crypto_rnd_prio = INT_MAX;