diff options
author | Werner Koch <[email protected]> | 2014-01-31 14:55:04 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2014-01-31 14:55:04 +0000 |
commit | 71540d40414dc8b304b45dc476e5e5650a2db20a (patch) | |
tree | fa5576405e60748ac4e168d3248fa5499c0d7158 /g10/gpg.c | |
parent | gpg: Start using OpenPGP digest algo ids. (diff) | |
download | gnupg-71540d40414dc8b304b45dc476e5e5650a2db20a.tar.gz gnupg-71540d40414dc8b304b45dc476e5e5650a2db20a.zip |
gpg: Improve --version algo info output.
* g10/misc.c (openpgp_pk_algo_name): Return a different string for
each ECC algorithm.
* g10/gpg.c (build_list_pk_test_algo): New wrapper to cope with the
different algo type enums.
(build_list_pk_algo_name): Ditto.
(build_list_cipher_test_algo): Ditto.
(build_list_cipher_algo_name): Ditto.
(build_list_md_test_algo): Ditto.
(build_list_md_algo_name): Ditto.
(my_strusage): Use them.
(list_config): Ditto. Add "pubkeyname".
(build_list): Add letter==1 hack.
Diffstat (limited to 'g10/gpg.c')
-rw-r--r-- | g10/gpg.c | 77 |
1 files changed, 64 insertions, 13 deletions
@@ -811,6 +811,43 @@ make_libversion (const char *libname, const char *(*getfnc)(const char*)) } +static int +build_list_pk_test_algo (int algo) +{ + return openpgp_pk_test_algo (algo); +} + +static const char * +build_list_pk_algo_name (int algo) +{ + return openpgp_pk_algo_name (algo); +} + +static int +build_list_cipher_test_algo (int algo) +{ + return openpgp_cipher_test_algo (algo); +} + +static const char * +build_list_cipher_algo_name (int algo) +{ + return openpgp_cipher_algo_name (algo); +} + +static int +build_list_md_test_algo (int algo) +{ + return openpgp_md_test_algo (algo); +} + +static const char * +build_list_md_algo_name (int algo) +{ + return openpgp_md_algo_name (algo); +} + + static const char * my_strusage( int level ) { @@ -861,23 +898,23 @@ my_strusage( int level ) case 33: p = _("\nSupported algorithms:\n"); break; case 34: if (!pubkeys) - pubkeys = build_list (_("Pubkey: "), 0, - openpgp_pk_algo_name, - openpgp_pk_test_algo ); + pubkeys = build_list (_("Pubkey: "), 1, + build_list_pk_algo_name, + build_list_pk_test_algo ); p = pubkeys; break; case 35: if( !ciphers ) ciphers = build_list(_("Cipher: "), 'S', - openpgp_cipher_algo_name, - openpgp_cipher_test_algo ); + build_list_cipher_algo_name, + build_list_cipher_test_algo ); p = ciphers; break; case 36: if( !digests ) digests = build_list(_("Hash: "), 'H', - gcry_md_algo_name, - openpgp_md_test_algo ); + build_list_md_algo_name, + build_list_md_test_algo ); p = digests; break; case 37: @@ -931,7 +968,10 @@ build_list (const char *text, char letter, if (opt.verbose && letter) { char num[20]; - snprintf (num, sizeof num, " (%c%d)", letter, i); + if (letter == 1) + snprintf (num, sizeof num, " (%d)", i); + else + snprintf (num, sizeof num, " (%c%d)", letter, i); put_membuf_str (&mb, num); } } @@ -1533,7 +1573,16 @@ list_config(char *items) if(show_all || ascii_strcasecmp(name,"pubkey")==0) { es_printf ("cfg:pubkey:"); - print_algo_numbers (openpgp_pk_test_algo); + print_algo_numbers (build_list_pk_test_algo); + es_printf ("\n"); + any=1; + } + + if(show_all || ascii_strcasecmp(name,"pubkeyname")==0) + { + es_printf ("cfg:pubkeyname:"); + print_algo_names (build_list_pk_test_algo, + build_list_pk_algo_name); es_printf ("\n"); any=1; } @@ -1541,7 +1590,7 @@ list_config(char *items) if(show_all || ascii_strcasecmp(name,"cipher")==0) { es_printf ("cfg:cipher:"); - print_algo_numbers(openpgp_cipher_test_algo); + print_algo_numbers (build_list_cipher_test_algo); es_printf ("\n"); any=1; } @@ -1549,7 +1598,8 @@ list_config(char *items) if (show_all || !ascii_strcasecmp (name,"ciphername")) { es_printf ("cfg:ciphername:"); - print_algo_names (openpgp_cipher_test_algo,openpgp_cipher_algo_name); + print_algo_names (build_list_cipher_test_algo, + build_list_cipher_algo_name); es_printf ("\n"); any = 1; } @@ -1559,7 +1609,7 @@ list_config(char *items) || ascii_strcasecmp(name,"hash")==0) { es_printf ("cfg:digest:"); - print_algo_numbers(openpgp_md_test_algo); + print_algo_numbers (build_list_md_test_algo); es_printf ("\n"); any=1; } @@ -1569,7 +1619,8 @@ list_config(char *items) || !ascii_strcasecmp(name,"hashname")) { es_printf ("cfg:digestname:"); - print_algo_names (openpgp_md_test_algo, gcry_md_algo_name); + print_algo_names (build_list_md_test_algo, + build_list_md_algo_name); es_printf ("\n"); any=1; } |