pkcs15init myEID: in profile increase size of xDF files, also ...

during initialization add the all xxDF to the ODF


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5344 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
vtarasov 2011-04-15 17:11:38 +00:00
parent 614e9fa566
commit d673e5f109
4 changed files with 38 additions and 19 deletions

View File

@ -29,13 +29,14 @@ option default {
#protected = READ=NONE, UPDATE=CHV1, DELETE=CHV2;
#unprotected = READ=NONE, UPDATE=CHV1, DELETE=CHV1;
unusedspace-size = 512;
odf-size = 256;
aodf-size = 384;
cdf-size = 512;
prkdf-size = 1485;
pukdf-size = 1200;
dodf-size = 256;
unusedspace-size = 510;
odf-size = 255;
aodf-size = 255;
cdf-size = 1530;
cdf-trusted-size = 510;
prkdf-size = 1530;
pukdf-size = 1530;
dodf-size = 255;
}
}
@ -129,22 +130,29 @@ filesystem {
}
EF PKCS15-PuKDF {
file-id = 4403;
file-id = 4404;
structure = transparent;
size = $pukdf-size;
acl = *=NEVER, READ=NONE, UPDATE=$PIN, DELETE=$SOPIN;
}
EF PKCS15-CDF {
file-id = 4404;
file-id = 4403;
structure = transparent;
size = $cdf-size;
acl = *=NEVER, READ=NONE, UPDATE=$PIN, DELETE=$SOPIN;
}
EF PKCS15-DODF {
EF PKCS15-CDF-TRUSTED {
file-id = 4405;
structure = transparent;
size = $cdf-trusted-size;
acl = *=NEVER, READ=NONE, UPDATE=$PIN, DELETE=$SOPIN;
}
EF PKCS15-DODF {
file-id = 4406;
structure = transparent;
size = $dodf-size;
acl = *=NEVER, READ=NONE, UPDATE=$PIN, DELETE=$SOPIN;
}

View File

@ -324,6 +324,10 @@ extern int sc_pkcs15init_change_attrib(struct sc_pkcs15_card *,
int,
void *,
int);
extern int sc_pkcs15init_add_object(struct sc_pkcs15_card *,
struct sc_profile *profile,
unsigned int,
struct sc_pkcs15_object *);
extern int sc_pkcs15init_delete_object(struct sc_pkcs15_card *,
struct sc_profile *,
struct sc_pkcs15_object *);

View File

@ -95,10 +95,6 @@ static int sc_pkcs15init_update_tokeninfo(struct sc_pkcs15_card *,
struct sc_profile *profile);
static int sc_pkcs15init_update_odf(struct sc_pkcs15_card *,
struct sc_profile *profile);
static int sc_pkcs15init_add_object(struct sc_pkcs15_card *,
struct sc_profile *profile,
unsigned int df_type,
struct sc_pkcs15_object *);
static int sc_pkcs15init_map_usage(unsigned long, int);
static int do_select_parent(struct sc_profile *, struct sc_pkcs15_card *,
struct sc_file *, struct sc_file **);
@ -2554,7 +2550,7 @@ sc_pkcs15init_update_any_df(struct sc_pkcs15_card *p15card,
/*
* Add an object to one of the pkcs15 directory files.
*/
static int
int
sc_pkcs15init_add_object(struct sc_pkcs15_card *p15card,
struct sc_profile *profile,
unsigned int df_type,

View File

@ -198,10 +198,19 @@ myeid_create_dir(sc_profile_t *profile, sc_pkcs15_card_t *p15card, sc_file_t *df
"PKCS15-PrKDF",
"PKCS15-PuKDF",
"PKCS15-CDF",
"PKCS15-CDF-TRUSTED",
"PKCS15-DODF",
NULL
};
static const int create_dfs_val[] = {
SC_PKCS15_PRKDF,
SC_PKCS15_PUKDF,
SC_PKCS15_CDF,
SC_PKCS15_CDF_TRUSTED,
SC_PKCS15_DODF
};
if (!profile || !p15card || !df)
return SC_ERROR_INVALID_ARGUMENTS;
@ -215,12 +224,14 @@ myeid_create_dir(sc_profile_t *profile, sc_pkcs15_card_t *p15card, sc_file_t *df
for (ii = 0; create_dfs[ii]; ii++) {
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "Create '%s'", create_dfs[ii]);
if (sc_profile_get_file(profile, create_dfs[ii], &file)) {
if (sc_profile_get_file(profile, create_dfs[ii], &file)) {
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "Inconsistent profile: cannot find %s", create_dfs[ii]);
SC_FUNC_RETURN(ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_INCONSISTENT_PROFILE);
}
r = sc_pkcs15init_create_file(profile, p15card, file);
sc_file_free(file);
r = sc_pkcs15init_add_object(p15card, profile, create_dfs_val[ii], NULL);
if (r != SC_ERROR_FILE_ALREADY_EXISTS)
SC_TEST_RET(ctx, SC_LOG_DEBUG_NORMAL, r, "Failed to create MyEID xDF file");
}