Assertion failure advice

Werner Koch wk at gnupg.org
Mon Apr 16 11:36:38 CEST 2007


On Mon, 16 Apr 2007 09:43, simon at josefsson.org said:

>> spey: ath.c:184: _gcry_ath_mutex_lock: Assertion `*lock == ((ath_mutex_t) 0)'
>
> This looks like a gcrypt and mutex related problem to me.  I'm cc'ing
> the libgcrypt mailing list.  Werner, any ideas?  What would trigger
> this assertion?

The thread callbacks are not setup at time.  This should be done even
before the version check and definitely before initializing secure
memory.  Here is an example using GNU Pth:

  /* Libgcrypt requires us to register the threading model first.
     Note that this will also do the pth_init. */
  err = gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pth);
  if (err)
    {
      log_fatal ("can't register GNU Pth with Libgcrypt: %s\n",
                 gpg_strerror (err));
    }

  /* Check that the libraries are suitable.  Do it here because
     the option parsing may need services of the library */
  if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
    {
      log_fatal( _("libgcrypt is too old (need %s, have %s)\n"),
                 NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) );
    }

Now continue with any other init stuff.  The manual explains this
http://www.gnupg.org/documentation/manuals/gcrypt/Multi-Threading.html



Salam-Shalom,

   Werner




More information about the Gcrypt-devel mailing list