summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2002-05-08 10:27:14 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2002-05-08 10:27:14 +0000
commit8669c9d61a73802fb14d44f9bb8f951b893de171 (patch)
treed6388f7e9581d3c4bd82bef7f9b8d2e20606210a
parent61a1d4f137866c13eec539b8f08a319f99fe51b8 (diff)
downloadgnutls-8669c9d61a73802fb14d44f9bb8f951b893de171.tar.gz
Updated libgcrypt initialization stuff. Now depends on libgcrypt 1.1.7, and only initializes libgcrypt if this has not been done before.
-rw-r--r--configure.in2
-rw-r--r--lib/gnutls_global.c15
2 files changed, 14 insertions, 3 deletions
diff --git a/configure.in b/configure.in
index 80fbf87524..28184fb0f9 100644
--- a/configure.in
+++ b/configure.in
@@ -198,7 +198,7 @@ AC_MSG_RESULT([***
*** Checking for external libraries...
])
-AM_PATH_LIBGCRYPT(1.1.5,,
+AM_PATH_LIBGCRYPT(1.1.7,,
AC_MSG_ERROR([[
***
*** libgcrypt was not found. You may want to get it from
diff --git a/lib/gnutls_global.c b/lib/gnutls_global.c
index 9e6bf7a008..4efab7fee0 100644
--- a/lib/gnutls_global.c
+++ b/lib/gnutls_global.c
@@ -80,6 +80,11 @@ static int _gnutls_init = 0;
* You must call gnutls_global_deinit() when gnutls usage is no longer needed
* Returns zero on success.
*
+ * Note that this function will also initialize libgcrypt, if it has not
+ * been initialized before. Thus if you want to manualy initialize libgcrypt
+ * you must do it before calling this function. (useful in cases you want
+ * to disable internal lockings etc.)
+ *
**/
int gnutls_global_init( void)
{
@@ -91,9 +96,15 @@ int gnutls_global_init( void)
return 0;
}
- /* for gcrypt in order to be able to allocate memory */
- gcry_set_allocation_handler(gnutls_malloc, gnutls_secure_malloc, _gnutls_is_secure_memory, gnutls_realloc, gnutls_free);
+ if (gcry_control( GCRYCTL_ANY_INITIALIZATION_P) == 0) {
+ /* for gcrypt in order to be able to allocate memory */
+ gcry_set_allocation_handler(gnutls_malloc, gnutls_secure_malloc, _gnutls_is_secure_memory, gnutls_realloc, gnutls_free);
+
+ /* gcry_control (GCRYCTL_DISABLE_INTERNAL_LOCKING, NULL, 0); */
+ gcry_control (GCRYCTL_INITIALIZATION_FINISHED, NULL,0);
+ }
+
/* set default recv/send functions
*/
gnutls_global_set_log_func( dlog);