libgcrypt RNG locking

Stephan Mueller smueller at
Wed Feb 26 17:08:41 CET 2014

Am Mittwoch, 26. Februar 2014, 16:42:23 schrieb Werner Koch:

Hi Werner,

> On Wed, 26 Feb 2014 13:53, smueller at said:
> > If I try to trigger a simple deadlock by calling:
> > 
> > drbg_lock(0);
> > drbg_lock(0);
> > 
> > there is no deadlock.
> There are two possible reasons:  gpgrt could be using recursive mutexes
> and thus you won't be able to create a deadlock with just one thread.
> However, for common Linux systems this is not the case.  The second and
> more likely reason is that you did not link with -lpthread and thus the
> process has not thread support which makes mutexes pointless.  libgpg-error
> uses ELF weak symbols to implement that.

Thank you very much. This is indeed the solution for enforcing the locking. I 
will post a new version of the DRBG code without deadlocking shortly.
> Salam-Shalom,
>    Werner

| Cui bono? |

More information about the Gcrypt-devel mailing list