diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2022-03-31 16:09:21 +0900 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2022-03-31 16:09:21 +0900 |
commit | df7879a86b1de8eaf2d784687155c4274574b120 (patch) | |
tree | 8fff332d31dc4b95f65d71eb4586d46569e1b3cf | |
parent | 2db5b5e995c21c5bd9cd193c2ed1109ba9b1a440 (diff) | |
download | libgcrypt-df7879a86b1de8eaf2d784687155c4274574b120.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>
-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 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)) { |