<div dir="ltr">Hello,<div>I have a question regarding the usage of the master DRBG during the fork operation. As far as I understand from the source code and articles, during the fork the library will perform the lock of the master DRBG to obtain the entropy for public and private DRBG. </div><div>However, the library does not perform the check of the lock state itself and it is unclear for me, what will happen if the master DRBG is locked during the creation of the fork process. </div><div><br></div><div>Additionally, what was the purpose of such complicated scheme for DRBGs except for NIST requirements?  Is it possible to solve fork problem without implementing the chain of DRBGs?</div><div><br></div><div>Can you please help with this?</div><div><br></div><div>Articles:</div><div><a href="https://www.openssl.org/docs/man1.1.1/man7/RAND_DRBG.html" target="_blank">https://www.openssl.org/docs/man1.1.1/man7/RAND_DRBG.html</a><br></div><div><a href="http://emboss.github.io/blog/2013/08/21/openssl-prng-is-not-really-fork-safe/" target="_blank">http://emboss.github.io/blog/2013/08/21/openssl-prng-is-not-really-fork-safe/</a><br></div><div><a href="https://wiki.openssl.org/index.php/Random_fork-safety" target="_blank">https://wiki.openssl.org/index.php/Random_fork-safety</a><br></div><div><br></div><div>Here is the code from the rand_lib.c:</div><div><div style="color:rgb(248,248,242);background-color:rgb(25,25,25);font-family:"Fira Code",Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre-wrap"><div>            <span style="color:rgb(140,218,255)">rand_drbg_lock</span>(<span style="color:rgb(233,253,172)">drbg</span>-><span style="color:rgb(233,253,172)">parent</span>);</div><div>            <span style="color:rgb(255,94,94)">if</span> (<span style="color:rgb(140,218,255)">RAND_DRBG_generate</span>(<span style="color:rgb(233,253,172)">drbg</span>-><span style="color:rgb(233,253,172)">parent</span>,</div><div>                                   buffer, bytes_needed,</div><div>                                   prediction_resistance,</div><div>                                   <span style="color:rgb(255,137,66)">NULL</span>, <span style="color:rgb(253,176,130)">0</span>) <span style="color:rgb(255,94,94)">!=</span> <span style="color:rgb(253,176,130)">0</span>)</div><div>                bytes <span style="color:rgb(255,94,94)">=</span> bytes_needed;</div><div>            <span style="color:rgb(233,253,172)">drbg</span>-><span style="color:rgb(233,253,172)">reseed_next_counter</span></div><div>                <span style="color:rgb(255,94,94)">=</span> <span style="color:rgb(140,218,255)">tsan_load</span>(<span style="color:rgb(255,94,94)">&</span><span style="color:rgb(233,253,172)">drbg</span>-><span style="color:rgb(233,253,172)">parent</span>-><span style="color:rgb(233,253,172)">reseed_prop_counter</span>);</div><div>            <span style="color:rgb(140,218,255)">rand_drbg_unlock</span>(<span style="color:rgb(233,253,172)">drbg</span>-><span style="color:rgb(233,253,172)">parent</span>);</div></div></div></div>