]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Updated libgcrypt initialization stuff. Now depends on libgcrypt 1.1.7, and only...
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 8 May 2002 10:27:14 +0000 (10:27 +0000)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 8 May 2002 10:27:14 +0000 (10:27 +0000)
configure.in
lib/gnutls_global.c

index 80fbf87524f3adfb7fc0911388b534b382479c61..28184fb0f92d4f2659f339ffffa2e6d9ee6fb78a 100644 (file)
@@ -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
index 9e6bf7a008a2d9b7048560aa763e5e0b6ecb2de1..4efab7fee03723c5f56c0f386577efb697fa4781 100644 (file)
@@ -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);