aboutsummaryrefslogtreecommitdiffstats
path: root/agent/call-pinentry.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2023-10-06 10:04:00 +0000
committerWerner Koch <[email protected]>2023-10-06 10:15:10 +0000
commit4963f13f8fa914acfc9addd5f4f19ff75d983ef5 (patch)
treeaa43b99071da962f314219009b8e37cb805febc0 /agent/call-pinentry.c
parentsm: Support more HMAC algos in the pkcs#12 parser. (diff)
downloadgnupg-4963f13f8fa914acfc9addd5f4f19ff75d983ef5.tar.gz
gnupg-4963f13f8fa914acfc9addd5f4f19ff75d983ef5.zip
scd:openpgp: Return better error codes for the Reset Code.
* scd/app-openpgp.c (do_change_pin): Use GPG_ERR_BAD_RESET_CODE where appropriate. * common/util.h: Add error codes missing in gpgrt 1.46. * agent/call-pinentry.c (unlock_pinentry): Handle GPG_ERR_BAD_RESET_CODE. (agent_askpin): Ditlo. Also simply condition. (agent_get_passphrase): Ditto. * g10/call-agent.c (status_sc_op_failure): Handle GPG_ERR_BAD_RESET_CODE. * g10/card-util.c (write_sc_op_status): Ditto. * tools/card-call-scd.c (status_sc_op_failure): Ditto.
Diffstat (limited to 'agent/call-pinentry.c')
-rw-r--r--agent/call-pinentry.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
index 656d5f623..d236e1107 100644
--- a/agent/call-pinentry.c
+++ b/agent/call-pinentry.c
@@ -174,6 +174,7 @@ unlock_pinentry (ctrl_t ctrl, gpg_error_t rc)
case GPG_ERR_NO_PASSPHRASE:
case GPG_ERR_BAD_PASSPHRASE:
case GPG_ERR_BAD_PIN:
+ case GPG_ERR_BAD_RESET_CODE:
break;
case GPG_ERR_CORRUPTED_PROTECTION:
@@ -1621,12 +1622,13 @@ agent_askpin (ctrl_t ctrl,
&& (pininfo->status & PINENTRY_STATUS_PASSWORD_FROM_CACHE))
return unlock_pinentry (ctrl, rc);
- if (gpg_err_code (rc) == GPG_ERR_BAD_PASSPHRASE)
+ if (gpg_err_code (rc) == GPG_ERR_BAD_PASSPHRASE
+ || gpg_err_code (rc) == GPG_ERR_BAD_PIN
+ || gpg_err_code (rc) == GPG_ERR_BAD_RESET_CODE)
{
if (pininfo->cb_errtext)
errtext = pininfo->cb_errtext;
- else if (gpg_err_code (rc) == GPG_ERR_BAD_PASSPHRASE
- || gpg_err_code (rc) == GPG_ERR_BAD_PIN)
+ else
errtext = (is_pin? L_("Bad PIN") : L_("Bad Passphrase"));
}
else if (rc)
@@ -1894,12 +1896,13 @@ agent_get_passphrase (ctrl_t ctrl,
if (rc && (pininfo->status & PINENTRY_STATUS_PASSWORD_FROM_CACHE))
return unlock_pinentry (ctrl, rc);
- if (gpg_err_code (rc) == GPG_ERR_BAD_PASSPHRASE)
+ if (gpg_err_code (rc) == GPG_ERR_BAD_PASSPHRASE
+ || gpg_err_code (rc) == GPG_ERR_BAD_PIN
+ || gpg_err_code (rc) == GPG_ERR_BAD_RESET_CODE)
{
if (pininfo->cb_errtext)
errtext = pininfo->cb_errtext;
- else if (gpg_err_code (rc) == GPG_ERR_BAD_PASSPHRASE
- || gpg_err_code (rc) == GPG_ERR_BAD_PIN)
+ else
errtext = (is_pin? L_("Bad PIN") : L_("Bad Passphrase"));
}
else if (rc)