aboutsummaryrefslogtreecommitdiffstats
path: root/scd/app-piv.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2022-05-26 03:01:16 +0000
committerNIIBE Yutaka <[email protected]>2022-05-26 03:01:16 +0000
commit5264d3f58e8a8362900c3518bdd683ff9a23cccc (patch)
treed49c9b558c4f2ca4408fcb98910d742c8789f2e8 /scd/app-piv.c
parentscd,piv: Fix status report of KEYPAIRINFO. (diff)
downloadgnupg-5264d3f58e8a8362900c3518bdd683ff9a23cccc.tar.gz
gnupg-5264d3f58e8a8362900c3518bdd683ff9a23cccc.zip
scd: Return USAGE information for KEYINFO command.
* scd/command.c (hlp_keyinfo): Update. (send_keyinfo): Add a USAGE argument. * scd/scdaemon.h (send_keyinfo): Add a USAGE argument. * scd/app-nks.c (set_usage_string): New. (do_learn_status_core, do_readkey): Use set_usage_string. (do_with_keygrip): Add USAGE to call send_keyinfo, using set_usage_string. * scd/app-openpgp.c (get_usage_string): New. (send_keypair_info): Use get_usage_string. (send_keyinfo_if_available): Add USAGE to call send_keyinfo, using get_usage_string. * scd/app-p15.c (set_usage_string): New. (send_keypairinfo): Use set_usage_string. (do_with_keygrip): Add USAGE to call send_keyinfo, using set_usage_string. * scd/app-piv.c (do_with_keygrip): Add USAGE to call send_keyinfo. -- Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'scd/app-piv.c')
-rw-r--r--scd/app-piv.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/scd/app-piv.c b/scd/app-piv.c
index 23b50bf99..a51ac31ec 100644
--- a/scd/app-piv.c
+++ b/scd/app-piv.c
@@ -3529,6 +3529,13 @@ do_with_keygrip (app_t app, ctrl_t ctrl, int action,
}
else if (!want_keygripstr || !strcmp (keygripstr, want_keygripstr))
{
+ const char *usage;
+
+ if (data_objects[i].usage)
+ usage = data_objects[i].usage;
+ else
+ usage = "-";
+
if (capability == GCRY_PK_USAGE_SIGN)
{
if (strcmp (data_objects[i].keyref, "9C"))
@@ -3546,7 +3553,7 @@ do_with_keygrip (app_t app, ctrl_t ctrl, int action,
}
snprintf (idbuf, sizeof idbuf, "PIV.%s", data_objects[i].keyref);
- send_keyinfo (ctrl, data, keygripstr, serialno, idbuf);
+ send_keyinfo (ctrl, data, keygripstr, serialno, idbuf, usage);
if (want_keygripstr)
{
err = 0; /* Found */