aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2022-03-31 16:09:21 +0900
committerNIIBE Yutaka <[email protected]>2022-03-31 16:09:21 +0900
commitdf7879a86b1de8eaf2d784687155c4274574b120 (patch)
tree8fff332d31dc4b95f65d71eb4586d46569e1b3cf
parent2db5b5e995c21c5bd9cd193c2ed1109ba9b1a440 (diff)
downloadlibgcrypt-df7879a86b1de8eaf2d784687155c4274574b120.tar.gz
libgcrypt-df7879a86b1de8eaf2d784687155c4274574b120.tar.bz2
libgcrypt-df7879a86b1de8eaf2d784687155c4274574b120.zip
random:drbg: Fix the behavior for child process.
* random/random-drbg.c (_gcry_rngdrbg_randomize): Update change of PID detection. -- In a child process, it calls to drbg_reseed again and again, without this change. Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--random/random-drbg.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/random/random-drbg.c b/random/random-drbg.c
index a42b9ce8..5a46fd92 100644
--- a/random/random-drbg.c
+++ b/random/random-drbg.c
@@ -1940,6 +1940,9 @@ _gcry_rngdrbg_randomize (void *buffer, size_t length,
* key, either a re-init or a reseed is sufficient for a fork */
if (drbg_state->seed_init_pid != getpid ())
{
+ /* Update the PID recorded. */
+ drbg_state->seed_init_pid = getpid ();
+
/* We are in a child of us. Perform a reseeding. */
if (drbg_reseed (drbg_state, NULL))
{