aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2019-07-19 04:26:49 +0000
committerNIIBE Yutaka <[email protected]>2019-07-19 04:26:49 +0000
commit98f4eff7ffde106ae4f60739d1104282430ac14f (patch)
tree9081ccd95ce9027221d9a31bc605407f92ed4472
parentscd: Support "[CHV3]" attribute for keyid string. (diff)
downloadgnupg-98f4eff7ffde106ae4f60739d1104282430ac14f.tar.gz
gnupg-98f4eff7ffde106ae4f60739d1104282430ac14f.zip
card: Fix showing KDF object attribute.
* g10/call-agent.c (learn_status_cb): Parse the KDF DO. * g10/card-util.c (current_card_status): Show it correctly. Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--g10/call-agent.c10
-rw-r--r--g10/call-agent.h2
-rw-r--r--g10/card-util.c23
3 files changed, 30 insertions, 5 deletions
diff --git a/g10/call-agent.c b/g10/call-agent.c
index 19deb73d7..d55238311 100644
--- a/g10/call-agent.c
+++ b/g10/call-agent.c
@@ -740,7 +740,15 @@ learn_status_cb (void *opaque, const char *line)
}
else if (keywordlen == 3 && !memcmp (keyword, "KDF", 3))
{
- parm->kdf_do_enabled = 1;
+ unsigned char *data = unescape_status_string (line);
+
+ if (data[2] != 0x03)
+ parm->kdf_do_enabled = 0;
+ else if (data[22] != 0x85)
+ parm->kdf_do_enabled = 1;
+ else
+ parm->kdf_do_enabled = 2;
+ xfree (data);
}
else if (keywordlen == 5 && !memcmp (keyword, "UIF-", 4)
&& strchr("123", keyword[4]))
diff --git a/g10/call-agent.h b/g10/call-agent.h
index c4d0a9de1..5512fc847 100644
--- a/g10/call-agent.h
+++ b/g10/call-agent.h
@@ -72,7 +72,7 @@ struct agent_card_info_s
unsigned int bt:1; /* Button for confirmation available. */
} extcap;
unsigned int status_indicator;
- int kdf_do_enabled; /* True if card has a KDF object. */
+ int kdf_do_enabled; /* Non-zero if card has a KDF object, 0 if not. */
int uif[3]; /* True if User Interaction Flag is on. */
};
diff --git a/g10/card-util.c b/g10/card-util.c
index a95cc121a..fbb941915 100644
--- a/g10/card-util.c
+++ b/g10/card-util.c
@@ -521,7 +521,16 @@ current_card_status (ctrl_t ctrl, estream_t fp,
es_fprintf (fp, "sigcount:%lu:::\n", info.sig_counter);
if (info.extcap.kdf)
{
- es_fprintf (fp, "kdf:%s:\n", info.kdf_do_enabled ? "on" : "off");
+ const char *setup;
+
+ if (info.kdf_do_enabled == 0)
+ setup = "off";
+ else if (info.kdf_do_enabled == 1)
+ setup = "single";
+ else
+ setup = "on";
+
+ es_fprintf (fp, "kdf:%s:\n", setup);
}
if (info.extcap.bt)
{
@@ -636,8 +645,16 @@ current_card_status (ctrl_t ctrl, estream_t fp,
tty_fprintf (fp, "Signature counter : %lu\n", info.sig_counter);
if (info.extcap.kdf)
{
- tty_fprintf (fp, "KDF setting ......: %s\n",
- info.kdf_do_enabled ? "on" : "off");
+ const char *setup;
+
+ if (info.kdf_do_enabled == 0)
+ setup = "off";
+ else if (info.kdf_do_enabled == 1)
+ setup = "single";
+ else
+ setup = "on";
+
+ tty_fprintf (fp, "KDF setting ......: %s\n", setup);
}
if (info.extcap.bt)
{