added sc_sm_stop
implementation taken from the ISO SM driver of https://github.com/frankmorgner/vsmartcard/tree/master/npa
This commit is contained in:
parent
00b04254f7
commit
e07c4bcfbb
@ -159,22 +159,47 @@ sc_sm_single_transmit(struct sc_card *card, struct sc_apdu *apdu)
|
||||
|
||||
LOG_FUNC_RETURN(ctx, rv);
|
||||
}
|
||||
|
||||
int
|
||||
sc_sm_stop(struct sc_card *card)
|
||||
{
|
||||
int r = SC_SUCCESS;
|
||||
|
||||
if (card) {
|
||||
if (card->sm_ctx.sm_mode == SM_MODE_TRANSMIT
|
||||
&& card->sm_ctx.ops.close)
|
||||
r = card->sm_ctx.ops.close(card);
|
||||
card->sm_ctx.sm_mode = SM_MODE_NONE;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int
|
||||
sc_sm_parse_answer(struct sc_card *card, unsigned char *resp_data, size_t resp_len,
|
||||
struct sm_card_response *out)
|
||||
{
|
||||
return SC_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
int
|
||||
sc_sm_update_apdu_response(struct sc_card *card, unsigned char *resp_data, size_t resp_len,
|
||||
int ref_rv, struct sc_apdu *apdu)
|
||||
{
|
||||
return SC_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
int
|
||||
sc_sm_single_transmit(struct sc_card *card, struct sc_apdu *apdu)
|
||||
{
|
||||
return SC_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
int
|
||||
sc_sm_stop(struct sc_card *card)
|
||||
{
|
||||
return SC_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
#endif
|
||||
|
@ -353,6 +353,18 @@ int sc_sm_parse_answer(struct sc_card *, unsigned char *, size_t, struct sm_card
|
||||
int sc_sm_update_apdu_response(struct sc_card *, unsigned char *, size_t, int, struct sc_apdu *);
|
||||
int sc_sm_single_transmit(struct sc_card *, struct sc_apdu *);
|
||||
|
||||
/**
|
||||
* @brief Stops SM and frees allocated ressources.
|
||||
*
|
||||
* Calls \a card->sm_ctx.ops.close() if available and \c card->sm_ctx.sm_mode
|
||||
* is \c SM_MODE_TRANSMIT
|
||||
*
|
||||
* @param[in] card
|
||||
*
|
||||
* @return \c SC_SUCCESS or error code if an error occurred
|
||||
*/
|
||||
int sc_sm_stop(struct sc_card *card);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user