From 3a1fa13eedb969b561bae18cd3d7c2fb0b63d6ab Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Sun, 9 Feb 2020 21:20:48 +0100 Subject: 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 --- common/util.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'common/util.h') 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 --*/ -- cgit v1.2.3