1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-02-01 16:33:02 +01:00

Fix printing of ECC algo names in hkp keyserver listings.

* g10/misc.c (map_pk_openpgp_to_gcry): New.
* g10/keyserver.c (print_keyrec): Map OpenPGP algorithm ids.
--

Although we don't have support for ECC, we want to print a proper
algorithm name in keyserver listings.  This will only work while using
a ECC enabled Libgcrypt.  Problem reported by Kristian Fiskerstrand.
This commit is contained in:
Werner Koch 2012-11-27 17:35:16 +01:00
parent ab4ea45f54
commit 978878b1be
3 changed files with 72 additions and 55 deletions

View File

@ -483,9 +483,10 @@ print_keyrec(int number,struct keyrec *keyrec)
if(keyrec->type)
{
const char *str = gcry_pk_algo_name (keyrec->type);
const char *str;
if(str)
str = gcry_pk_algo_name (map_pk_openpgp_to_gcry (keyrec->type));
if(str && strcmp (str, "?"))
printf("%s ",str);
else
printf("unknown ");

View File

@ -89,6 +89,7 @@ int map_cipher_openpgp_to_gcry (int algo);
int openpgp_cipher_blocklen (int algo);
int openpgp_cipher_test_algo( int algo );
const char *openpgp_cipher_algo_name (int algo);
int map_pk_openpgp_to_gcry (int algo);
int openpgp_pk_test_algo( int algo );
int openpgp_pk_test_algo2 ( int algo, unsigned int use );
int openpgp_pk_algo_usage ( int algo );

View File

@ -412,6 +412,21 @@ openpgp_cipher_algo_name (int algo)
return gcry_cipher_algo_name (map_cipher_openpgp_to_gcry (algo));
}
/* Map OpenPGP public key algorithm numbers to those used by
Libgcrypt. */
int
map_pk_openpgp_to_gcry (int algo)
{
switch (algo)
{
case PUBKEY_ALGO_ECDSA: return 301 /*GCRY_PK_ECDSA*/;
case PUBKEY_ALGO_ECDH: return 302 /*GCRY_PK_ECDH*/;
default: return algo;
}
}
int
openpgp_pk_test_algo( int algo )
{