diff options
author | Werner Koch <wk@gnupg.org> | 2017-03-01 13:36:01 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2017-03-01 13:36:01 +0100 |
commit | 2bbdeb8ee87a6c7ec211be16391a11b7c6030bed (patch) | |
tree | b00d826be8111cd5ec1786bd88debf29b8867db6 /sm/certreqgen-ui.c | |
parent | speedo,w32: Install sks-keyservers.netCA.pem. (diff) | |
download | gnupg2-2bbdeb8ee87a6c7ec211be16391a11b7c6030bed.tar.xz gnupg2-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 <wk@gnupg.org>
Diffstat (limited to '')
-rw-r--r-- | sm/certreqgen-ui.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/sm/certreqgen-ui.c b/sm/certreqgen-ui.c index ece8668f6..b50d338ae 100644 --- a/sm/certreqgen-ui.c +++ b/sm/certreqgen-ui.c @@ -95,7 +95,7 @@ check_keygrip (ctrl_t ctrl, const char *hexgrip) gpg_error_t err; ksba_sexp_t public; size_t publiclen; - const char *algostr; + int algo; if (hexgrip[0] == '&') hexgrip++; @@ -105,21 +105,17 @@ check_keygrip (ctrl_t ctrl, const char *hexgrip) return NULL; 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); - if (!algostr) - return NULL; - else if (!strcmp (algostr, "rsa")) - return "RSA"; - else if (!strcmp (algostr, "dsa")) - return "DSA"; - else if (!strcmp (algostr, "elg")) - return "ELG"; - else if (!strcmp (algostr, "ecdsa")) - return "ECDSA"; - else - return NULL; + switch (algo) + { + case GCRY_PK_RSA: return "RSA"; + case GCRY_PK_DSA: return "DSA"; + case GCRY_PK_ELG: return "ELG"; + case GCRY_PK_EDDSA: return "ECDSA"; + default: return NULL; + } } |