aboutsummaryrefslogtreecommitdiffstats
path: root/tools/card-call-scd.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2021-03-18 10:29:31 +0000
committerWerner Koch <[email protected]>2021-03-18 10:29:31 +0000
commit1ac189f2df6cedab3a133baca69558fdf6a908d4 (patch)
treea067a451a96cf3f61939243900ed5a1bb17a470d /tools/card-call-scd.c
parentscd:p15: New attribute CHV-LABEL. (diff)
downloadgnupg-1ac189f2df6cedab3a133baca69558fdf6a908d4.tar.gz
gnupg-1ac189f2df6cedab3a133baca69558fdf6a908d4.zip
card: Print PIN descriptions and fix number of printed retry counters.
* tools/gpg-card.h (struct card_info_s): Add fields nmaxlen, nchvinfo, and chvlabels. * tools/card-call-scd.c (release_card_info): Free chvlabels. (learn_status_cb): Parse CHV-LABEL. Set nmaxlen and nchvinfo. * tools/gpg-card.c (list_retry_counter): Print CHV labels. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'tools/card-call-scd.c')
-rw-r--r--tools/card-call-scd.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/card-call-scd.c b/tools/card-call-scd.c
index 0bb1eb538..95f28e564 100644
--- a/tools/card-call-scd.c
+++ b/tools/card-call-scd.c
@@ -161,6 +161,7 @@ release_card_info (card_info_t info)
info->kinfo = kinfo;
}
info->chvusage[0] = info->chvusage[1] = 0;
+ xfree (info->chvlabels); info->chvlabels = NULL;
for (i=0; i < DIM(info->supported_keyalgo); i++)
{
free_strlist (info->supported_keyalgo[i]);
@@ -909,6 +910,11 @@ learn_status_cb (void *opaque, const char *line)
parm->chvusage[0] = byte1;
parm->chvusage[1] = byte2;
}
+ else if (!memcmp (keyword, "CHV-LABEL", keywordlen))
+ {
+ xfree (parm->chvlabels);
+ parm->chvlabels = xstrdup (line);
+ }
break;
case 10:
@@ -948,6 +954,7 @@ learn_status_cb (void *opaque, const char *line)
while (spacep (p))
p++;
}
+ parm->nchvmaxlen = 3;
for (i=0; *p && i < 3; i++)
{
parm->chvinfo[i] = atoi (p);
@@ -956,6 +963,7 @@ learn_status_cb (void *opaque, const char *line)
while (spacep (p))
p++;
}
+ parm->nchvinfo = 3;
}
else
{
@@ -967,6 +975,7 @@ learn_status_cb (void *opaque, const char *line)
while (spacep (p))
p++;
}
+ parm->nchvinfo = i;
}
xfree (buf);