diff options
author | Werner Koch <[email protected]> | 2019-04-02 16:49:51 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2019-04-02 16:50:55 +0000 |
commit | f952226043824cbbeb8517126b5266926121c4e8 (patch) | |
tree | 95aea53ba69ad90ed40458dcc027a5cdcc48619d /common/sexputil.c | |
parent | dirmngr: Improve domaininfo cache update algorithm. (diff) | |
download | gnupg-f952226043824cbbeb8517126b5266926121c4e8.tar.gz gnupg-f952226043824cbbeb8517126b5266926121c4e8.zip |
common: Extend function pubkey_algo_string.
* common/sexputil.c (pubkey_algo_string): Add arg R_ALGOID.
* sm/certreqgen-ui.c (gpgsm_gencertreq_tty): Adjust.
* tools/gpg-card.c (list_one_kinfo): Ditto.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'common/sexputil.c')
-rw-r--r-- | common/sexputil.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/common/sexputil.c b/common/sexputil.c index d3020e169..f99bc3b18 100644 --- a/common/sexputil.c +++ b/common/sexputil.c @@ -581,9 +581,9 @@ get_pk_algo_from_canon_sexp (const unsigned char *keydata, size_t keydatalen) /* Given the public key S_PKEY, return a new buffer with a descriptive * string for its algorithm. This function may return NULL on memory - * error. */ + * error. If R_ALGOID is not NULL the gcrypt algo id is stored there. */ char * -pubkey_algo_string (gcry_sexp_t s_pkey) +pubkey_algo_string (gcry_sexp_t s_pkey, enum gcry_pk_algos *r_algoid) { const char *prefix; gcry_sexp_t l1; @@ -591,6 +591,9 @@ pubkey_algo_string (gcry_sexp_t s_pkey) int algo; char *result; + if (r_algoid) + *r_algoid = 0; + l1 = gcry_sexp_find_token (s_pkey, "public-key", 0); if (!l1) return xtrystrdup ("E_no_key"); @@ -632,6 +635,8 @@ pubkey_algo_string (gcry_sexp_t s_pkey) else result = xtryasprintf ("X_algo_%d", algo); + if (r_algoid) + *r_algoid = algo; xfree (algoname); return result; } |