diff options
author | NIIBE Yutaka <[email protected]> | 2020-01-13 07:43:53 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2020-01-13 07:43:53 +0000 |
commit | c31266716dd69fee7bd64cf1e33d7631cd328e72 (patch) | |
tree | c79922a836ab7a893afd283c66d4d66d89120090 /agent/call-scd.c | |
parent | scd: Implement direct access by KEYGRIP for GETATTR and READKEY. (diff) | |
download | gnupg-c31266716dd69fee7bd64cf1e33d7631cd328e72.tar.gz gnupg-c31266716dd69fee7bd64cf1e33d7631cd328e72.zip |
agent: Extend agent_card_getattr with KEYGRIP.
* agent/agent.h (struct card_key_info_s): KEYGRIP null terminated.
(agent_card_getattr): Add KEYGRIP argument.
* agent/call-scd.c (agent_card_getattr): Handle KEYGRIP argument.
(card_keyinfo_cb): Make KEYGRIP null terminated.
* agent/command.c (cmd_readkey): Follow the change.
Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'agent/call-scd.c')
-rw-r--r-- | agent/call-scd.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/agent/call-scd.c b/agent/call-scd.c index cacf1f483..b4a2974b4 100644 --- a/agent/call-scd.c +++ b/agent/call-scd.c @@ -1300,7 +1300,8 @@ card_getattr_cb (void *opaque, const char *line) NULL is never stored in this case. On error an error code is returned and NULL stored at RESULT. */ gpg_error_t -agent_card_getattr (ctrl_t ctrl, const char *name, char **result) +agent_card_getattr (ctrl_t ctrl, const char *name, char **result, + const char *keygrip) { int err; struct card_getattr_parm_s parm; @@ -1318,7 +1319,10 @@ agent_card_getattr (ctrl_t ctrl, const char *name, char **result) /* We assume that NAME does not need escaping. */ if (8 + strlen (name) > DIM(line)-1) return gpg_error (GPG_ERR_TOO_LARGE); - stpcpy (stpcpy (line, "GETATTR "), name); + if (keygrip == NULL) + stpcpy (stpcpy (line, "GETATTR "), name); + else + snprintf (line, sizeof line, "GETATTR %s %s", name, keygrip); err = start_scd (ctrl); if (err) @@ -1393,6 +1397,7 @@ card_keyinfo_cb (void *opaque, const char *line) } memcpy (keyinfo->keygrip, line, 40); + keyinfo->keygrip[40] = 0; line = s; |