- added sc_get_data/sc_put_data

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1578 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
okir 2003-10-30 17:03:41 +00:00
parent ef4f132e61
commit c072c5e0fe
1 changed files with 23 additions and 0 deletions

View File

@ -442,6 +442,7 @@ int sc_unlock(struct sc_card *card)
card->cache_valid = 0;
if (card->ops->logout != NULL) {
sc_mutex_unlock(card->mutex);
sc_debug(card->ctx, "Calling card logout function\n");
card->ops->logout(card);
sc_mutex_lock(card->mutex);
}
@ -661,6 +662,28 @@ int sc_select_file(struct sc_card *card,
SC_FUNC_RETURN(card->ctx, 1, r);
}
int sc_get_data(sc_card_t *card, unsigned int tag, u8 *buf, size_t len)
{
int r;
sc_debug(card->ctx, "called, tag=%04x\n", tag);
if (card->ops->get_data == NULL)
SC_FUNC_RETURN(card->ctx, 2, SC_ERROR_NOT_SUPPORTED);
r = card->ops->get_data(card, tag, buf, len);
SC_FUNC_RETURN(card->ctx, 1, r);
}
int sc_put_data(sc_card_t *card, unsigned int tag, const u8 *buf, size_t len)
{
int r;
sc_debug(card->ctx, "called, tag=%04x\n", tag);
if (card->ops->put_data == NULL)
SC_FUNC_RETURN(card->ctx, 2, SC_ERROR_NOT_SUPPORTED);
r = card->ops->put_data(card, tag, buf, len);
SC_FUNC_RETURN(card->ctx, 1, r);
}
int sc_get_challenge(struct sc_card *card, u8 *rnd, size_t len)
{
int r;