random: Fix hang of _gcry_rndjent_get_version.
* random/rndjent.c (_gcry_rndjent_get_version): Move locking.
cherry-picked from master commit:
355f5b7f69075c010fe33aa5b10ac60c08fae0c7
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: T4034
- Fixes-commit: 0de2a22fcf6607d0aecb550feefa414cee3731b2