aboutsummaryrefslogtreecommitdiffstats
path: root/g10/keygen.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2017-03-01 12:36:01 +0000
committerWerner Koch <[email protected]>2017-03-01 12:36:01 +0000
commit2bbdeb8ee87a6c7ec211be16391a11b7c6030bed (patch)
treeb00d826be8111cd5ec1786bd88debf29b8867db6 /g10/keygen.c
parentspeedo,w32: Install sks-keyservers.netCA.pem. (diff)
downloadgnupg-2bbdeb8ee87a6c7ec211be16391a11b7c6030bed.tar.gz
gnupg-2bbdeb8ee87a6c7ec211be16391a11b7c6030bed.zip
gpg: Allow creating keys using an existing ECC key.
* common/sexputil.c (get_pk_algo_from_canon_sexp): Remove arg R_ALGO. Change to return the algo id. Reimplement using get_pk_algo_from_key. * g10/keygen.c (check_keygrip): Adjust for change. * sm/certreqgen-ui.c (check_keygrip): Ditto. -- GnuPG-bug-id: 2976 Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'g10/keygen.c')
-rw-r--r--g10/keygen.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/g10/keygen.c b/g10/keygen.c
index 226cabdad..24cf93cb1 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -1839,7 +1839,7 @@ check_keygrip (ctrl_t ctrl, const char *hexgrip)
gpg_error_t err;
unsigned char *public;
size_t publiclen;
- const char *algostr;
+ int algo;
if (hexgrip[0] == '&')
hexgrip++;
@@ -1849,26 +1849,10 @@ check_keygrip (ctrl_t ctrl, const char *hexgrip)
return 0;
publiclen = gcry_sexp_canon_len (public, 0, NULL, NULL);
- get_pk_algo_from_canon_sexp (public, publiclen, &algostr);
+ algo = get_pk_algo_from_canon_sexp (public, publiclen);
xfree (public);
- /* FIXME: Mapping of ECC algorithms is probably not correct. */
- if (!algostr)
- return 0;
- else if (!strcmp (algostr, "rsa"))
- return PUBKEY_ALGO_RSA;
- else if (!strcmp (algostr, "dsa"))
- return PUBKEY_ALGO_DSA;
- else if (!strcmp (algostr, "elg"))
- return PUBKEY_ALGO_ELGAMAL_E;
- else if (!strcmp (algostr, "ecc"))
- return PUBKEY_ALGO_ECDH;
- else if (!strcmp (algostr, "ecdsa"))
- return PUBKEY_ALGO_ECDSA;
- else if (!strcmp (algostr, "eddsa"))
- return PUBKEY_ALGO_EDDSA;
- else
- return 0;
+ return map_pk_gcry_to_openpgp (algo);
}