_gcry_ath_mutex_lock in GnuTLS

Werner Koch wk at gnupg.org
Tue Jan 17 11:08:00 CET 2006


On Mon, 16 Jan 2006 17:47:53 -0600, Rich Fought said:


> GCRY_THREAD_OPTION_PTHREAD_IMPL;

> void gcry_init_helper(void) {
>  gcry_control(GCRYCTL_DISABLE_SECMEM_WARN);
>  gcry_control(GCRYCTL_INIT_SECMEM, 16384, 0);
>  gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);

Swap the last two calls. Setting the threading model must be the very
first operation.  Calling DISABLE_SECMEN_WARN earlier is okay as it
only sets a flag.  Make sure that gcry_init_helper is called before
the first thread accesses Libgcrypt.

You should also rename gcry_init_helper because it uses Libgcrypt's
namespace.

> but what about gcry_init_helper? Shouldn't libgcrypt initialization only 
> be done once?

Yes.  However, INIT_SECMEM should simply fail and the other calls
protect themself.


Salam-Shalom,

   Werner




More information about the Gcrypt-devel mailing list