From 6bfdafde8aa3fa7d4a055665724e500583fde1df Mon Sep 17 00:00:00 2001 From: frankmorgner Date: Thu, 23 Sep 2010 11:12:08 +0000 Subject: [PATCH] added debugging of invalid apdus git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@273 96b47cad-a561-4643-ad3b-153ac7d7599c --- ccid/src/ccid.c | 6 +++++- ccid/src/pace-tool.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ccid/src/ccid.c b/ccid/src/ccid.c index 5554783..af71019 100644 --- a/ccid/src/ccid.c +++ b/ccid/src/ccid.c @@ -497,6 +497,8 @@ perform_PC_to_RDR_XfrBlock(const u8 *in, size_t inlen, __u8** out, size_t *outle sc_result = build_apdu(ctx, abDataIn, request->dwLength, &apdu); if (sc_result >= 0) sc_result = get_rapdu(&apdu, request->bSlot, &abDataOut, &abDataOutLen); + else + bin_log(ctx, "Invalid APDU", abDataIn, request->dwLength); } sc_result = get_RDR_to_PC_DataBlock(request->bSlot, request->bSeq, sc_result, @@ -1122,8 +1124,10 @@ perform_PC_to_RDR_Secure(const __u8 *in, size_t inlen, __u8** out, size_t *outle } sc_result = build_apdu(ctx, abPINApdu, apdulen, &apdu); - if (sc_result < 0) + if (sc_result < 0) { + bin_log(ctx, "Invalid APDU", abDataIn, request->dwLength); goto err; + } apdu.sensitive = 1; new_pin.min_length = curr_pin.min_length = wPINMaxExtraDigit >> 8; diff --git a/ccid/src/pace-tool.c b/ccid/src/pace-tool.c index 5ce61d0..f34c082 100644 --- a/ccid/src/pace-tool.c +++ b/ccid/src/pace-tool.c @@ -143,7 +143,7 @@ int pace_translate_apdus(struct sm_ctx *sctx, sc_card_t *card) r = build_apdu(card->ctx, buf, apdulen, &apdu); if (r < 0) { - sc_error(card->ctx, "Could not format APDU"); + bin_log(ctx, "Invalid APDU", abDataIn, request->dwLength); continue; }