mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-13 22:21:09 +02: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 ();
|
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.malloc = gcry_malloc;
|
||||||
malloc_hooks.realloc = gcry_realloc;
|
malloc_hooks.realloc = gcry_realloc;
|
||||||
malloc_hooks.free = gcry_free;
|
malloc_hooks.free = gcry_free;
|
||||||
|
@ -566,16 +566,9 @@ main (int argc, char **argv )
|
|||||||
i18n_init ();
|
i18n_init ();
|
||||||
init_common_subsystems (&argc, &argv);
|
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 ();
|
setup_libgcrypt_logging ();
|
||||||
gcry_control (GCRYCTL_INIT_SECMEM, 16384, 0);
|
gcry_control (GCRYCTL_INIT_SECMEM, 16384, 0);
|
||||||
|
|
||||||
|
|
||||||
pargs.argc = &argc;
|
pargs.argc = &argc;
|
||||||
pargs.argv = &argv;
|
pargs.argv = &argv;
|
||||||
pargs.flags= 1; /* (do not remove the args) */
|
pargs.flags= 1; /* (do not remove the args) */
|
||||||
|
@ -47,7 +47,9 @@
|
|||||||
# include <assuan.h> /* For _assuan_w32ce_finish_pipe. */
|
# include <assuan.h> /* For _assuan_w32ce_finish_pipe. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <gcrypt.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "i18n.h"
|
||||||
|
|
||||||
/* This object is used to register memory cleanup functions.
|
/* This object is used to register memory cleanup functions.
|
||||||
Technically they are not needed but they can avoid frequent
|
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);
|
atexit (sleep_on_exit);
|
||||||
#endif
|
#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. */
|
/* Initialize the Estream library. */
|
||||||
gpgrt_init ();
|
gpgrt_init ();
|
||||||
gpgrt_set_alloc_func (gcry_realloc);
|
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_CFLAGS = $(GPG_ERROR_CFLAGS) $(LIBGCRYPT_CFLAGS)
|
||||||
dirmngr_ldap_LDFLAGS =
|
dirmngr_ldap_LDFLAGS =
|
||||||
dirmngr_ldap_LDADD = $(libcommon) no-libgcrypt.o \
|
dirmngr_ldap_LDADD = $(libcommon) no-libgcrypt.o \
|
||||||
$(GPG_ERROR_LIBS) $(LDAPLIBS) $(LBER_LIBS) $(LIBINTL) \
|
$(GPG_ERROR_LIBS) $(LIBGCRYPT_LIBS) $(LDAPLIBS) \
|
||||||
$(LIBICONV)
|
$(LBER_LIBS) $(LIBINTL) $(LIBICONV)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
dirmngr_client_SOURCES = dirmngr-client.c
|
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
|
/* Check that the libraries are suitable. Do it here because
|
||||||
the option parsing may need services of the libraries. */
|
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) )
|
if (!ksba_check_version (NEED_KSBA_VERSION) )
|
||||||
log_fatal( _("%s is too old (need %s, have %s)\n"), "libksba",
|
log_fatal( _("%s is too old (need %s, have %s)\n"), "libksba",
|
||||||
NEED_KSBA_VERSION, ksba_check_version (NULL) );
|
NEED_KSBA_VERSION, ksba_check_version (NULL) );
|
||||||
|
@ -2201,14 +2201,6 @@ main (int argc, char **argv)
|
|||||||
i18n_init();
|
i18n_init();
|
||||||
init_common_subsystems (&argc, &argv);
|
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. */
|
/* Use our own logging handler for Libcgrypt. */
|
||||||
setup_libgcrypt_logging ();
|
setup_libgcrypt_logging ();
|
||||||
|
|
||||||
|
@ -155,11 +155,6 @@ main( int argc, char **argv )
|
|||||||
i18n_init();
|
i18n_init();
|
||||||
init_common_subsystems (&argc, &argv);
|
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);
|
gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
|
||||||
|
|
||||||
gnupg_init_signals (0, NULL);
|
gnupg_init_signals (0, NULL);
|
||||||
|
@ -250,11 +250,6 @@ main ( int argc, char **argv)
|
|||||||
i18n_init ();
|
i18n_init ();
|
||||||
init_common_subsystems (&argc, &argv);
|
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. */
|
/* Take extra care of the random pool. */
|
||||||
gcry_control (GCRYCTL_USE_SECURE_RNDPOOL);
|
gcry_control (GCRYCTL_USE_SECURE_RNDPOOL);
|
||||||
|
|
||||||
|
@ -372,11 +372,6 @@ main ( int argc, char **argv)
|
|||||||
|
|
||||||
npth_init ();
|
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. */
|
/* Take extra care of the random pool. */
|
||||||
gcry_control (GCRYCTL_USE_SECURE_RNDPOOL);
|
gcry_control (GCRYCTL_USE_SECURE_RNDPOOL);
|
||||||
|
|
||||||
|
@ -460,14 +460,6 @@ main( int argc, char **argv )
|
|||||||
i18n_init ();
|
i18n_init ();
|
||||||
init_common_subsystems (&argc, &argv);
|
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);
|
gcry_set_log_handler (my_gcry_logger, NULL);
|
||||||
|
|
||||||
/*create_dotlock(NULL); register locking cleanup */
|
/*create_dotlock(NULL); register locking cleanup */
|
||||||
|
@ -424,14 +424,6 @@ main (int argc, char **argv )
|
|||||||
|
|
||||||
npth_init ();
|
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);
|
ksba_set_malloc_hooks (gcry_malloc, gcry_realloc, gcry_free);
|
||||||
|
|
||||||
malloc_hooks.malloc = gcry_malloc;
|
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
|
/* Check that the libraries are suitable. Do it here because the
|
||||||
option parse may need services of the library */
|
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) )
|
if (!ksba_check_version (NEED_KSBA_VERSION) )
|
||||||
log_fatal (_("%s is too old (need %s, have %s)\n"), "libksba",
|
log_fatal (_("%s is too old (need %s, have %s)\n"), "libksba",
|
||||||
NEED_KSBA_VERSION, ksba_check_version (NULL) );
|
NEED_KSBA_VERSION, ksba_check_version (NULL) );
|
||||||
|
@ -171,13 +171,6 @@ main (int argc, char **argv )
|
|||||||
i18n_init ();
|
i18n_init ();
|
||||||
init_common_subsystems (&argc, &argv);
|
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 ();
|
setup_libgcrypt_logging ();
|
||||||
gcry_control (GCRYCTL_INIT_SECMEM, 4096, 0);
|
gcry_control (GCRYCTL_INIT_SECMEM, 4096, 0);
|
||||||
|
|
||||||
|
@ -998,11 +998,6 @@ main (int argc, char **argv)
|
|||||||
log_set_file (logfile);
|
log_set_file (logfile);
|
||||||
|
|
||||||
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
|
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 ();
|
setup_libgcrypt_logging ();
|
||||||
gcry_control (GCRYCTL_INIT_SECMEM, 16384, 0);
|
gcry_control (GCRYCTL_INIT_SECMEM, 16384, 0);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user