diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2022-03-31 16:09:21 +0900 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2022-03-31 09:27:46 +0200 |
commit | 35a7409dcf29009ed2cf365815c6abf02c94cb8f (patch) | |
tree | bfdc0504c6325db8ab5a9c554c6f3c85c12a7a81 | |
parent | aa5c08afe5ae1c20bc41ff49b7a641e32561ed46 (diff) | |
download | libgcrypt-35a7409dcf29009ed2cf365815c6abf02c94cb8f.tar.gz |
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 <gniibe@fsij.org>
(cherry picked from commit df7879a86b1de8eaf2d784687155c4274574b120)
Note that this RNG is only used in FIPS mode.
-rw-r--r-- | random/random-drbg.c | 3 |
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)) { |