scd:p15: Add pre-check for ascii-numeric PINs.

* scd/app-p15.c (verify_pin): acii-numerix is different than BCD.
This commit is contained in:
Werner Koch 2021-06-18 18:02:08 +02:00
parent 544ec7872a
commit 029924a46e
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 9 additions and 1 deletions

View File

@ -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: