Assertion failure and access violation error in gnutls
snigdhamukherjee at bel.co.in
snigdhamukherjee at bel.co.in
Tue Feb 1 08:59:42 CET 2011
Hello,
I am writing a proxy code for windows based clients. The browser connects
to the HTTP proxy via localhost and port. The proxy initiates the tls
session between the client proxy and backend server. The handshake happens
between the client proxy and backend server and encrypted data flows. The
browser only receives and sends non-encrypted data to and from client
proxy.
The client proxy uses libgnutls for tls functionality which internally
uses libgcrypt.
Gnutls version: 2.10.1
libgcrypt version: 1.4.5
In this I am getting the following problems:
1. Assertion failed in file ath.c line 193. Expression: *lock==MUTEX_Unlocked
I searched the internet and forums for this error and it seems I have to
initialize threading in libgcrypt before gnutls_global_init(). So, I added
the following
#include <stdlib.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#include <gcrypt.h>
#include <glib.h>
GMutex *mutex;
static int gthread_mutex_init(void **priv)
{
*priv = g_mutex_new();
return 0;
}
static int gthread_mutex_destroy(void **priv)
{
g_mutex_free((GMutex *) (*priv));
return 0;
}
static int gthread_mutex_lock(void **priv)
{
g_mutex_lock((GMutex *) (*priv));
return 0;
}
static int gthread_mutex_unlock(void **priv)
{
g_mutex_unlock((GMutex *) (*priv));
return 0;
}
static const struct gcry_thread_cbs gcry_gthreads_cbs = {
GCRY_THREAD_OPTION_USER,
NULL,
gthread_mutex_init,
gthread_mutex_destroy,
gthread_mutex_lock,
gthread_mutex_unlock
};
.
.
.
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 ();
.
.
.
}
The library used for threading is glib. But this also has not resolved the
problem. Am i doing something wrong during initialization?
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.
More information about the Gnutls-help
mailing list