From 4c0b12f817f15862111a01493aaadce943410ee9 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Fri, 5 Jun 2020 09:05:05 +0900 Subject: [PATCH] agent: Clean up do_encode_md. * agent/pksign.c (do_encode_md): Directly use sexp_build. Signed-off-by: NIIBE Yutaka --- agent/pksign.c | 16 +++------------- 1 file 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;