"--assert-pristine" workaround for Starcos cards (see comment in the patch)

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1776 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
nils 2004-04-21 20:11:56 +00:00
parent f044157553
commit 8cb6a3f94a

View File

@ -458,12 +458,20 @@ do_assert_pristine(struct sc_card *card)
card->ctx->suppress_errors++;
sc_format_path("2F00", &path);
/* Note: in case of an empty starcos card (no MF) the
* card returns SC_ERROR_NOT_ALLOWED when one tries
* to select a file. As no MF implies no pkcs15 structure
* not error should returned in this case. I know
* this isn't really beautiful ... Nils
*/
if ((r = sc_select_file(card, &path, NULL)) >= 0
|| r != SC_ERROR_FILE_NOT_FOUND)
|| !(r == SC_ERROR_FILE_NOT_FOUND
|| (r == SC_ERROR_NOT_ALLOWED && !strcmp(card->name, "StarCOS"))))
res = -1;
sc_format_path("5015", &path);
if ((r = sc_select_file(card, &path, NULL)) >= 0
|| r != SC_ERROR_FILE_NOT_FOUND)
|| !(r != SC_ERROR_FILE_NOT_FOUND
|| (r == SC_ERROR_NOT_ALLOWED && !strcmp(card->name, "StarCOS"))))
res = -1;
card->ctx->suppress_errors--;