[gnutls-help] Assertion failure and access violation error in gnutls

Wolfgang Mühlbauer wolfgangmuehlbauer at gmx.de
Thu Mar 7 12:01:07 CET 2013


 <snigdhamukherjee <at> bel.co.in> writes:

> 
> Hello,
> 
> I am writing a proxy code for windows based clients. The browser connects
...

> int main()
> {
> .
> .
> .
> .
> 
> 	if(!g_thread_supported())
> 		g_thread_init (NULL);
> 
> 	gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_gthreads_cbs);
> 
> 	gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
> 	gcry_control (GCRYCTL_INIT_SECMEM, 16384, 0);
> 	gcry_control (GCRYCTL_RESUME_SECMEM_WARN);
> 	gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
> 
> 	gnutls_global_init ();
> 
...

> 2. The second problem I am facing is "access violation reading location"
> in gnutls_handshake(). Sometimes during handshake the debugger stops and
> tells unhandeled exception in clientproxy.exe; access violation reading
> location 0x..... I have no idea how to resolve this. So, please can
> someone help??
> 
> Thanks,
> Snigdha
> 
> Confidentiality Notice
> 
> The information contained in this electronic message and any 
> attachments to this message are intended for the exclusive use of
> the addressee(s) and may contain confidential or privileged 
> information. If you are not the intended recipient, please notify
> the sender at Bharat Electronics  or support <at> bel.co.in immediately
> and destroy all copies of this message and any attachments.
> 




Hello!

Make sure your first call to libcrypt is

gcry_control(GCRYCTL_SET_THREAD_CBS,...)

http://www.gnupg.org/documentation/manuals/gcrypt/Multi_002dThreading.html

"If your application is multi-threaded, you must set the thread support
callbacks with the GCRYCTL_SET_THREAD_CBS command before any other function in
the library. "

Even before g_thread_supported() and gcry_check_version (GCRYPT_VERSION),
or gcry_control(GCRYCTL_SET_THREAD_CBS,...)
will return an error and your callbacks for mutex_lock/mutex_unlock
won't be called.

After i have added gcry_check_version() before
gcry_control(GCRYCTL_SET_THREAD_CBS), my callbacks for
mutex locking / unlocking have not been called any longer...

gnuTLS 2.6 / libcrypt 11

I'm handling the handshake procedure for one connection 
only in one thread, no context switching. 
This is the thread the CSocket was created / attached.


Wolfgang







More information about the Gnutls-help mailing list