summaryrefslogtreecommitdiff
path: root/cipher/elgamal.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2013-09-07 10:06:46 +0200
committerWerner Koch <wk@gnupg.org>2013-09-18 21:03:40 +0200
commit85722afb379f7a392a8117b895de273fd88c4ebc (patch)
tree41723f41081f114b43f37c2acc49a57cd988d5d6 /cipher/elgamal.c
parent89103ce00e862cc709e80fa41f2ee13d54093ec5 (diff)
downloadlibgcrypt-85722afb379f7a392a8117b895de273fd88c4ebc.tar.gz
pk: Simplify the public key dispatcher pubkey.c.
* src/cipher-proto.h (gcry_pk_spec_t): Add fields ALGO and FLAGS. * cipher/dsa.c (_gcry_pubkey_spec_dsa): Set these fields. * cipher/ecc.c (_gcry_pubkey_spec_ecdsa): Ditto. (_gcry_pubkey_spec_ecdh): Ditto. * cipher/rsa.c (_gcry_pubkey_spec_rsa): Ditto. * cipher/elgamal.c (_gcry_pubkey_spec_elg): Ditto (_gcry_pubkey_spec_elg_e): New. * cipher/pubkey.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. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'cipher/elgamal.c')
-rw-r--r--cipher/elgamal.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/cipher/elgamal.c b/cipher/elgamal.c
index 44990aae..65448e0a 100644
--- a/cipher/elgamal.c
+++ b/cipher/elgamal.c
@@ -840,9 +840,27 @@ static const char *elg_names[] =
gcry_pk_spec_t _gcry_pubkey_spec_elg =
{
+ GCRY_PK_ELG, { 0, 0 },
+ (GCRY_PK_USAGE_SIGN | GCRY_PK_USAGE_ENCR),
+ "ELG", elg_names,
+ "pgy", "pgyx", "ab", "rs", "pgy",
+ elg_generate,
+ elg_check_secret_key,
+ elg_encrypt,
+ elg_decrypt,
+ elg_sign,
+ elg_verify,
+ elg_get_nbits,
+ NULL,
+ elg_generate_ext
+ };
+
+gcry_pk_spec_t _gcry_pubkey_spec_elg_e =
+ {
+ GCRY_PK_ELG_E, { 0, 0 },
+ (GCRY_PK_USAGE_SIGN | GCRY_PK_USAGE_ENCR),
"ELG", elg_names,
"pgy", "pgyx", "ab", "rs", "pgy",
- GCRY_PK_USAGE_SIGN | GCRY_PK_USAGE_ENCR,
elg_generate,
elg_check_secret_key,
elg_encrypt,