<div dir="ltr">Please see the attached patch. <div><br></div><div>The flag jent_rng_is_initialized is not being handled correctly. </div><div>- It is set to true before the corresponding jent_rng_collector structure is fully initialized.</div><div>- It is not cleared when the jent_rng_collector is freed. </div><div><br></div><div>Subsequently, when trying to generate entropy in the function _gcry_rndjent_poll after the jent_rng_collector has been freed, jent_rng_is_initialized is true so jent_rng_collector is not re-initialized, but then when trying to generate entropy jent_rng_collector is null so entropy generation is skipped.</div><div><br></div><div>In Ubuntu, we want to create a userspace FIPS mode that generates entropy solely through the jitter entropy library. Because of this bug, the modifications we made to rndgetentropy.c to get all of the entropy from _gcry_rndjent_poll goes into an infinite loop because _gcry_rndjent_poll generates 0 random entropy. Consequently I think the existing code that tries to generate 50% of the bytes from jitterentropy is actually getting none.</div><div><br></div><div>This patch was generated against the master branch.</div></div>