summaryrefslogtreecommitdiff
path: root/cipher/cipher.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 /cipher/cipher.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 'cipher/cipher.c')
-rw-r--r--cipher/cipher.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/cipher/cipher.c b/cipher/cipher.c
index 9bef3329..589c262b 100644
--- a/cipher/cipher.c
+++ b/cipher/cipher.c
@@ -106,8 +106,9 @@ static struct cipher_table_entry
/* List of registered ciphers. */
static gcry_module_t ciphers_registered;
-/* This is the lock protecting CIPHERS_REGISTERED. */
-static ath_mutex_t ciphers_registered_lock = ATH_MUTEX_INITIALIZER;
+/* This is the lock protecting CIPHERS_REGISTERED. It is initialized
+ by _gcry_cipher_init. */
+static ath_mutex_t ciphers_registered_lock;
/* Flag to check whether the default ciphers have already been
registered. */
@@ -1353,7 +1354,11 @@ gcry_cipher_get_algo_blklen (int algo)
gcry_err_code_t
_gcry_cipher_init (void)
{
- gcry_err_code_t err = GPG_ERR_NO_ERROR;
+ gcry_err_code_t err;
+
+ err = ath_mutex_init (&ciphers_registered_lock);
+ if (err)
+ return gpg_err_code_from_errno (err);
REGISTER_DEFAULT_CIPHERS;