aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2022-03-31 16:09:21 +0900
committerWerner Koch <[email protected]>2022-03-31 09:27:46 +0200
commit35a7409dcf29009ed2cf365815c6abf02c94cb8f (patch)
treebfdc0504c6325db8ab5a9c554c6f3c85c12a7a81
parentaa5c08afe5ae1c20bc41ff49b7a641e32561ed46 (diff)
downloadlibgcrypt-LIBGCRYPT-1.8-BRANCH.tar.gz
libgcrypt-LIBGCRYPT-1.8-BRANCH.tar.bz2
libgcrypt-LIBGCRYPT-1.8-BRANCH.zip
random:drbg: Fix the behavior for child process.LIBGCRYPT-1.8-BRANCH
* 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]> (cherry picked from commit df7879a86b1de8eaf2d784687155c4274574b120) Note that this RNG is only used in FIPS mode.
-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 ed04e2dc..e9d0accf 100644
--- a/random/random-drbg.c
+++ b/random/random-drbg.c
@@ -1926,6 +1926,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))
{