diff options
author | NIIBE Yutaka <[email protected]> | 2020-09-08 06:34:42 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2020-09-08 06:34:42 +0000 |
commit | 2bc1ec294422504e2d2e5d20716aba68f1c2b0d7 (patch) | |
tree | dbf3e2e3ff84482a72b8d09b44b8297dea76251c /tools/card-call-scd.c | |
parent | scd: Add a workaround for Yubikey. (diff) | |
download | gnupg-2bc1ec294422504e2d2e5d20716aba68f1c2b0d7.tar.gz gnupg-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 <[email protected]>
Diffstat (limited to 'tools/card-call-scd.c')
-rw-r--r-- | tools/card-call-scd.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/card-call-scd.c b/tools/card-call-scd.c index 8800c5b52..0b529f06a 100644 --- a/tools/card-call-scd.c +++ b/tools/card-call-scd.c @@ -161,6 +161,11 @@ release_card_info (card_info_t info) info->kinfo = kinfo; } info->chvusage[0] = info->chvusage[1] = 0; + for (i=0; i < DIM(info->supported_keyalgo); i++) + { + free_strlist (info->supported_keyalgo[i]); + info->supported_keyalgo[i] = NULL; + } } @@ -1042,6 +1047,26 @@ learn_status_cb (void *opaque, const char *line) xfree (parm->dispserialno); parm->dispserialno = unescape_status_string (line); } + else if (!memcmp (keyword, "KEY-ATTR-INFO", keywordlen)) + { + 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]". */ + } break; default: |