mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-04 20:38:50 +01:00
SCD: Support P=N format for login data.
* scd/app-openpgp.c (parse_login_data): Support P=N format.
This commit is contained in:
parent
eec69e5366
commit
031f783d8a
@ -602,9 +602,9 @@ count_bits (const unsigned char *a, size_t len)
|
|||||||
|
|
||||||
P=<keypad-request>
|
P=<keypad-request>
|
||||||
|
|
||||||
Where KEYPAD_REQUEST is 0 or a pair of two integers: <n>,<m>.
|
Where KEYPAD_REQUEST is in the format of: <n> or <n>,<m>.
|
||||||
0 means use keypad with variable length input. <n>,<m> means use
|
N for user PIN, M for admin PIN. If M is missing it means M=N.
|
||||||
keypad with fixed length input. N for user PIN, M for admin PIN.
|
0 means to force not to use keypad.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
@ -660,24 +660,22 @@ parse_login_data (app_t app)
|
|||||||
|
|
||||||
if (buflen)
|
if (buflen)
|
||||||
{
|
{
|
||||||
if (*buffer == '0')
|
if (digitp (buffer))
|
||||||
{
|
|
||||||
buffer++;
|
|
||||||
buflen--;
|
|
||||||
if (buflen && !(*buffer == '\n' || *buffer == '\x18'))
|
|
||||||
goto next;
|
|
||||||
/* Disable use of pinpad. */
|
|
||||||
app->app_local->keypad.specified = 1;
|
|
||||||
}
|
|
||||||
else if (digitp (buffer))
|
|
||||||
{
|
{
|
||||||
char *q;
|
char *q;
|
||||||
int n, m;
|
int n, m;
|
||||||
|
|
||||||
n = strtol (buffer, &q, 10);
|
n = strtol (buffer, &q, 10);
|
||||||
|
if (q >= (char *)buffer + buflen
|
||||||
|
|| *q == '\x18' || *q == '\n')
|
||||||
|
m = n;
|
||||||
|
else
|
||||||
|
{
|
||||||
if (*q++ != ',' || !digitp (q))
|
if (*q++ != ',' || !digitp (q))
|
||||||
goto next;
|
goto next;
|
||||||
m = strtol (q, &q, 10);
|
m = strtol (q, &q, 10);
|
||||||
|
}
|
||||||
|
|
||||||
buffer = q;
|
buffer = q;
|
||||||
if (buflen < ((unsigned char *)q - buffer))
|
if (buflen < ((unsigned char *)q - buffer))
|
||||||
{
|
{
|
||||||
@ -1540,6 +1538,7 @@ static int
|
|||||||
check_keypad_request (app_t app, pininfo_t *pininfo, int admin_pin)
|
check_keypad_request (app_t app, pininfo_t *pininfo, int admin_pin)
|
||||||
{
|
{
|
||||||
if (app->app_local->keypad.specified == 0) /* No preference on card. */
|
if (app->app_local->keypad.specified == 0) /* No preference on card. */
|
||||||
|
{
|
||||||
if (pininfo->fixedlen == 0) /* Reader has varlen capability. */
|
if (pininfo->fixedlen == 0) /* Reader has varlen capability. */
|
||||||
return 0; /* Then, use pinpad. */
|
return 0; /* Then, use pinpad. */
|
||||||
else
|
else
|
||||||
@ -1548,6 +1547,7 @@ check_keypad_request (app_t app, pininfo_t *pininfo, int admin_pin)
|
|||||||
* the card.
|
* the card.
|
||||||
*/
|
*/
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (admin_pin)
|
if (admin_pin)
|
||||||
pininfo->fixedlen = app->app_local->keypad.fixedlen_admin;
|
pininfo->fixedlen = app->app_local->keypad.fixedlen_admin;
|
||||||
|
Loading…
Reference in New Issue
Block a user