diff options
author | Werner Koch <[email protected]> | 2020-02-09 20:20:48 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2020-02-09 20:26:35 +0000 |
commit | 3a1fa13eedb969b561bae18cd3d7c2fb0b63d6ab (patch) | |
tree | 704e4441d3a713a82dd587e94c6874cd1615f87e /common/util.h | |
parent | common: Add OpenPGP<->Gcrypt pubkey id mapping functions. (diff) | |
download | gnupg-3a1fa13eedb969b561bae18cd3d7c2fb0b63d6ab.tar.gz gnupg-3a1fa13eedb969b561bae18cd3d7c2fb0b63d6ab.zip |
common: New function get_keyalgo_string.
* common/openpgp-oid.c (struct keyalgo_string_s): New.
(keyalgo_strings): New.
(keyalgo_strings_size, keyalgo_strings_used): New.
(get_keyalgo_string): New.
--
This function is intended as a more general version of gpg's
pubkey_string function. It has the advantage to avoid mallocs and
uses static table of algorithm strings instead. There should be only
a few dozen of such strings (if at all) and thus all those allocations
we do internally in gpg's pubkey_string and the static buffers all
over the place are not too nice.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'common/util.h')
-rw-r--r-- | common/util.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/common/util.h b/common/util.h index fc869800a..9d73412c3 100644 --- a/common/util.h +++ b/common/util.h @@ -235,6 +235,8 @@ const char *openpgp_oid_to_curve (const char *oid, int canon); const char *openpgp_enum_curves (int *idxp); const char *openpgp_is_curve_supported (const char *name, int *r_algo, unsigned int *r_nbits); +const char *get_keyalgo_string (enum gcry_pk_algos algo, + unsigned int nbits, const char *curve); /*-- homedir.c --*/ |