summaryrefslogtreecommitdiff
path: root/cipher/salsa20.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2013-10-01 22:00:50 +0200
committerWerner Koch <wk@gnupg.org>2013-10-01 22:00:50 +0200
commit3ca180b25e8df252fc16f802cfdc27496e307830 (patch)
tree1399c7891aa6f4bf4bf994adaa078dadd3510091 /cipher/salsa20.c
parent4153fa859816e799e506055321a22e6450aacdcc (diff)
downloadlibgcrypt-3ca180b25e8df252fc16f802cfdc27496e307830.tar.gz
cipher: Simplify the cipher dispatcher cipher.c.
* src/gcrypt-module.h (gcry_cipher_spec_t): Move to ... * src/cipher-proto.h (gcry_cipher_spec_t): here. Merge with cipher_extra_spec_t. Add fields ALGO and FLAGS. Set these fields in all cipher modules. * cipher/cipher.c: Change most code to replace the former module system by a simpler system to gain information about the algorithms. (disable_pubkey_algo): Simplified. Not anymore thread-safe, though. * cipher/md.c (_gcry_md_selftest): Use correct structure. Not a real problem because both define the same function as their first field. * cipher/pubkey.c (_gcry_pk_selftest): Take care of the disabled flag. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'cipher/salsa20.c')
-rw-r--r--cipher/salsa20.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/cipher/salsa20.c b/cipher/salsa20.c
index 88f53725..6189bca9 100644
--- a/cipher/salsa20.c
+++ b/cipher/salsa20.c
@@ -373,6 +373,8 @@ selftest (void)
gcry_cipher_spec_t _gcry_cipher_spec_salsa20 =
{
+ GCRY_CIPHER_SALSA20,
+ {0, 0}, /* flags */
"SALSA20", /* name */
NULL, /* aliases */
NULL, /* oids */
@@ -383,11 +385,16 @@ gcry_cipher_spec_t _gcry_cipher_spec_salsa20 =
NULL,
NULL,
salsa20_encrypt_stream,
- salsa20_encrypt_stream
+ salsa20_encrypt_stream,
+ NULL,
+ NULL,
+ salsa20_setiv
};
gcry_cipher_spec_t _gcry_cipher_spec_salsa20r12 =
{
+ GCRY_CIPHER_SALSA20R12,
+ {0, 0}, /* flags */
"SALSA20R12", /* name */
NULL, /* aliases */
NULL, /* oids */
@@ -398,11 +405,7 @@ gcry_cipher_spec_t _gcry_cipher_spec_salsa20r12 =
NULL,
NULL,
salsa20r12_encrypt_stream,
- salsa20r12_encrypt_stream
- };
-
-cipher_extra_spec_t _gcry_cipher_extraspec_salsa20 =
- {
+ salsa20r12_encrypt_stream,
NULL,
NULL,
salsa20_setiv