- dropped pace_transmit_apdu in favour of a solution with sm_transmit_apdu.

post_transmit and pre_transmit can be used to perform actions before
  encrypting/decrypting a sm apdu (such as incrementing the ssc for pace).
- fixed ssc problems. encrypted communication with more than one apdu (e.g.
  resuming the pin) is now working.
- fixed uninitialized pointer in sm_decrypt


git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@131 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
frankmorgner
2010-06-05 14:34:50 +00:00
parent c88e4892ac
commit e02e2abdfb
5 changed files with 41 additions and 60 deletions

View File

@@ -578,10 +578,21 @@ int sm_transmit_apdu(const struct sm_ctx *sctx, sc_card_t *card,
sm_apdu.resp = rbuf;
sm_apdu.resplen = sizeof rbuf;
if ((apdu->cla & 0x0C) == 0x0C) {
sc_debug(card->ctx, "Given APDU is already protected with some secure messaging.");
SC_FUNC_RETURN(card->ctx, SC_LOG_TYPE_DEBUG, sc_transmit_apdu(card, apdu));
}
if (sctx->pre_transmit)
SC_TEST_RET(card->ctx, sctx->pre_transmit(card, sctx, apdu),
"Could not complete SM specific pre transmit routine");
SC_TEST_RET(card->ctx, sm_encrypt(sctx, card, apdu, &sm_apdu),
"Could not encrypt APDU");
SC_TEST_RET(card->ctx, sc_transmit_apdu(card, &sm_apdu),
"Could not transmit SM APDU");
if (sctx->post_transmit)
SC_TEST_RET(card->ctx, sctx->post_transmit(card, sctx, &sm_apdu),
"Could not complete SM specific post transmit routine");
SC_TEST_RET(card->ctx, sm_decrypt(sctx, card, &sm_apdu, apdu),
"Could not decrypt APDU");