diff options
author | Werner Koch <wk@gnupg.org> | 2009-03-20 20:04:47 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2009-03-20 20:04:47 +0100 |
commit | 36d681d98ecc224d2241b401278952b10fd8064a (patch) | |
tree | da08eb4babff8e479ee14e441b8592af70ae85bb /agent/learncard.c | |
parent | Add missing file. (diff) | |
download | gnupg2-36d681d98ecc224d2241b401278952b10fd8064a.tar.xz gnupg2-36d681d98ecc224d2241b401278952b10fd8064a.zip |
Fix keygrip computation for TCOS 3 cards.
Emit PROGRESS status lines during --learn-card.
Diffstat (limited to 'agent/learncard.c')
-rw-r--r-- | agent/learncard.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/agent/learncard.c b/agent/learncard.c index eab5bd47e..3db33ee76 100644 --- a/agent/learncard.c +++ b/agent/learncard.c @@ -1,5 +1,5 @@ /* learncard.c - Handle the LEARN command - * Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + * Copyright (C) 2002, 2003, 2004, 2009 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -32,7 +32,8 @@ /* Structures used by the callback mechanism to convey information pertaining to key pairs. */ -struct keypair_info_s { +struct keypair_info_s +{ struct keypair_info_s *next; int no_cert; char *id; /* points into grip */ @@ -43,13 +44,14 @@ struct keypair_info_s { }; typedef struct keypair_info_s *KEYPAIR_INFO; -struct kpinfo_cb_parm_s { +struct kpinfo_cb_parm_s +{ + ctrl_t ctrl; int error; KEYPAIR_INFO info; }; - /* Structures used by the callback mechanism to convey information pertaining to certificates. */ struct certinfo_s { @@ -60,7 +62,9 @@ struct certinfo_s { }; typedef struct certinfo_s *CERTINFO; -struct certinfo_cb_parm_s { +struct certinfo_cb_parm_s +{ + ctrl_t ctrl; int error; CERTINFO info; }; @@ -130,6 +134,11 @@ kpinfo_cb (void *opaque, const char *line) if (parm->error) return; /* no need to gather data after an error coccured */ + + if ((parm->error = agent_write_status (parm->ctrl, "PROGRESS", + "learncard", "k", "0", "0", NULL))) + return; + item = xtrycalloc (1, sizeof *item + strlen (line)); if (!item) { @@ -183,6 +192,10 @@ certinfo_cb (void *opaque, const char *line) if (parm->error) return; /* no need to gather data after an error coccured */ + if ((parm->error = agent_write_status (parm->ctrl, "PROGRESS", + "learncard", "c", "0", "0", NULL))) + return; + type = strtol (line, &p, 10); while (spacep (p)) p++; @@ -296,6 +309,8 @@ agent_handle_learn (ctrl_t ctrl, void *assuan_context) memset (&parm, 0, sizeof parm); memset (&cparm, 0, sizeof cparm); memset (&sparm, 0, sizeof sparm); + parm.ctrl = ctrl; + cparm.ctrl = ctrl; /* Check whether a card is present and get the serial number */ rc = agent_card_serialno (ctrl, &serialno); |