aboutsummaryrefslogtreecommitdiffstats
path: root/scd/app-openpgp.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2020-04-02 09:54:01 +0000
committerWerner Koch <[email protected]>2020-04-02 09:54:01 +0000
commit5b7b42e2b2b7ba7b88f89ff4b4ee7baf0eef2a04 (patch)
tree627c06b4e84307688672d53ce8c0a3dd4263e414 /scd/app-openpgp.c
parentscd: New command DEVINFO. (diff)
downloadgnupg-5b7b42e2b2b7ba7b88f89ff4b4ee7baf0eef2a04.tar.gz
gnupg-5b7b42e2b2b7ba7b88f89ff4b4ee7baf0eef2a04.zip
scd: Use Gcrypt usage constants for the do_with_keygrip capabilities.
* scd/command.c (cmd_keyinfo): Use Gcrypt constants for CAP. * scd/app-openpgp.c (do_with_keygrip): Adjust for them. * scd/app-piv.c (do_with_keygrip): Ditto. -- That makes it easier to read. An open question is whether we should allow several capabilities and whether they are the ORed or ANDed. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'scd/app-openpgp.c')
-rw-r--r--scd/app-openpgp.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c
index ec2c04756..5f1ba2f5a 100644
--- a/scd/app-openpgp.c
+++ b/scd/app-openpgp.c
@@ -5454,8 +5454,16 @@ do_with_keygrip (app_t app, ctrl_t ctrl, int action, const char *keygrip_str,
}
else
{
- i = capability - 1;
- send_keyinfo_if_available (app, ctrl, buf, data, i);
+ if (capability == GCRY_PK_USAGE_SIGN)
+ i = 0;
+ else if (capability == GCRY_PK_USAGE_ENCR)
+ i = 1;
+ else if (capability == GCRY_PK_USAGE_AUTH)
+ i = 2;
+ else
+ i = -1;
+ if (i >= 0)
+ send_keyinfo_if_available (app, ctrl, buf, data, i);
}
/* Return an error so that the dispatcher keeps on looping
@@ -5477,6 +5485,7 @@ do_with_keygrip (app_t app, ctrl_t ctrl, int action, const char *keygrip_str,
return gpg_error (GPG_ERR_NOT_FOUND);
}
+
/* Show information about card capabilities. */
static void
show_caps (struct app_local_s *s)