random: Fix hang of _gcry_rndjent_get_version.
authorWill Dietz <w@wdtz.org>
Sun, 17 Jun 2018 23:53:58 +0000 (18:53 -0500)
committerNIIBE Yutaka <gniibe@fsij.org>
Tue, 19 Jun 2018 03:14:14 +0000 (12:14 +0900)
commit355f5b7f69075c010fe33aa5b10ac60c08fae0c7
treee0e6b12c823b6e7a3838f9982c8a7d799d5b2782
parent0d51ea9b88b618368a7b916f26ebfe61bdf70503
random: Fix hang of _gcry_rndjent_get_version.

* random/rndjent.c (_gcry_rndjent_get_version): Move locking.

--

While the protection for jent_rng_collector is needed,
_gcry_rndjent_poll is also acquiring the lock for the variable.
Thus, it hangs.

This change is sub-optimal, the lock is once released after the call
of _gcry_rndjent_poll.  It might be good to modify the API of
_gcry_rndjent_poll to explicitly allow this use case of forcing
initialization keeping the lock.

Comments and change log entry by gniibe.

GnuPG-bug-id: 4034
Fixes-commit: 0de2a22fcf6607d0aecb550feefa414cee3731b2
random/rndjent.c