pkcs15init: introduce 'max-unblocks' PIN init parameter

This commit is contained in:
Viktor Tarasov 2013-12-25 23:08:03 +01:00
parent 784f0b8227
commit b1a5ebfac7
2 changed files with 25 additions and 11 deletions

View File

@ -128,7 +128,8 @@ struct sc_pkcs15_auth_info {
/* authentication method: CHV, SEN, SYMBOLIC, ... */
unsigned int auth_method;
int tries_left, max_tries;
int tries_left, max_tries;
int max_unlocks;
};
typedef struct sc_pkcs15_auth_info sc_pkcs15_auth_info_t;

View File

@ -1609,6 +1609,18 @@ do_pin_attempts(struct state *cur, int argc, char **argv)
return 0;
}
static int
do_pin_maxunlocks(struct state *cur, int argc, char **argv)
{
struct pin_info *pi = cur->pin;
unsigned int count;
if (get_uint(cur, argv[0], &count))
return 1;
pi->pin.max_unlocks = count;
return 0;
}
static int
do_pin_type(struct state *cur, int argc, char **argv)
{
@ -1814,16 +1826,17 @@ static struct block fs_blocks[] = {
* Pin section
*/
static struct command pi_commands[] = {
{ "file", 1, 1, do_pin_file },
{ "offset", 1, 1, do_pin_offset },
{ "attempts", 1, 2, do_pin_attempts },
{ "encoding", 1, 1, do_pin_type },
{ "reference", 1, 1, do_pin_reference},
{ "auth-id", 1, 1, do_pin_authid },
{ "max-length", 1, 1, do_pin_maxlength},
{ "min-length", 1, 1, do_pin_minlength},
{ "stored-length", 1, 1, do_pin_storedlength},
{ "flags", 1, -1, do_pin_flags },
{ "file", 1, 1, do_pin_file },
{ "offset", 1, 1, do_pin_offset },
{ "attempts", 1, 2, do_pin_attempts },
{ "encoding", 1, 1, do_pin_type },
{ "reference", 1, 1, do_pin_reference },
{ "auth-id", 1, 1, do_pin_authid },
{ "max-length", 1, 1, do_pin_maxlength },
{ "min-length", 1, 1, do_pin_minlength },
{ "stored-length", 1, 1, do_pin_storedlength },
{ "max-unlocks", 1, 1, do_pin_maxunlocks },
{ "flags", 1, -1, do_pin_flags },
{ NULL, 0, 0, NULL }
};