summaryrefslogtreecommitdiffstats
path: root/agent/genkey.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2014-10-24 16:20:20 +0200
committerWerner Koch <wk@gnupg.org>2014-10-24 20:40:12 +0200
commitc9aadcb3a248632c07391ff3d829bece9320a901 (patch)
tree5f59a55e1b7811f6bd3c65e7bfb1193f6266e7cc /agent/genkey.c
parentmisc: Add logo as used with PayPal. (diff)
downloadgnupg2-c9aadcb3a248632c07391ff3d829bece9320a901.tar.xz
gnupg2-c9aadcb3a248632c07391ff3d829bece9320a901.zip
agent: Support pinentries with integrated repeat passphrase feature.
* agent/agent.h (struct pin_entry_info_s): Add fields repeat_okay and with_repeat. * agent/call-pinentry.c (close_button_status_cb): Rewrite and check for PIN_REPEAT. Change users to check only the relevant bit. (agent_askpin): Support repeat logic of new Pinentries. * agent/command-ssh.c (ssh_identity_register): Use the new repeat feature. * agent/genkey.c (agent_ask_new_passphrase): Ditto. -- If we need to confirm a passphrase entry (e.g. for new passphrase) we set a flag into the pinentry info block. The we try to use the new pinentry command SETREPEATERROR; if that fails, we continue as usual. If that succeeds we ask the pinentry to show the repeat (confirmation) prompt and on successful return we set another flag in the pinentry info block so that the caller can skip its own confirmation check. A new status line from the pinentry indicates that the feature is actually supported (it may not be supported on certain systems for example when using the ncurses backend). Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to '')
-rw-r--r--agent/genkey.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/agent/genkey.c b/agent/genkey.c
index 9918c12e7..91917f77b 100644
--- a/agent/genkey.c
+++ b/agent/genkey.c
@@ -363,6 +363,7 @@ agent_ask_new_passphrase (ctrl_t ctrl, const char *prompt,
pi->max_length = 100;
pi->max_tries = 3;
pi->with_qualitybar = 1;
+ pi->with_repeat = 1;
pi2->max_length = 100;
pi2->max_tries = 3;
pi2->check_cb = reenter_compare_cb;
@@ -379,8 +380,9 @@ agent_ask_new_passphrase (ctrl_t ctrl, const char *prompt,
pi2->failed_tries = 0;
goto next_try;
}
- /* Unless the passphrase is empty, ask to confirm it. */
- if (pi->pin && *pi->pin)
+ /* Unless the passphrase is empty or the pinentry told us that
+ it already did the repetition check, ask to confirm it. */
+ if (pi->pin && *pi->pin && !pi->repeat_okay)
{
err = agent_askpin (ctrl, text2, NULL, NULL, pi2);
if (err == -1)