aboutsummaryrefslogtreecommitdiffstats
path: root/agent/pksign.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2020-06-05 00:05:05 +0000
committerNIIBE Yutaka <[email protected]>2020-06-05 00:05:05 +0000
commit4c0b12f817f15862111a01493aaadce943410ee9 (patch)
treee260403652cec83a978641796ffb0bfc5e18e7cc /agent/pksign.c
parentdoc: Minor enhancement for reproducibility. (diff)
downloadgnupg-4c0b12f817f15862111a01493aaadce943410ee9.tar.gz
gnupg-4c0b12f817f15862111a01493aaadce943410ee9.zip
agent: Clean up do_encode_md.
* agent/pksign.c (do_encode_md): Directly use sexp_build. Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'agent/pksign.c')
-rw-r--r--agent/pksign.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/agent/pksign.c b/agent/pksign.c
index 76b0c3f85..6993599f9 100644
--- a/agent/pksign.c
+++ b/agent/pksign.c
@@ -62,19 +62,9 @@ do_encode_md (const byte * md, size_t mdlen, int algo, gcry_sexp_t * r_hash,
}
else
{
- gcry_mpi_t mpi;
-
- rc = gcry_mpi_scan (&mpi, GCRYMPI_FMT_USG, md, mdlen, NULL);
- if (!rc)
- {
- rc = gcry_sexp_build (&hash, NULL,
- "(data (flags raw) (value %m))",
- mpi);
- gcry_mpi_release (mpi);
- }
- else
- hash = NULL;
-
+ rc = gcry_sexp_build (&hash, NULL,
+ "(data (flags raw) (value %b))",
+ (int)mdlen, md);
}
*r_hash = hash;