]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
removed the initialized static variable.
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Tue, 19 Nov 2013 13:21:53 +0000 (14:21 +0100)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Wed, 27 Nov 2013 10:41:43 +0000 (11:41 +0100)
lib/nettle/rnd-fips.c

index 692d012684c1255f42a162da0bf3ed601d9b13fb..20d86b15402c9f40f03bf9be88df6c2fc188efcc 100644 (file)
@@ -386,7 +386,7 @@ int ret;
                return gnutls_assert_val(ret);
 
        ctx->pid = getpid();
-       
+
        return 0;
 }
 
@@ -395,14 +395,9 @@ static int _rngfips_init(void** _ctx)
 {
 /* 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);
@@ -452,6 +447,22 @@ int 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
@@ -579,22 +590,6 @@ leave:
        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;