diff options
author | Werner Koch <wk@gnupg.org> | 2011-09-15 18:08:55 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2011-09-15 18:08:55 +0200 |
commit | e0fe4a5c862a1646066044dfe8e99264e2331752 (patch) | |
tree | 1cf303ee9980a49105c2178096d150affcc138ba /cipher | |
parent | fc9eec3626fcb9a3d4043d779462c4fc39cd51ae (diff) | |
download | libgcrypt-e0fe4a5c862a1646066044dfe8e99264e2331752.tar.gz |
Removed the module registration interface
The module registration interface is not widely used but complicates
the internal operation of Libgcrypt a lot. It also does not allow for
efficient implementation of new algorithm or cipher modes. Further the
required locking of all access to internal module data or functions
would make it hard to come up with a deadlock free pthread_atfork
implementation. Thus we remove the entire subsystem.
Note that the module system is still used internally but it is now
possible to change it without breaking the ABI.
In case a feature to add more algorithms demanded in the future, we
may add one by dlopening modules at startup time from a dedicated
directory.
Diffstat (limited to 'cipher')
-rw-r--r-- | cipher/ChangeLog | 6 | ||||
-rw-r--r-- | cipher/cipher.c | 20 | ||||
-rw-r--r-- | cipher/md.c | 29 | ||||
-rw-r--r-- | cipher/pubkey.c | 20 |
4 files changed, 8 insertions, 67 deletions
diff --git a/cipher/ChangeLog b/cipher/ChangeLog index a885443f..0bbbbb4d 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,5 +1,11 @@ 2011-09-15 Werner Koch <wk@g10code.com> + * pubkey.c (gcry_pk_list): Remove. + (gcry_pk_unregister): Remove. + * md.c (gcry_md_list): Remove. + (gcry_md_unregister): Remove. + * cipher.c (gcry_cipher_list): Remove. + (gcry_cipher_unregister): Remove. * ac.c: Remove. 2011-06-29 Werner Koch <wk@g10code.com> diff --git a/cipher/cipher.c b/cipher/cipher.c index b99ab41b..3b6e9d52 100644 --- a/cipher/cipher.c +++ b/cipher/cipher.c @@ -418,7 +418,7 @@ _gcry_cipher_register (gcry_cipher_spec_t *cipher, /* Unregister the cipher identified by MODULE, which must have been registered with gcry_cipher_register. */ void -gcry_cipher_unregister (gcry_module_t module) +_gcry_cipher_unregister (gcry_module_t module) { ath_mutex_lock (&ciphers_registered_lock); _gcry_module_release (module); @@ -2156,24 +2156,6 @@ _gcry_cipher_init (void) return err; } -/* Get a list consisting of the IDs of the loaded cipher modules. If - LIST is zero, write the number of loaded cipher modules to - LIST_LENGTH and return. If LIST is non-zero, the first - *LIST_LENGTH algorithm IDs are stored in LIST, which must be of - according size. In case there are less cipher modules than - *LIST_LENGTH, *LIST_LENGTH is updated to the correct number. */ -gcry_error_t -gcry_cipher_list (int *list, int *list_length) -{ - gcry_err_code_t err = GPG_ERR_NO_ERROR; - - ath_mutex_lock (&ciphers_registered_lock); - err = _gcry_module_list (ciphers_registered, list, list_length); - ath_mutex_unlock (&ciphers_registered_lock); - - return err; -} - /* Run the selftests for cipher algorithm ALGO with optional reporting function REPORT. */ diff --git a/cipher/md.c b/cipher/md.c index c3b3a4f3..5ae9aee2 100644 --- a/cipher/md.c +++ b/cipher/md.c @@ -285,16 +285,6 @@ _gcry_md_register (gcry_md_spec_t *digest, return gcry_error (err); } -/* Unregister the digest identified by ID, which must have been - registered with gcry_digest_register. */ -void -gcry_md_unregister (gcry_module_t module) -{ - ath_mutex_lock (&digests_registered_lock); - _gcry_module_release (module); - ath_mutex_unlock (&digests_registered_lock); -} - static int search_oid (const char *oid, int *algorithm, gcry_md_oid_spec_t *oid_spec) @@ -1325,25 +1315,6 @@ gcry_md_is_enabled (gcry_md_hd_t a, int algo) return value; } -/* Get a list consisting of the IDs of the loaded message digest - modules. If LIST is zero, write the number of loaded message - digest modules to LIST_LENGTH and return. If LIST is non-zero, the - first *LIST_LENGTH algorithm IDs are stored in LIST, which must be - of according size. In case there are less message digest modules - than *LIST_LENGTH, *LIST_LENGTH is updated to the correct - number. */ -gcry_error_t -gcry_md_list (int *list, int *list_length) -{ - gcry_err_code_t err = GPG_ERR_NO_ERROR; - - ath_mutex_lock (&digests_registered_lock); - err = _gcry_module_list (digests_registered, list, list_length); - ath_mutex_unlock (&digests_registered_lock); - - return err; -} - /* Run the selftests for digest algorithm ALGO with optional reporting function REPORT. */ diff --git a/cipher/pubkey.c b/cipher/pubkey.c index 91098214..afb14c99 100644 --- a/cipher/pubkey.c +++ b/cipher/pubkey.c @@ -288,7 +288,7 @@ _gcry_pk_register (gcry_pk_spec_t *pubkey, /* Unregister the pubkey identified by ID, which must have been registered with gcry_pk_register. */ void -gcry_pk_unregister (gcry_module_t module) +_gcry_pk_unregister (gcry_module_t module) { ath_mutex_lock (&pubkeys_registered_lock); _gcry_module_release (module); @@ -4092,24 +4092,6 @@ _gcry_pk_module_release (gcry_module_t module) ath_mutex_unlock (&pubkeys_registered_lock); } -/* Get a list consisting of the IDs of the loaded pubkey modules. If - LIST is zero, write the number of loaded pubkey modules to - LIST_LENGTH and return. If LIST is non-zero, the first - *LIST_LENGTH algorithm IDs are stored in LIST, which must be of - according size. In case there are less pubkey modules than - *LIST_LENGTH, *LIST_LENGTH is updated to the correct number. */ -gcry_error_t -gcry_pk_list (int *list, int *list_length) -{ - gcry_err_code_t err = GPG_ERR_NO_ERROR; - - ath_mutex_lock (&pubkeys_registered_lock); - err = _gcry_module_list (pubkeys_registered, list, list_length); - ath_mutex_unlock (&pubkeys_registered_lock); - - return err; -} - /* Run the selftests for pubkey algorithm ALGO with optional reporting function REPORT. */ |