Improve EMV and default driver
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3735 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
0f4092f12d
commit
b6f9345ea1
|
@ -31,7 +31,7 @@ static struct sc_card_driver default_drv = {
|
|||
|
||||
static int default_finish(sc_card_t *card)
|
||||
{
|
||||
return 0;
|
||||
return SC_SUCCESS;
|
||||
}
|
||||
|
||||
static int default_match_card(sc_card_t *card)
|
||||
|
@ -84,12 +84,12 @@ static int autodetect_class(sc_card_t *card)
|
|||
if (card->ctx->debug >= 2)
|
||||
sc_debug(card->ctx, "SELECT FILE returned %d bytes\n",
|
||||
apdu.resplen);
|
||||
return 0;
|
||||
return SC_SUCCESS;
|
||||
}
|
||||
if (rbuf[0] == 0x6F) {
|
||||
if (card->ctx->debug >= 2)
|
||||
sc_debug(card->ctx, "SELECT FILE seems to behave according to ISO 7816-4\n");
|
||||
return 0;
|
||||
return SC_SUCCESS;
|
||||
}
|
||||
if (rbuf[0] == 0x00 && rbuf[1] == 0x00) {
|
||||
struct sc_card_driver *drv;
|
||||
|
@ -97,9 +97,9 @@ static int autodetect_class(sc_card_t *card)
|
|||
sc_debug(card->ctx, "SELECT FILE seems to return Schlumberger 'flex stuff\n");
|
||||
drv = sc_get_cryptoflex_driver();
|
||||
card->ops->select_file = drv->ops->select_file;
|
||||
return 0;
|
||||
return SC_SUCCESS;
|
||||
}
|
||||
return 0;
|
||||
return SC_SUCCESS;
|
||||
}
|
||||
|
||||
static int default_init(sc_card_t *card)
|
||||
|
@ -114,7 +114,7 @@ static int default_init(sc_card_t *card)
|
|||
return SC_ERROR_INVALID_CARD;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return SC_SUCCESS;
|
||||
}
|
||||
|
||||
static struct sc_card_driver * sc_get_driver(void)
|
||||
|
@ -129,9 +129,7 @@ static struct sc_card_driver * sc_get_driver(void)
|
|||
return &default_drv;
|
||||
}
|
||||
|
||||
#if 1
|
||||
struct sc_card_driver * sc_get_default_driver(void)
|
||||
{
|
||||
return sc_get_driver();
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
static struct sc_card_operations emv_ops;
|
||||
static struct sc_card_driver emv_drv = {
|
||||
"EMV compatible cards",
|
||||
"EMV cards (unsupported)",
|
||||
"emv",
|
||||
&emv_ops,
|
||||
NULL, 0, NULL
|
||||
|
@ -31,7 +31,7 @@ static struct sc_card_driver emv_drv = {
|
|||
|
||||
static int emv_finish(sc_card_t *card)
|
||||
{
|
||||
return 0;
|
||||
return SC_SUCCESS;
|
||||
}
|
||||
|
||||
static int parse_atr(const u8 *atr, size_t atr_len, int *t0_out, int *tx1, int *tx2,
|
||||
|
@ -120,7 +120,7 @@ static int emv_init(sc_card_t *card)
|
|||
card->drv_data = NULL;
|
||||
card->cla = 0x00;
|
||||
|
||||
return 0;
|
||||
return SC_SUCCESS;
|
||||
}
|
||||
|
||||
static int emv_select_file(sc_card_t *card, const sc_path_t *path,
|
||||
|
@ -137,7 +137,7 @@ static int emv_select_file(sc_card_t *card, const sc_path_t *path,
|
|||
(*file)->type = SC_FILE_TYPE_DF;
|
||||
if (file != NULL && (*file)->namelen)
|
||||
(*file)->type = SC_FILE_TYPE_DF;
|
||||
return 0;
|
||||
return SC_SUCCESS;
|
||||
}
|
||||
|
||||
static struct sc_card_driver * sc_get_driver(void)
|
||||
|
@ -147,15 +147,13 @@ static struct sc_card_driver * sc_get_driver(void)
|
|||
emv_ops = *iso_drv->ops;
|
||||
emv_ops.match_card = emv_match_card;
|
||||
emv_ops.init = emv_init;
|
||||
emv_ops.finish = emv_finish;
|
||||
emv_ops.finish = emv_finish;
|
||||
emv_ops.select_file = emv_select_file;
|
||||
|
||||
return &emv_drv;
|
||||
}
|
||||
|
||||
#if 1
|
||||
struct sc_card_driver * sc_get_emv_driver(void)
|
||||
{
|
||||
return sc_get_driver();
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue