* eet_lib: Prevent double init of gcry.

SVN revision: 39716
This commit is contained in:
Cedric BAIL 2009-03-25 16:26:46 +00:00
parent 749e8b1e74
commit c392637d27
1 changed files with 21 additions and 18 deletions

View File

@ -733,25 +733,28 @@ eet_init(void)
#ifdef HAVE_GNUTLS #ifdef HAVE_GNUTLS
if (gnutls_global_init()) if (gnutls_global_init())
return --eet_initcount; return --eet_initcount;
/* Before the library can be used, it must initialize itself. */ /* Before the library can be used, it must initialize itself if needed. */
gcry_check_version(NULL); if (gcry_control (GCRYCTL_ANY_INITIALIZATION_P) == 0)
/* Disable warning messages about problems with the secure memory subsystem.
This command should be run right after gcry_check_version. */
if (gcry_control(GCRYCTL_DISABLE_SECMEM_WARN))
{ {
gnutls_global_deinit(); gcry_check_version(NULL);
return --eet_initcount; /* Disable warning messages about problems with the secure memory subsystem.
} This command should be run right after gcry_check_version. */
/* This command is used to allocate a pool of secure memory and thus if (gcry_control(GCRYCTL_DISABLE_SECMEM_WARN))
enabling the use of secure memory. It also drops all extra privileges the {
process has (i.e. if it is run as setuid (root)). If the argument nbytes gnutls_global_deinit();
is 0, secure memory will be disabled. The minimum amount of secure memory return --eet_initcount;
allocated is currently 16384 bytes; you may thus use a value of 1 to }
request that default size. */ /* This command is used to allocate a pool of secure memory and thus
if (gcry_control(GCRYCTL_INIT_SECMEM, 16384, 0)) enabling the use of secure memory. It also drops all extra privileges the
{ process has (i.e. if it is run as setuid (root)). If the argument nbytes
gnutls_global_deinit(); is 0, secure memory will be disabled. The minimum amount of secure memory
return --eet_initcount; allocated is currently 16384 bytes; you may thus use a value of 1 to
request that default size. */
if (gcry_control(GCRYCTL_INIT_SECMEM, 16384, 0))
{
gnutls_global_deinit();
return --eet_initcount;
}
} }
#endif #endif
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL