Made the construct_fci() a card operaton, just like it has been done with process_fci() before

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1291 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
sth 2003-07-23 14:31:21 +00:00
parent c34eb2b147
commit 06d4311e80
2 changed files with 8 additions and 2 deletions

View File

@ -491,7 +491,7 @@ static int iso7816_get_challenge(struct sc_card *card, u8 *rnd, size_t len)
return 0;
}
static int construct_fci(const struct sc_file *file, u8 *out, size_t *outlen)
static int iso7816_construct_fci(const struct sc_file *file, u8 *out, size_t *outlen)
{
u8 *p = out;
u8 buf[64];
@ -549,7 +549,10 @@ static int iso7816_create_file(struct sc_card *card, struct sc_file *file)
struct sc_apdu apdu;
len = SC_MAX_APDU_BUFFER_SIZE;
r = construct_fci(file, sbuf, &len);
if (card->ops->construct_fci == NULL)
SC_FUNC_RETURN(card->ctx, 2, SC_ERROR_NOT_SUPPORTED);
r = card->ops->construct_fci(file, sbuf, &len);
SC_TEST_RET(card->ctx, r, "construct_fci() failed");
sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0xE0, 0x00, 0x00);
@ -973,6 +976,7 @@ struct sc_card_driver * sc_get_iso7816_driver(void)
iso_ops.pin_cmd = iso7816_pin_cmd;
iso_ops.logout = iso7816_logout;
iso_ops.process_fci = iso7816_process_fci;
iso_ops.construct_fci = iso7816_construct_fci;
}
return &iso_driver;
}

View File

@ -555,6 +555,7 @@ struct sc_card_operations {
void *data);
int (*process_fci)(struct sc_card *card, struct sc_file *file,
const u8 *buf, size_t buflen);
int (*construct_fci)(const struct sc_file *file, u8 *out, size_t *outlen);
/* pin_cmd: verify/change/unblock command; optionally using the
* card's pin pad if supported.
@ -841,6 +842,7 @@ extern struct sc_card_driver *sc_get_mcrd_driver(void);
extern struct sc_card_driver *sc_get_setcos_driver(void);
extern struct sc_card_driver *sc_get_starcos_driver(void);
extern struct sc_card_driver *sc_get_tcos_driver(void);
extern struct sc_card_driver *sc_get_prisma_driver(void);
#ifdef __cplusplus
}