summaryrefslogtreecommitdiffstats
path: root/g10/call-agent.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2020-09-08 08:34:42 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2020-09-08 08:34:42 +0200
commit2bc1ec294422504e2d2e5d20716aba68f1c2b0d7 (patch)
treedbf3e2e3ff84482a72b8d09b44b8297dea76251c /g10/call-agent.c
parentscd: Add a workaround for Yubikey. (diff)
downloadgnupg2-2bc1ec294422504e2d2e5d20716aba68f1c2b0d7.tar.xz
gnupg2-2bc1ec294422504e2d2e5d20716aba68f1c2b0d7.zip
gpg,tools: Add handling of supported algorithms by a card.
* g10/call-agent.h (struct agent_card_info_s): Add supported_keyalgo. * g10/call-agent.c (learn_status_cb): Parse KEY-ATTR-INFO. (agent_release_card_info): Release supported_keyalgo. * tools/gpg-card.h (struct card_info_s): Add supported_keyalgo. * tools/card-call-scd.c (learn_status_cb): Parse KEY-ATTR-INFO. (release_card_info): Release supported_keyalgo. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'g10/call-agent.c')
-rw-r--r--g10/call-agent.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/g10/call-agent.c b/g10/call-agent.c
index 4e3bdf9e4..42e2d3720 100644
--- a/g10/call-agent.c
+++ b/g10/call-agent.c
@@ -499,6 +499,11 @@ agent_release_card_info (struct agent_card_info_s *info)
xfree (info->private_do[i]);
info->private_do[i] = NULL;
}
+ for (i=0; i < DIM(info->supported_keyalgo); i++)
+ {
+ free_strlist (info->supported_keyalgo[i]);
+ info->supported_keyalgo[i] = NULL;
+ }
}
@@ -744,6 +749,25 @@ learn_status_cb (void *opaque, const char *line)
parm->uif[no] = (data[0] != 0xff);
xfree (data);
}
+ else if (keywordlen == 13 && !memcmp (keyword, "KEY-ATTR-INFO", 13))
+ {
+ if (!strncmp (line, "OPENPGP.", 8))
+ {
+ int no;
+
+ line += 8;
+ no = atoi (line);
+ if (no >= 1 && no <= 3)
+ {
+ no--;
+ line++;
+ while (spacep (line))
+ line++;
+ append_to_strlist (&parm->supported_keyalgo[no], xstrdup (line));
+ }
+ }
+ /* Skip when it's not "OPENPGP.[123]". */
+ }
return 0;
}