[OTR-dev] libotr: crash when generating privkey in another thread

David Goulet dgoulet at ev0ke.net
Mon Dec 16 21:26:11 EST 2013


On 16 Dec (21:19:31), Ian Goldberg wrote:
> On Tue, Dec 17, 2013 at 01:36:52AM +0100, Martin Milata wrote:
> > Hi!
> > 
> > I'm writing a program that uses libotr-4.0.0 and encountered a problem
> > when trying to perform key generation in backtround thread.
> > 
> > When the key generation is running and another OTR query is received by
> > libotr the program crashes with following stacktrace:
> > 
> > ath.c:193: _gcry_ath_mutex_lock: Assertion `*lock == ((ath_mutex_t) 0)' failed.
> 
> What's supposed to happen is when you try to generate the key for the
> same account the second time, otrl_privkey_generate_start will return
> gcry_error(GPG_ERR_EEXIST), and *newkeyp is set to NULL.  Are you
> checking for this?  The second OTR query should not cause a launch of a
> background thread at all.
> 
> Or do you mean you received OTR Query messages for two _different_ local
> accounts?
> 
> 
> But more generally, libotr has no way of knowing what threading library
> your application is using, so your application may well need to call the
> gcry_control to enable multithreading.  Does the problem go away if you
> do that before calling OTRL_INIT?

FYI, for the irssi OTR plugin, I had to do that just before OTRL_INIT
for libgcrypt to use pthread.

	gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);

Cheers!
David

> 
>    - Ian
> _______________________________________________
> OTR-dev mailing list
> OTR-dev at lists.cypherpunks.ca
> http://lists.cypherpunks.ca/mailman/listinfo/otr-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: Digital signature
URL: <http://lists.cypherpunks.ca/pipermail/otr-dev/attachments/20131216/4fada833/attachment.pgp>


More information about the OTR-dev mailing list