diff options
author | NIIBE Yutaka <[email protected]> | 2023-03-17 06:22:00 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2023-03-17 06:22:00 +0000 |
commit | 84dd9cf6c35fb1f2a9c08856805846e2afaaa87a (patch) | |
tree | 3013d03c692be66dd7e784388e8ecc3728373a53 | |
parent | tkd: Implement READKEY, returning canon SEXP. (diff) | |
download | gnupg-84dd9cf6c35fb1f2a9c08856805846e2afaaa87a.tar.gz gnupg-84dd9cf6c35fb1f2a9c08856805846e2afaaa87a.zip |
Fix PKSIGN to get data by EXTRA.
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r-- | tkd/command.c | 15 | ||||
-rw-r--r-- | tkd/pkcs11.c | 7 |
2 files changed, 21 insertions, 1 deletions
diff --git a/tkd/command.c b/tkd/command.c index 1f38d18d8..5249dfa64 100644 --- a/tkd/command.c +++ b/tkd/command.c @@ -264,12 +264,17 @@ cmd_readkey (assuan_context_t ctx, char *line) gpg_error_t err; const char *keygrip; + line = xtrystrdup (line); /* Need a copy of the line. */ + if (!line) + return gpg_error_from_syserror (); + keygrip = skip_options (line); if (strlen (keygrip) != 40) err = gpg_error (GPG_ERR_INV_ID); err = tkd_readkey (ctrl, ctx, keygrip); + xfree (line); return err; } @@ -300,6 +305,10 @@ cmd_pksign (assuan_context_t ctx, char *line) else return set_error (GPG_ERR_ASS_PARAMETER, "invalid hash algorithm"); + line = xtrystrdup (line); /* Need a copy of the line. */ + if (!line) + return gpg_error_from_syserror (); + keygrip = skip_options (line); if (strlen (keygrip) != 40) @@ -316,6 +325,7 @@ cmd_pksign (assuan_context_t ctx, char *line) xfree (outdata); } + xfree (line); return err; } @@ -373,6 +383,10 @@ cmd_keyinfo (assuan_context_t ctx, char *line) opt_data = has_option (line, "--data"); + line = xtrystrdup (line); /* Need a copy of the line. */ + if (!line) + return gpg_error_from_syserror (); + cap = 0; if (has_option (line, "--list")) cap = 0; @@ -387,6 +401,7 @@ cmd_keyinfo (assuan_context_t ctx, char *line) err = tkd_keyinfo (ctrl, ctx, keygrip, opt_data, cap); + xfree (line); return err; } diff --git a/tkd/pkcs11.c b/tkd/pkcs11.c index 968c86454..7052fe753 100644 --- a/tkd/pkcs11.c +++ b/tkd/pkcs11.c @@ -280,6 +280,7 @@ compute_keygrip_rsa (char *keygrip, gcry_sexp_t *r_pubkey, else { bin2hex (grip, 20, keygrip); + log_debug ("keygrip: %s\n", keygrip); *r_pubkey = s_pkey; } } @@ -302,6 +303,7 @@ compute_keygrip_ec (char *keygrip, gcry_sexp_t *r_pubkey, else { bin2hex (grip, 20, keygrip); + log_debug ("keygrip: %s\n", keygrip); *r_pubkey = s_pkey; } } @@ -731,6 +733,8 @@ find_key (struct cryptoki *ck, const char *keygrip, struct key **r_key) int i; int j; + log_debug ("find_key: %s\n", keygrip); + *r_key = NULL; for (i = 0; i < ck->num_slots; i++) { @@ -1271,7 +1275,7 @@ tkd_sign (ctrl_t ctrl, assuan_context_t ctx, if (err) return err; - cmd = "VALUE"; + cmd = "EXTRA"; err = assuan_inquire (ctx, cmd, &value, &valuelen, MAXLEN_VALUE); if (err) { @@ -1287,6 +1291,7 @@ tkd_sign (ctrl_t ctrl, assuan_context_t ctx, xfree (sig); return err; } + *r_outdata = sig; } |