summaryrefslogtreecommitdiff
path: root/src/global.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2011-12-01 13:55:06 +0100
committerWerner Koch <wk@gnupg.org>2011-12-01 13:59:38 +0100
commit5a1b2784cc1a718fd44d551b7ec018ef4614ce30 (patch)
tree94c27e5523a3ec115ed773a261b70a3f14a0bca8 /src/global.c
parent37810e520dba6fcb9da5a13bc6fdba9076cfe0f2 (diff)
downloadlibgcrypt-5a1b2784cc1a718fd44d551b7ec018ef4614ce30.tar.gz
Completed switch to a simpler thread model.
This is only a first step. We will need to either implement pthread_atfork or - better - make use use POSIX RT semaphores.
Diffstat (limited to 'src/global.c')
-rw-r--r--src/global.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/global.c b/src/global.c
index 93ff800c..36d6646d 100644
--- a/src/global.c
+++ b/src/global.c
@@ -104,16 +104,21 @@ global_init (void)
/* Initialize our portable thread/mutex wrapper. */
err = ath_init ();
if (err)
- goto fail;
+ {
+ err = gpg_error_from_errno (err);
+ goto fail;
+ }
/* See whether the system is in FIPS mode. This needs to come as
- early as possible put after the ATH has been initialized. */
+ early as possible but after ATH has been initialized. */
_gcry_initialize_fips_mode (force_fips_mode);
/* Before we do any other initialization we need to test available
hardware features. */
_gcry_detect_hw_features (disabled_hw_features);
+ /* Initialize the modules - this is mainly allocating some memory and
+ creating mutexes. */
err = _gcry_cipher_init ();
if (err)
goto fail;
@@ -123,6 +128,9 @@ global_init (void)
err = _gcry_pk_init ();
if (err)
goto fail;
+ err = _gcry_primegen_init ();
+ if (err)
+ goto fail;
return;
@@ -284,6 +292,7 @@ print_config ( int (*fnc)(FILE *fp, const char *format, ...), FILE *fp)
#endif
"\n");
fnc (fp, "mpi-asm:%s:\n", _gcry_mpi_get_hw_config ());
+ fnc (fp, "threads:%s:\n", ath_get_model (NULL));
hwf = _gcry_get_hw_features ();
fnc (fp, "hwflist:");
for (i=0; hwflist[i].desc; i++)
@@ -435,8 +444,8 @@ _gcry_vcontrol (enum gcry_ctl_cmds cmd, va_list arg_ptr)
break;
case GCRYCTL_SET_THREAD_CBS:
- err = ath_install (va_arg (arg_ptr, void *), any_init_done);
- if (! err)
+ err = ath_install (va_arg (arg_ptr, void *));
+ if (!err)
global_init ();
break;