diff options
author | Werner Koch <[email protected]> | 2021-06-18 16:02:08 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2021-06-18 16:02:08 +0000 |
commit | 029924a46e08ffcda038d89f06abfb41c980a9ad (patch) | |
tree | fd905a1a9c70d508ffdae4c56abc6ea40827b3f1 | |
parent | scd:p15: Add basic support for AET JCOP cards. (diff) | |
download | gnupg-029924a46e08ffcda038d89f06abfb41c980a9ad.tar.gz gnupg-029924a46e08ffcda038d89f06abfb41c980a9ad.zip |
scd:p15: Add pre-check for ascii-numeric PINs.
* scd/app-p15.c (verify_pin): acii-numerix is different than BCD.
-rw-r--r-- | scd/app-p15.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/scd/app-p15.c b/scd/app-p15.c index 4ace34d02..2bdcb1577 100644 --- a/scd/app-p15.c +++ b/scd/app-p15.c @@ -5145,7 +5145,6 @@ verify_pin (app_t app, switch (aodf->pintype) { case PIN_TYPE_BCD: - case PIN_TYPE_ASCII_NUMERIC: for (s=pinvalue; digitp (s); s++) ; if (*s) @@ -5154,6 +5153,15 @@ verify_pin (app_t app, err = gpg_error (GPG_ERR_BAD_PIN); } break; + case PIN_TYPE_ASCII_NUMERIC: + for (s=pinvalue; *s && !(*s & 0x80); s++) + ; + if (*s) + { + errstr = "Non-ascii characters found in PIN"; + err = gpg_error (GPG_ERR_BAD_PIN); + } + break; case PIN_TYPE_UTF8: break; case PIN_TYPE_HALF_NIBBLE_BCD: |