1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-10 23:49:50 +02:00

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

* scd/app-p15.c (verify_pin): ascii-numeric is different than BCD.

(cherry picked from commit 029924a46e)
Added a few typo fixes.
This commit is contained in:
Werner Koch 2021-06-18 18:02:08 +02:00
parent 326f6fa166
commit 1915b95ffd
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -326,7 +326,7 @@ struct prkdf_object_s
char *serial_number;
/* KDF/KEK parameter for OpenPGP's ECDH. First byte is zero if not
* availabale. .*/
* available. */
unsigned char ecdh_kdf[4];
/* Length and allocated buffer with the Id of this object. */
@ -4515,7 +4515,7 @@ send_key_fpr_line (ctrl_t ctrl, int number, const unsigned char *fpr)
}
/* If possible Emit a FPR-KEY status line for the private key object
/* If possible emit a FPR-KEY status line for the private key object
* PRKDF using NUMBER as index. */
static void
send_key_fpr (app_t app, ctrl_t ctrl, prkdf_object_t prkdf, int number)
@ -5302,7 +5302,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)
@ -5311,6 +5310,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: