summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2021-09-17 17:36:57 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2021-09-17 17:36:57 +0900
commitde27d016f0d4fda985d2279e43a9ba6a5d05156b (patch)
treedf2db1be7c983efaa527594bd49ef4189fecf550
parent9342b29516c43b4ab4a3e48aedbacbe82f39873d (diff)
downloadlibgcrypt-de27d016f0d4fda985d2279e43a9ba6a5d05156b.tar.gz
experiment: Also support "label" in data.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
-rw-r--r--cipher/pubkey-util.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/cipher/pubkey-util.c b/cipher/pubkey-util.c
index 7c3f8a47..bc0ae832 100644
--- a/cipher/pubkey-util.c
+++ b/cipher/pubkey-util.c
@@ -882,6 +882,31 @@ _gcry_pk_util_data_to_mpi (gcry_sexp_t input, gcry_mpi_t *ret_mpi,
}
else if (lhash)
{
+ /* Get optional LABEL. */
+ list = sexp_find_token (ldata, "label", 0);
+ if (list)
+ {
+ s = sexp_nth_data (list, 1, &n);
+ if (!s)
+ rc = GPG_ERR_NO_OBJ;
+ else if (n > 0)
+ {
+ ctx->label = xtrymalloc (n);
+ if (!ctx->label)
+ rc = gpg_err_code_from_syserror ();
+ else
+ {
+ memcpy (ctx->label, s, n);
+ ctx->labellen = n;
+ }
+ }
+ else
+ rc = GPG_ERR_INV_ARG;
+ sexp_release (list);
+ if (rc)
+ goto leave;
+ }
+
if (sexp_length (lhash) != 3)
rc = GPG_ERR_INV_OBJ;
else if ( !(s=sexp_nth_data (lhash, 1, &n)) || !n )