summaryrefslogtreecommitdiffstats
path: root/g10/keygen.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2014-11-24 11:56:49 +0100
committerWerner Koch <wk@gnupg.org>2014-11-24 11:56:49 +0100
commitb716e6a69919b89c7887d6c7c9b97e58d18fdf95 (patch)
treee598bc1ed33ac109e4562d73528168a33dc438fe /g10/keygen.c
parentdoc: Update dirmngr.texi (diff)
downloadgnupg2-b716e6a69919b89c7887d6c7c9b97e58d18fdf95.tar.xz
gnupg2-b716e6a69919b89c7887d6c7c9b97e58d18fdf95.zip
gpg: Fix batch generation of ECC keys.
* g10/keygen.c (get_parameter_algo): Map ECC algorithm strings directly. -- Interactive generation of the keys uses the OpenPGP algorithms numbers but batch generation allows the use of strings. Reported-by: Gaetan Bisson. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/keygen.c')
-rw-r--r--g10/keygen.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/g10/keygen.c b/g10/keygen.c
index 2610af5ff..89cc255bc 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -2826,6 +2826,8 @@ get_parameter_algo( struct para_data_s *para, enum para_name key,
if (!r)
return -1;
+ /* Note that we need to handle the ECC algorithms specified as
+ strings directly because Libgcrypt folds them all to ECC. */
if (!ascii_strcasecmp (r->u.value, "default"))
{
/* Note: If you change this default algo, remember to change it
@@ -2839,6 +2841,12 @@ get_parameter_algo( struct para_data_s *para, enum para_name key,
else if (!strcmp (r->u.value, "ELG-E")
|| !strcmp (r->u.value, "ELG"))
i = PUBKEY_ALGO_ELGAMAL_E;
+ else if (!ascii_strcasecmp (r->u.value, "EdDSA"))
+ i = PUBKEY_ALGO_EDDSA;
+ else if (!ascii_strcasecmp (r->u.value, "ECDSA"))
+ i = PUBKEY_ALGO_ECDSA;
+ else if (!ascii_strcasecmp (r->u.value, "ECDH"))
+ i = PUBKEY_ALGO_ECDH;
else
i = map_pk_gcry_to_openpgp (gcry_pk_map_name (r->u.value));