use error code if no SM was applied

This commit is contained in:
Frank Morgner 2012-07-03 22:27:43 +02:00 committed by Viktor Tarasov
parent 1d6fae2241
commit 31bdbd6b6a
3 changed files with 3 additions and 2 deletions

View File

@ -475,7 +475,7 @@ sc_single_sm_transmit(struct sc_card *card, struct sc_apdu *apdu)
rv = card->sm_ctx.ops.get_sm_apdu(card, apdu, &sm_apdu);
LOG_TEST_RET(ctx, rv, "get SM APDU error");
if (!sm_apdu) {
if (rv == SC_ERROR_SM_NOT_APPLIED) {
/* SM wrap of this APDU is ignored by card driver.
* Send plain APDU to the reader driver */
rv = card->reader->ops->transmit(card->reader, apdu);

View File

@ -2319,7 +2319,7 @@ authentic_sm_get_wrapped_apdu(struct sc_card *card, struct sc_apdu *plain, struc
|| (plain->cla==0x80 && plain->ins==0x50)
) {
sc_log(ctx, "SM wrap is not applied for this APDU");
LOG_FUNC_RETURN(ctx, SC_SUCCESS);
LOG_FUNC_RETURN(ctx, SC_ERROR_SM_NOT_APPLIED);
}
if (card->sm_ctx.sm_mode != SM_MODE_TRANSMIT)

View File

@ -119,6 +119,7 @@ extern "C" {
#define SC_ERROR_SM_RAND_FAILED -1607
#define SC_ERROR_SM_KEYSET_NOT_FOUND -1608
#define SC_ERROR_SM_IFD_DATA_MISSING -1609
#define SC_ERROR_SM_NOT_APPLIED -1610
/* Errors that do not fit the categories above */