From 1cf49754694611620fd383327cf127e91f6883df Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Wed, 17 Jun 2020 17:00:47 +0900 Subject: ecc: Support "label" for EdDSA context in data. * cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi): Handle ctx->label. Signed-off-by: NIIBE Yutaka --- cipher/pubkey-util.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/cipher/pubkey-util.c b/cipher/pubkey-util.c index c04480d1..3ce66c37 100644 --- a/cipher/pubkey-util.c +++ b/cipher/pubkey-util.c @@ -760,6 +760,29 @@ _gcry_pk_util_data_to_mpi (gcry_sexp_t input, gcry_mpi_t *ret_mpi, if (rc) goto leave; + /* Get 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; + } + } + sexp_release (list); + if (rc) + goto leave; + } + /* Get VALUE. */ value = sexp_nth_buffer (lvalue, 1, &valuelen); if (!value) -- cgit v1.2.1