From 5a1b2784cc1a718fd44d551b7ec018ef4614ce30 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 1 Dec 2011 13:55:06 +0100 Subject: 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. --- cipher/cipher.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'cipher/cipher.c') 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; -- cgit v1.2.1