mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-31 11:41:32 +01:00
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 <wk@gnupg.org>
This commit is contained in:
parent
2ccbcfec12
commit
5b7b42e2b2
@ -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)
|
||||
|
@ -3513,17 +3513,17 @@ do_with_keygrip (app_t app, ctrl_t ctrl, int action,
|
||||
}
|
||||
else if (!want_keygripstr || !strcmp (keygripstr, want_keygripstr))
|
||||
{
|
||||
if (capability == 1)
|
||||
if (capability == GCRY_PK_USAGE_SIGN)
|
||||
{
|
||||
if (strcmp (data_objects[i].keyref, "9C"))
|
||||
continue;
|
||||
}
|
||||
if (capability == 2)
|
||||
if (capability == GCRY_PK_USAGE_ENCR)
|
||||
{
|
||||
if (strcmp (data_objects[i].keyref, "9D"))
|
||||
continue;
|
||||
}
|
||||
if (capability == 3)
|
||||
if (capability == GCRY_PK_USAGE_AUTH)
|
||||
{
|
||||
if (strcmp (data_objects[i].keyref, "9A"))
|
||||
continue;
|
||||
|
@ -2077,11 +2077,11 @@ cmd_keyinfo (assuan_context_t ctx, char *line)
|
||||
if (has_option (line, "--list"))
|
||||
cap = 0;
|
||||
else if (has_option (line, "--list=sign"))
|
||||
cap = 1;
|
||||
cap = GCRY_PK_USAGE_SIGN;
|
||||
else if (has_option (line, "--list=encr"))
|
||||
cap = 2;
|
||||
cap = GCRY_PK_USAGE_ENCR;
|
||||
else if (has_option (line, "--list=auth"))
|
||||
cap = 3;
|
||||
cap = GCRY_PK_USAGE_AUTH;
|
||||
else
|
||||
keygrip_str = line;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user