Have the option not to update the ODF (the lastUpdate field), this is usefull for cards that don't have an ODF that is un-writable or too small

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2515 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
sth 2005-08-24 09:50:48 +00:00
parent eec0e22b03
commit bd76165319
4 changed files with 13 additions and 1 deletions

View File

@ -354,7 +354,7 @@ sc_pkcs15init_unbind(struct sc_profile *profile)
int r;
struct sc_context *ctx = profile->card->ctx;
if (profile->dirty != 0 && profile->p15_data != NULL) {
if (profile->dirty != 0 && profile->p15_data != NULL && profile->pkcs15.odf_last_update) {
r = sc_pkcs15init_update_tokeninfo(profile->p15_data, profile);
if (r < 0)
sc_error(ctx, "Failed to update TokenInfo: %s\n", sc_strerror(r));

View File

@ -20,6 +20,8 @@ pkcs15 {
direct-certificates = no;
# Put the DF length into the ODF file?
encode-df-length = no;
# Have a lastUpdate field in the ODF?
odf-last-update = yes;
}
# Default settings.

View File

@ -255,6 +255,8 @@ sc_profile_new(void)
return NULL;
pro->p15_spec = p15card = sc_pkcs15_card_new();
pro->pkcs15.odf_last_update = 1;
/* Set up EF(TokenInfo) and EF(ODF) */
p15card->file_tokeninfo = init_file(SC_FILE_TYPE_WORKING_EF);
p15card->file_odf = init_file(SC_FILE_TYPE_WORKING_EF);
@ -749,6 +751,12 @@ do_encode_df_length(struct state *cur, int argc, char **argv)
return get_bool(cur, argv[0], &cur->profile->pkcs15.encode_df_length);
}
static int
do_encode_odf_update_field(struct state *cur, int argc, char **argv)
{
return get_bool(cur, argv[0], &cur->profile->pkcs15.odf_last_update);
}
/*
* Process an option block
*/
@ -1489,6 +1497,7 @@ static struct command pi_commands[] = {
static struct command p15_commands[] = {
{ "direct-certificates", 1, 1, do_direct_certificates },
{ "encode-df-length", 1, 1, do_encode_df_length },
{ "odf-last-update", 1, 1, do_encode_odf_update_field },
{ NULL, 0, 0, NULL }
};

View File

@ -110,6 +110,7 @@ struct sc_profile {
struct {
unsigned int direct_certificates;
unsigned int encode_df_length;
unsigned int odf_last_update;
} pkcs15;
/* PKCS15 information */