Originally sent to gnupg-devel@, but not sure if that's going to get through so submitting here. Apologies for potential duplication.
In commit 0da4a237661cd273303ae6baaaba2d9f6292b990 calls to "lock_rng"
and "unlock_rng" were introduced and are causing hanging on musl as
well as on Darwin.
It looks like the problem is that within this lock/unlock pair the
code calls a function that itself tries
to obtain the same rng lock-- which is where things hang.
Attached is a patch that fixes this problem in a minimally intrusive way,
but is somewhat suboptimal as the same lock will be
obtained/released/obtained/released back-to-back.
I'm unsure why this behavior is not problematic when using glibc,
haven't investigated.
Hopefully this is useful and please let me know if this is incorrect
for some reason.