oberthur updates from Tarasov Viktor <vtarasov@idealx.com>

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2471 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
nils 2005-08-09 07:53:59 +00:00
parent 2b6a2cb19c
commit a3ae7da3ab
2 changed files with 25 additions and 19 deletions

View File

@ -49,6 +49,7 @@ static struct sc_atr_table oberthur_atrs[] = {
{ "3B:7D:18:00:00:00:31:80:71:8E:64:77:E3:02:00:82:90:00", NULL, "Oberthur 64k v4/2.1.1", SC_CARD_TYPE_OBERTHUR_64K },
{ "3B:7D:11:00:00:00:31:80:71:8E:64:77:E3:01:00:82:90:00", NULL, "Oberthur 64k v5", SC_CARD_TYPE_OBERTHUR_64K },
{ "3B:7D:11:00:00:00:31:80:71:8E:64:77:E3:02:00:82:90:00", NULL, "Oberthur 64k v5/2.2.0", SC_CARD_TYPE_OBERTHUR_64K },
{ "3B:7B:18:00:00:00:31:C0:64:77:E3:03:00:82:90:00", NULL, "Oberthur 64k CosmopolIC v5.2/2.2", SC_CARD_TYPE_OBERTHUR_64K },
{ NULL }
};
@ -807,6 +808,9 @@ auth_list_files(sc_card_t *card, u8 *buf, size_t buflen)
rv = sc_check_sw(card, apdu.sw1, apdu.sw2);
SC_TEST_RET(card->ctx, rv, "Card returned error");
if (apdu.resplen == 0x100 && rbuf[0]==0 && rbuf[1]==0)
return 0;
buflen = buflen < apdu.resplen ? buflen : apdu.resplen;
memcpy(buf, rbuf, buflen);

View File

@ -186,7 +186,18 @@ cosm_init_app(struct sc_profile *profile, sc_card_t *card,
const u8 *puk, size_t puk_len)
{
int r;
size_t ii;
sc_file_t *file = NULL;
static const char *create_dfs[8] = {
"private-DF",
"public-DF",
"PKCS15-ODF",
"PKCS15-AODF",
"PKCS15-PrKDF",
"PKCS15-PuKDF",
"PKCS15-CDF",
"PKCS15-DODF"
};
sc_debug(card->ctx, "pin_len %i; puk_len %i\n", pin_len, puk_len);
/* Create the application DF */
@ -196,27 +207,18 @@ cosm_init_app(struct sc_profile *profile, sc_card_t *card,
/* Oberthur AWP file system is expected.*/
/* Create private objects DF */
if (sc_profile_get_file(profile, "private-DF", &file)) {
sc_error(card->ctx, "Inconsistent profile: cannot find private-DF");
return SC_ERROR_INCONSISTENT_PROFILE;
for (ii = 0; ii<sizeof(create_dfs)/sizeof(char *); ii++) {
if (sc_profile_get_file(profile, create_dfs[ii], &file)) {
sc_error(card->ctx, "Inconsistent profile: cannot find %s", create_dfs[ii]);
return SC_ERROR_INCONSISTENT_PROFILE;
}
r = sc_pkcs15init_create_file(profile, card, file);
sc_file_free(file);
if (r && r!=SC_ERROR_FILE_ALREADY_EXISTS)
return r;
}
r = sc_pkcs15init_create_file(profile, card, file);
sc_file_free(file);
if (r)
return r;
/* Create public objects DF */
if (sc_profile_get_file(profile, "public-DF", &file)) {
sc_error(card->ctx, "Inconsistent profile: cannot find public-DF");
return SC_ERROR_INCONSISTENT_PROFILE;
}
r = sc_pkcs15init_create_file(profile, card, file);
sc_file_free(file);
if (r)
return r;
/* Create Oberthur AWP application DF (5011),
* and populate with Oberthur's xxDF files*/
r = sc_profile_get_file(profile, COSM_TITLE"-AppDF", &file);