aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2020-05-19 02:35:52 +0000
committerNIIBE Yutaka <[email protected]>2020-05-19 02:35:52 +0000
commit0691234951df5ac1bae417a6034c6f558e959971 (patch)
treee3cba1399dca333f12b49682364c3725d1fa8c32
parentecc-sos: Fix exporting secret key for SOS. (diff)
downloadgnupg-0691234951df5ac1bae417a6034c6f558e959971.tar.gz
gnupg-0691234951df5ac1bae417a6034c6f558e959971.zip
agent: Don't use gcry_mpi_scan when not needed.
* agent/pksign.c (do_encode_md): Use %b to build sexp. Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--agent/pksign.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/agent/pksign.c b/agent/pksign.c
index 3474f9434..5464413f7 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;