mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
Cleanup initialization of libgcrypt.
* common/init.c (init_common_subsystems): Initialize libgcrypt. * dirmngr/Makefile.am (dirmngr_ldap): Link with libgcrypt. -- Most other modules already call gcry_check_version() after init_common_subsystems() so may as well move initialization of libgcrypt to here. Also fixes a warning in the system log from gpgconf --homedir. Signed-off-by: Ben Kibbey <bjk@luxsci.net>
This commit is contained in:
parent
ebf24e3b29
commit
49829c29e5
@ -764,14 +764,6 @@ main (int argc, char **argv )
|
||||
|
||||
npth_init ();
|
||||
|
||||
/* Check that the libraries are suitable. Do it here because
|
||||
the option parsing may need services of the library. */
|
||||
if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
|
||||
{
|
||||
log_fatal( _("%s is too old (need %s, have %s)\n"), "libgcrypt",
|
||||
NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) );
|
||||
}
|
||||
|
||||
malloc_hooks.malloc = gcry_malloc;
|
||||
malloc_hooks.realloc = gcry_realloc;
|
||||
malloc_hooks.free = gcry_free;
|
||||
|
@ -566,16 +566,9 @@ main (int argc, char **argv )
|
||||
i18n_init ();
|
||||
init_common_subsystems (&argc, &argv);
|
||||
|
||||
if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
|
||||
{
|
||||
log_fatal( _("%s is too old (need %s, have %s)\n"), "libgcrypt",
|
||||
NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) );
|
||||
}
|
||||
|
||||
setup_libgcrypt_logging ();
|
||||
gcry_control (GCRYCTL_INIT_SECMEM, 16384, 0);
|
||||
|
||||
|
||||
pargs.argc = &argc;
|
||||
pargs.argv = &argv;
|
||||
pargs.flags= 1; /* (do not remove the args) */
|
||||
|
@ -47,7 +47,9 @@
|
||||
# include <assuan.h> /* For _assuan_w32ce_finish_pipe. */
|
||||
#endif
|
||||
|
||||
#include <gcrypt.h>
|
||||
#include "util.h"
|
||||
#include "i18n.h"
|
||||
|
||||
/* This object is used to register memory cleanup functions.
|
||||
Technically they are not needed but they can avoid frequent
|
||||
@ -186,6 +188,12 @@ _init_common_subsystems (gpg_err_source_t errsource, int *argcp, char ***argvp)
|
||||
atexit (sleep_on_exit);
|
||||
#endif
|
||||
|
||||
if (!gcry_check_version (NEED_LIBGCRYPT_VERSION))
|
||||
{
|
||||
log_fatal (_("%s is too old (need %s, have %s)\n"), "libgcrypt",
|
||||
NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL));
|
||||
}
|
||||
|
||||
/* Initialize the Estream library. */
|
||||
gpgrt_init ();
|
||||
gpgrt_set_alloc_func (gcry_realloc);
|
||||
|
@ -94,8 +94,8 @@ dirmngr_ldap_SOURCES = dirmngr_ldap.c $(ldap_url)
|
||||
dirmngr_ldap_CFLAGS = $(GPG_ERROR_CFLAGS) $(LIBGCRYPT_CFLAGS)
|
||||
dirmngr_ldap_LDFLAGS =
|
||||
dirmngr_ldap_LDADD = $(libcommon) no-libgcrypt.o \
|
||||
$(GPG_ERROR_LIBS) $(LDAPLIBS) $(LBER_LIBS) $(LIBINTL) \
|
||||
$(LIBICONV)
|
||||
$(GPG_ERROR_LIBS) $(LIBGCRYPT_LIBS) $(LDAPLIBS) \
|
||||
$(LBER_LIBS) $(LIBINTL) $(LIBICONV)
|
||||
endif
|
||||
|
||||
dirmngr_client_SOURCES = dirmngr-client.c
|
||||
|
@ -755,10 +755,6 @@ main (int argc, char **argv)
|
||||
|
||||
/* Check that the libraries are suitable. Do it here because
|
||||
the option parsing may need services of the libraries. */
|
||||
|
||||
if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
|
||||
log_fatal (_("%s is too old (need %s, have %s)\n"), "libgcrypt",
|
||||
NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) );
|
||||
if (!ksba_check_version (NEED_KSBA_VERSION) )
|
||||
log_fatal( _("%s is too old (need %s, have %s)\n"), "libksba",
|
||||
NEED_KSBA_VERSION, ksba_check_version (NULL) );
|
||||
|
@ -2201,14 +2201,6 @@ main (int argc, char **argv)
|
||||
i18n_init();
|
||||
init_common_subsystems (&argc, &argv);
|
||||
|
||||
/* Check that the libraries are suitable. Do it right here because the
|
||||
option parsing may need services of the library. */
|
||||
if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
|
||||
{
|
||||
log_fatal ( _("libgcrypt is too old (need %s, have %s)\n"),
|
||||
NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) );
|
||||
}
|
||||
|
||||
/* Use our own logging handler for Libcgrypt. */
|
||||
setup_libgcrypt_logging ();
|
||||
|
||||
|
@ -155,11 +155,6 @@ main( int argc, char **argv )
|
||||
i18n_init();
|
||||
init_common_subsystems (&argc, &argv);
|
||||
|
||||
if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
|
||||
{
|
||||
log_fatal ( _("%s is too old (need %s, have %s)\n"), "libgcrypt",
|
||||
NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) );
|
||||
}
|
||||
gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
|
||||
|
||||
gnupg_init_signals (0, NULL);
|
||||
|
@ -250,11 +250,6 @@ main ( int argc, char **argv)
|
||||
i18n_init ();
|
||||
init_common_subsystems (&argc, &argv);
|
||||
|
||||
/* Check that the Libgcrypt is suitable. */
|
||||
if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
|
||||
log_fatal (_("%s is too old (need %s, have %s)\n"), "libgcrypt",
|
||||
NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) );
|
||||
|
||||
/* Take extra care of the random pool. */
|
||||
gcry_control (GCRYCTL_USE_SECURE_RNDPOOL);
|
||||
|
||||
|
@ -372,11 +372,6 @@ main ( int argc, char **argv)
|
||||
|
||||
npth_init ();
|
||||
|
||||
/* Check that the Libgcrypt is suitable. */
|
||||
if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
|
||||
log_fatal (_("%s is too old (need %s, have %s)\n"), "libgcrypt",
|
||||
NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) );
|
||||
|
||||
/* Take extra care of the random pool. */
|
||||
gcry_control (GCRYCTL_USE_SECURE_RNDPOOL);
|
||||
|
||||
|
@ -460,14 +460,6 @@ main( int argc, char **argv )
|
||||
i18n_init ();
|
||||
init_common_subsystems (&argc, &argv);
|
||||
|
||||
/* Check that the libraries are suitable. Do it here because
|
||||
the option parsing may need services of the library. */
|
||||
if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
|
||||
{
|
||||
log_fatal (_("%s is too old (need %s, have %s)\n"), "libgcrypt",
|
||||
NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) );
|
||||
}
|
||||
|
||||
gcry_set_log_handler (my_gcry_logger, NULL);
|
||||
|
||||
/*create_dotlock(NULL); register locking cleanup */
|
||||
|
@ -424,14 +424,6 @@ main (int argc, char **argv )
|
||||
|
||||
npth_init ();
|
||||
|
||||
/* Check that the libraries are suitable. Do it here because
|
||||
the option parsing may need services of the library */
|
||||
if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
|
||||
{
|
||||
log_fatal (_("%s is too old (need %s, have %s)\n"), "libgcrypt",
|
||||
NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) );
|
||||
}
|
||||
|
||||
ksba_set_malloc_hooks (gcry_malloc, gcry_realloc, gcry_free);
|
||||
|
||||
malloc_hooks.malloc = gcry_malloc;
|
||||
|
@ -938,9 +938,6 @@ main ( int argc, char **argv)
|
||||
|
||||
/* Check that the libraries are suitable. Do it here because the
|
||||
option parse may need services of the library */
|
||||
if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
|
||||
log_fatal (_("%s is too old (need %s, have %s)\n"), "libgcrypt",
|
||||
NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) );
|
||||
if (!ksba_check_version (NEED_KSBA_VERSION) )
|
||||
log_fatal (_("%s is too old (need %s, have %s)\n"), "libksba",
|
||||
NEED_KSBA_VERSION, ksba_check_version (NULL) );
|
||||
|
@ -171,13 +171,6 @@ main (int argc, char **argv )
|
||||
i18n_init ();
|
||||
init_common_subsystems (&argc, &argv);
|
||||
|
||||
/* We need Libgcrypt for hashing. */
|
||||
if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
|
||||
{
|
||||
log_fatal ( _("%s is too old (need %s, have %s)\n"), "libgcrypt",
|
||||
NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) );
|
||||
}
|
||||
|
||||
setup_libgcrypt_logging ();
|
||||
gcry_control (GCRYCTL_INIT_SECMEM, 4096, 0);
|
||||
|
||||
|
@ -998,11 +998,6 @@ main (int argc, char **argv)
|
||||
log_set_file (logfile);
|
||||
|
||||
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
|
||||
if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) )
|
||||
{
|
||||
log_fatal (_("%s is too old (need %s, have %s)\n"), "libgcrypt",
|
||||
NEED_LIBGCRYPT_VERSION, gcry_check_version (NULL) );
|
||||
}
|
||||
setup_libgcrypt_logging ();
|
||||
gcry_control (GCRYCTL_INIT_SECMEM, 16384, 0);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user