From df7879a86b1de8eaf2d784687155c4274574b120 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Thu, 31 Mar 2022 16:09:21 +0900 Subject: 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 --- random/random-drbg.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'random') 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)) { -- cgit v1.2.1