Libgcrypt threads model
dbaryshkov at gmail.com
Mon Jan 13 11:42:51 CET 2014
On Mon, Jan 13, 2014 at 2:17 PM, Werner Koch <wk at gnupg.org> wrote:
> On Fri, 10 Jan 2014 15:58, dbaryshkov at gmail.com said:
>>> Despite all definitions in ath.c gcrypt does not really support
>>> either W32 threads or pthreads on systems which do not
>>> support weak symbols (are there any of them?). Is it true?
>>> Is it intentional?
> That is quite possible. I did this code a long time ago and planned to
> improve it for non-ELF platforms. However, I never came that.
>>> How would ath mutexes behave if libgcrypt is linked into
>>> an application with static pthreads? With pth or npth?
>>> With w32?
> Pth shall not be supported anymore.
> nPth: We have to check.
> w32: it should just work or you have found a bug.
It looks so: there is no code for w32 (and for pthread w/o weak symbols).
The ath.c will default to "none" implementation. So the code will work
till there are multiple threads racing for libgcrypt. And as the mutexes
seem to be used only in prime pool and random code, this can be
left unnoticed for quite long time (till somebody implements concurrent
attack on libgcrypt's random generator).
With best wishes
More information about the Gcrypt-devel