pkcs15-init tool: simplify 'pristine' test - it's ok if MF, DIR or PKCS15-AppDF is not selectable
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4014 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
53d29939fd
commit
0330993a61
|
@ -579,33 +579,25 @@ do_assert_pristine(sc_card_t *in_card)
|
||||||
sc_path_t path;
|
sc_path_t path;
|
||||||
int r, ok = 1;
|
int r, ok = 1;
|
||||||
|
|
||||||
/* we need FILE NOT FOUND.
|
sc_format_path("3F00", &path);
|
||||||
* - on starcos card NOT ALLOWED is also ok, as the MF does not exist.
|
r = sc_select_file(in_card, &path, NULL);
|
||||||
* - on setcos 4.4 card, we should get 6F00 (translates to
|
if (r)
|
||||||
* SC_ERROR_CARD_CMD_FAILED) to indicate that no MF exists. */
|
goto end;
|
||||||
|
|
||||||
|
|
||||||
sc_format_path("2F00", &path);
|
sc_format_path("2F00", &path);
|
||||||
r = sc_select_file(in_card, &path, NULL);
|
r = sc_select_file(in_card, &path, NULL);
|
||||||
|
if (r)
|
||||||
|
goto end;
|
||||||
|
|
||||||
if (r != SC_ERROR_FILE_NOT_FOUND) {
|
/* For a while only the presence of OpenSC on-card pkcs#15 is checked.
|
||||||
ok &= (r == SC_ERROR_NOT_ALLOWED &&
|
TODO: Parse DIR(2F00) to get know if there is some PKCS#15 applications.*/
|
||||||
strcmp(in_card->name, "STARCOS SPK 2.3") == 0) ||
|
|
||||||
(r == SC_ERROR_CARD_CMD_FAILED &&
|
|
||||||
in_card->type == SC_CARD_TYPE_SETCOS_44);
|
|
||||||
}
|
|
||||||
|
|
||||||
sc_format_path("5015", &path);
|
sc_format_path("5015", &path);
|
||||||
r = sc_select_file(in_card, &path, NULL);
|
r = sc_select_file(in_card, &path, NULL);
|
||||||
|
if (r)
|
||||||
|
goto end;
|
||||||
|
|
||||||
if (r != SC_ERROR_FILE_NOT_FOUND) {
|
ok = 0;
|
||||||
ok &= (r == SC_ERROR_NOT_ALLOWED &&
|
end:
|
||||||
strcmp(in_card->name, "STARCOS SPK 2.3") == 0) ||
|
|
||||||
(r == SC_ERROR_CARD_CMD_FAILED &&
|
|
||||||
in_card->type == SC_CARD_TYPE_SETCOS_44);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Card not pristine; detected (possibly incomplete) "
|
"Card not pristine; detected (possibly incomplete) "
|
||||||
|
|
Loading…
Reference in New Issue