From 3e67b50490aef087b5769bb35145d23f6657780f Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 1 Sep 2016 12:41:27 +0200 Subject: [PATCH] gpg: Copy the correct digest for use by TOFU. * g10/mainproc.c (do_check_sig): Use the current digest algo. -- Note that the digest context may have several algos enabled, which is is case if keys with different hash preferences signed the data. Signed-off-by: Werner Koch --- g10/mainproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/g10/mainproc.c b/g10/mainproc.c index 2626189a7..f861a3ea2 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -938,7 +938,7 @@ do_check_sig (CTX c, kbnode_t node, int *is_selfsig, if (md_good) { - unsigned char *buffer = gcry_md_read (md_good, 0); + unsigned char *buffer = gcry_md_read (md_good, sig->digest_algo); sig->digest_len = gcry_md_get_algo_dlen (map_md_openpgp_to_gcry (algo)); memcpy (sig->digest, buffer, sig->digest_len); }