aboutsummaryrefslogtreecommitdiffstats
path: root/scd/iso7816.h
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2020-04-07 16:25:41 +0000
committerWerner Koch <[email protected]>2020-04-07 16:26:00 +0000
commit60d018f6a91c4c90b8ecf13f88ac4256699f4007 (patch)
tree23777ca47346da386213417757f2d56776fe3f7c /scd/iso7816.h
parentdoc: Typo fix in code comment. (diff)
downloadgnupg-60d018f6a91c4c90b8ecf13f88ac4256699f4007.tar.gz
gnupg-60d018f6a91c4c90b8ecf13f88ac4256699f4007.zip
scd: Factor common PIN status check out.
* scd/iso7816.h (ISO7816_VERIFY_ERROR): New. (ISO7816_VERIFY_NO_PIN): New. (ISO7816_VERIFY_BLOCKED): New. (ISO7816_VERIFY_NULLPIN): New. (ISO7816_VERIFY_NOT_NEEDED): New. * scd/iso7816.c (iso7816_verify_status): New. * scd/app-nks.c (get_chv_status): Use new function. * scd/app-piv.c (get_chv_status): Ditto. (verify_chv): Ditto. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'scd/iso7816.h')
-rw-r--r--scd/iso7816.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/scd/iso7816.h b/scd/iso7816.h
index a8215808b..b59103db2 100644
--- a/scd/iso7816.h
+++ b/scd/iso7816.h
@@ -29,6 +29,15 @@
#define ISO7816_CHANGE_REFERENCE_DATA 0x24
#define ISO7816_RESET_RETRY_COUNTER 0x2C
+/* Error codes returned by iso7816_verify_status. A non-negative
+ * number gives the number of left tries.
+ * NB: The values are also used by the CHV-STATUS lines and thus are
+ * part of the public interface. Do not change them. */
+#define ISO7816_VERIFY_ERROR (-1)
+#define ISO7816_VERIFY_NO_PIN (-2)
+#define ISO7816_VERIFY_BLOCKED (-3)
+#define ISO7816_VERIFY_NULLPIN (-4)
+#define ISO7816_VERIFY_NOT_NEEDED (-5)
/* Information to be passed to pinpad equipped readers. See
ccid-driver.c for details. */
@@ -76,6 +85,7 @@ gpg_error_t iso7816_check_pinpad (int slot, int command,
gpg_error_t iso7816_verify (int slot,
int chvno, const char *chv, size_t chvlen);
gpg_error_t iso7816_verify_kp (int slot, int chvno, pininfo_t *pininfo);
+int iso7816_verify_status (int slot, int chvno);
gpg_error_t iso7816_change_reference_data (int slot, int chvno,
const char *oldchv, size_t oldchvlen,
const char *newchv, size_t newchvlen);