summaryrefslogtreecommitdiff
path: root/random
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2021-11-24 13:30:45 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2021-11-24 13:30:45 +0900
commit204be8a385ae6140175e3b495989a261410c34d0 (patch)
treef0b59d51d667474ab4fc2d371df00ef2aea8b6bf /random
parent33f1a7ad3cd13602d8bffe156f383c3a704dfd67 (diff)
downloadlibgcrypt-204be8a385ae6140175e3b495989a261410c34d0.tar.gz
random: Extend semantics of _gcry_random_close_fds.
* random/random-csprng.c (_gcry_rngcsprng_close_fds): Add de-initialization. * random/random-drbg.c (_gcry_rngdrbg_close_fds): Likewise. -- GnuPG-bug-id: 5636 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'random')
-rw-r--r--random/random-csprng.c12
-rw-r--r--random/random-drbg.c5
2 files changed, 16 insertions, 1 deletions
diff --git a/random/random-csprng.c b/random/random-csprng.c
index 6d6c082e..f3ad48f3 100644
--- a/random/random-csprng.c
+++ b/random/random-csprng.c
@@ -358,7 +358,17 @@ _gcry_rngcsprng_close_fds (void)
#if USE_RNDLINUX
_gcry_rndlinux_gather_random (NULL, 0, 0, 0);
#endif
- pool_filled = 0; /* Force re-open on next use. */
+ pool_writepos = 0;
+ pool_readpos = 0;
+ pool_filled = 0;
+ pool_filled_counter = 0;
+ did_initial_extra_seeding = 0;
+ pool_balance = 0;
+ just_mixed = 0;
+ xfree (rndpool);
+ xfree (keypool);
+ rndpool = NULL;
+ keypool = NULL;
unlock_pool ();
}
diff --git a/random/random-drbg.c b/random/random-drbg.c
index d44d11db..500ae645 100644
--- a/random/random-drbg.c
+++ b/random/random-drbg.c
@@ -1875,6 +1875,11 @@ _gcry_rngdrbg_close_fds (void)
#if USE_RNDLINUX
_gcry_rndlinux_gather_random (NULL, 0, 0, 0);
#endif
+ if (drbg_state)
+ {
+ drbg_uninstantiate (drbg_state);
+ drbg_state = NULL;
+ }
drbg_unlock ();
}