pkcs15init: add 'minidriver-style' profile option
The on-card support of minidriver could need some MD specific pkcs#15 (DATA) objects. There is no standard for these objects. New option will allow to choose one of the possible implementations.
This commit is contained in:
parent
10e1ad001d
commit
b432e9767f
|
@ -155,6 +155,9 @@ struct sc_pkcs15init_operations {
|
|||
#define SC_PKCS15INIT_USER_PUK 3
|
||||
#define SC_PKCS15INIT_NPINS 4
|
||||
|
||||
#define SC_PKCS15INIT_MD_STYLE_NONE 0
|
||||
#define SC_PKCS15INIT_MD_STYLE_GEMALTO 1
|
||||
|
||||
struct sc_pkcs15init_callbacks {
|
||||
/*
|
||||
* Get a PIN from the front-end. The first argument is
|
||||
|
|
|
@ -199,6 +199,11 @@ static struct map idStyleNames[] = {
|
|||
{ "rfc2459", SC_PKCS15INIT_ID_STYLE_RFC2459 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
static struct map mdStyleNames[] = {
|
||||
{ "none", SC_PKCS15INIT_MD_STYLE_NONE },
|
||||
{ "gemalto", SC_PKCS15INIT_MD_STYLE_GEMALTO },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
static struct {
|
||||
const char * name;
|
||||
struct map * addr;
|
||||
|
@ -899,6 +904,12 @@ do_pkcs15_id_style(struct state *cur, int argc, char **argv)
|
|||
return map_str2int(cur, argv[0], &cur->profile->id_style, idStyleNames);
|
||||
}
|
||||
|
||||
static int
|
||||
do_minidriver_support_style(struct state *cur, int argc, char **argv)
|
||||
{
|
||||
return map_str2int(cur, argv[0], &cur->profile->md_style, mdStyleNames);
|
||||
}
|
||||
|
||||
/*
|
||||
* Process an option block
|
||||
*/
|
||||
|
@ -1781,6 +1792,7 @@ static struct command p15_commands[] = {
|
|||
{ "encode-df-length", 1, 1, do_encode_df_length },
|
||||
{ "do-last-update", 1, 1, do_encode_update_field },
|
||||
{ "pkcs15-id-style", 1, 1, do_pkcs15_id_style },
|
||||
{ "minidriver-support-style", 1, 1, do_minidriver_support_style },
|
||||
{ NULL, 0, 0, NULL }
|
||||
};
|
||||
|
||||
|
@ -1965,9 +1977,7 @@ sc_profile_find_file(struct sc_profile *pro,
|
|||
for (fi = pro->ef_list; fi; fi = fi->next) {
|
||||
sc_path_t *fpath = &fi->file->path;
|
||||
|
||||
if (!strcasecmp(fi->ident, name)
|
||||
&& fpath->len >= len
|
||||
&& !memcmp(fpath->value, path->value, len))
|
||||
if (!strcasecmp(fi->ident, name) && fpath->len >= len && !memcmp(fpath->value, path->value, len))
|
||||
return fi;
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
@ -124,6 +124,9 @@ struct sc_profile {
|
|||
|
||||
/* PKCS15 object ID style */
|
||||
unsigned int id_style;
|
||||
|
||||
/* Minidriver support style */
|
||||
unsigned int md_style;
|
||||
};
|
||||
|
||||
struct sc_profile *sc_profile_new(void);
|
||||
|
|
Loading…
Reference in New Issue