summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2020-06-17 17:00:47 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2020-06-17 17:00:47 +0900
commit1cf49754694611620fd383327cf127e91f6883df (patch)
tree3c819ff7a2ed79173fcb68e3b483cd8b3ced2440
parentd51a9c259d49c63121fab48bce48d826e9b57733 (diff)
downloadlibgcrypt-1cf49754694611620fd383327cf127e91f6883df.tar.gz
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 <gniibe@fsij.org>
-rw-r--r--cipher/pubkey-util.c23
1 files changed, 23 insertions, 0 deletions
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)