summaryrefslogtreecommitdiffstats
path: root/g10/cpr.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2014-01-31 15:33:03 +0100
committerWerner Koch <wk@gnupg.org>2014-01-31 15:33:03 +0100
commitbf50604a0d50b974c1d4b8ccf5d774489f996cae (patch)
tree98727debd304abd9e1eec56fe738200fc0053984 /g10/cpr.c
parentgpg: Use only OpenPGP cipher algo ids. (diff)
downloadgnupg2-bf50604a0d50b974c1d4b8ccf5d774489f996cae.tar.xz
gnupg2-bf50604a0d50b974c1d4b8ccf5d774489f996cae.zip
gpg: Start using OpenPGP digest algo ids.
* g10/misc.c (print_pubkey_algo_note): Use enum typedef for the arg. (print_cipher_algo_note): Ditto. (print_digest_algo_note): Ditto. (map_md_openpgp_to_gcry): New. (openpgp_md_test_algo): Rewrite. (openpgp_md_algo_name): Rewrite to do without Libgcrypt. * g10/cpr.c (write_status_begin_signing): Remove hardwired list of algo ranges.
Diffstat (limited to 'g10/cpr.c')
-rw-r--r--g10/cpr.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/g10/cpr.c b/g10/cpr.c
index 8d2262e27..99c8eecb0 100644
--- a/g10/cpr.c
+++ b/g10/cpr.c
@@ -307,24 +307,19 @@ write_status_begin_signing (gcry_md_hd_t md)
{
char buf[100];
size_t buflen;
- int i;
-
- /* We use a hard coded list of possible algorithms. Using other
- algorithms than specified by OpenPGP does not make sense
- anyway. We do this out of performance reasons: Walking all
- the 110 allowed Ids is not a good idea given the way the
- check is implemented in libgcrypt. Recall that the only use
- of this status code is to create the micalg algorithm for
- PGP/MIME. */
+ int i, ga;
+
buflen = 0;
- for (i=1; i <= 11; i++)
- if (i < 4 || i > 7)
- if (gcry_md_is_enabled (md, i) && buflen < DIM(buf))
+ for (i=1; i <= 110; i++)
+ {
+ ga = map_md_openpgp_to_gcry (i);
+ if (ga && gcry_md_is_enabled (md, ga) && buflen+10 < DIM(buf))
{
snprintf (buf+buflen, DIM(buf) - buflen - 1,
"%sH%d", buflen? " ":"",i);
buflen += strlen (buf+buflen);
}
+ }
write_status_text (STATUS_BEGIN_SIGNING, buf);
}
else