summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2020-08-21 11:53:10 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2020-08-21 11:53:10 +0900
commitfd51bc523d095168ee9367fe3f18d18f7a88ad90 (patch)
tree1a894991951b1b392f07e24bd1b38d464836b363
parent65a2cd139e21250e6581a4f610015937e7b91451 (diff)
downloadlibgcrypt-fd51bc523d095168ee9367fe3f18d18f7a88ad90.tar.gz
tests: Fix basic.c.
* tests/basic.c (check_one_hmac): Fix error paths. (check_pubkey_crypt): Fix wrong call of gcry_sexp_new. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
-rw-r--r--tests/basic.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/basic.c b/tests/basic.c
index ea13c50a..fdc5df4b 100644
--- a/tests/basic.c
+++ b/tests/basic.c
@@ -11550,18 +11550,19 @@ check_one_hmac (int algo, const char *data, int datalen,
gcry_md_write (hd, data, datalen);
err = gcry_md_copy (&hd2, hd);
+
+ gcry_md_close (hd);
+
if (err)
{
fail ("algo %d, gcry_md_copy failed: %s\n", algo, gpg_strerror (err));
+ return;
}
- gcry_md_close (hd);
-
p = gcry_md_read (hd2, algo);
if (!p)
fail("algo %d, hmac gcry_md_read failed\n", algo);
-
- if (memcmp (p, expect, mdlen))
+ else if (memcmp (p, expect, mdlen))
{
printf ("computed: ");
for (i = 0; i < mdlen; i++)
@@ -13420,8 +13421,8 @@ check_pubkey_crypt (int n, gcry_sexp_t skey, gcry_sexp_t pkey, int algo)
gcry_sexp_t list;
/* Convert decoding hint into canonical sexp. */
- hint_len = gcry_sexp_new (&list, datas[dataidx].hint,
- strlen (datas[dataidx].hint), 1);
+ gcry_sexp_new (&list, datas[dataidx].hint,
+ strlen (datas[dataidx].hint), 1);
hint_len = gcry_sexp_sprint (list, GCRYSEXP_FMT_CANON, NULL, 0);
hint = gcry_malloc (hint_len);
if (!hint)