From e154c6443d3d28bfa7d8d93252cd1f10e9c0efa9 Mon Sep 17 00:00:00 2001
From: zhengxiaoxiao <zhengxiaoxiao2@huawei.com>
Date: Fri, 29 Jul 2022 15:20:12 +0800
Subject: [PATCH] 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.
 
Reference: https://github.com/gpg/libgcrypt/commit/35a7409dcf29009ed2cf365815c6abf02c94cb8f
Conflict: NA
---
 random/random-drbg.c | 3 +++
 1 file changed, 3 insertions(+)
 
diff --git a/random/random-drbg.c b/random/random-drbg.c
index 77d19a6..9ee5389 100644
--- a/random/random-drbg.c
+++ b/random/random-drbg.c
@@ -1981,6 +1981,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))
 	{
-- 
2.27.0
 