aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/card-call-scd.c9
-rw-r--r--tools/gpg-card.c4
-rw-r--r--tools/gpg-card.h3
3 files changed, 15 insertions, 1 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);
diff --git a/tools/gpg-card.c b/tools/gpg-card.c
index be6929c3a..9257bc78f 100644
--- a/tools/gpg-card.c
+++ b/tools/gpg-card.c
@@ -836,8 +836,10 @@ list_retry_counter (card_info_t info, estream_t fp)
const char *s;
int i;
+ if (info->chvlabels)
+ tty_fprintf (fp, "PIN labels .......: %s\n", info->chvlabels);
tty_fprintf (fp, "PIN retry counter :");
- for (i=0; i < DIM (info->chvinfo); i++)
+ for (i=0; i < DIM (info->chvinfo) && i < info->nchvinfo; i++)
{
if (info->chvinfo[i] >= 0)
tty_fprintf (fp, " %d", info->chvinfo[i]);
diff --git a/tools/gpg-card.h b/tools/gpg-card.h
index 18ff5f68d..bd4b923e7 100644
--- a/tools/gpg-card.h
+++ b/tools/gpg-card.h
@@ -172,8 +172,11 @@ struct card_info_s
required for each signing. Note that the
gpg-agent might cache it anyway. */
int is_v2; /* True if this is a v2 openpgp card. */
+ byte nchvmaxlen; /* Number of valid items in CHVMAXLEN. */
int chvmaxlen[4]; /* Maximum allowed length of a CHV. */
+ byte nchvinfo; /* Number of valid items in CHVINFO. */
int chvinfo[4]; /* Allowed retries for the CHV; 0 = blocked. */
+ char *chvlabels; /* Malloced String with CHV labels. */
unsigned char chvusage[2]; /* Data object 5F2F */
struct {
unsigned int ki:1; /* Key import available. */