diff --git a/ccid/src/ccid.c b/ccid/src/ccid.c index af71019..faa5698 100644 --- a/ccid/src/ccid.c +++ b/ccid/src/ccid.c @@ -1125,7 +1125,7 @@ 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) { - bin_log(ctx, "Invalid APDU", abDataIn, request->dwLength); + bin_log(ctx, "Invalid APDU", abPINApdu, apdulen); goto err; } apdu.sensitive = 1; diff --git a/ccid/src/pace-tool.c b/ccid/src/pace-tool.c index f34c082..7f7ab03 100644 --- a/ccid/src/pace-tool.c +++ b/ccid/src/pace-tool.c @@ -110,7 +110,7 @@ static const char *option_help[] = { int pace_translate_apdus(struct sm_ctx *sctx, sc_card_t *card) { - u8 buf[0xff + 5]; + u8 buf[4 + 3 + 0xffff + 3]; char *read = NULL; size_t readlen = 0, apdulen; sc_apdu_t apdu; @@ -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) { - bin_log(ctx, "Invalid APDU", abDataIn, request->dwLength); + bin_log(ctx, "Invalid APDU", buf, apdulen); continue; } @@ -316,7 +316,7 @@ main (int argc, char **argv) pace_input.pin_id = PACE_PIN; if (pin) { if (sscanf(pin, "%u", &can_nb) != 1) { - fprintf(stderr, "PIN is not an unsigned integer."); + fprintf(stderr, "PIN is not an unsigned integer.\n"); exit(2); } } @@ -324,7 +324,7 @@ main (int argc, char **argv) pace_input.pin_id = PACE_CAN; if (can) { if (sscanf(can, "%u", &can_nb) != 1) { - fprintf(stderr, "CAN is not an unsigned integer."); + fprintf(stderr, "CAN is not an unsigned integer.\n"); exit(2); } } @@ -332,13 +332,13 @@ main (int argc, char **argv) pace_input.pin_id = PACE_PUK; if (puk) { if (sscanf(puk, "%u", &can_nb) != 1) { - fprintf(stderr, "PUK is not an unsigned integer."); + fprintf(stderr, "PUK is not an unsigned integer.\n"); exit(2); } } } else { fprintf(stderr, "Please specify whether to do PACE with " - "PIN, CAN or PUK."); + "PIN, CAN or PUK.\n"); exit(1); } @@ -481,7 +481,7 @@ main (int argc, char **argv) } } else { fprintf(stderr, "Please specify whether to do PACE with " - "PIN, CAN, MRZ or PUK."); + "PIN, CAN, MRZ or PUK.\n"); exit(1); } diff --git a/ccid/src/pace.c b/ccid/src/pace.c index 7551ad3..e5e7200 100644 --- a/ccid/src/pace.c +++ b/ccid/src/pace.c @@ -1161,6 +1161,10 @@ int EstablishPACEChannel(const struct sm_ctx *oldpacectx, sc_card_t *card, sctx->block_length = EVP_CIPHER_block_size(pctx->cipher); sctx->active = 1; + /* All cards with PACE support extended length + * XXX this should better be done by the card driver */ + card->caps |= SC_CARD_CAP_APDU_EXT; + err: if (info) PACEInfo_free(info); diff --git a/ccid/src/sm.c b/ccid/src/sm.c index 2ed57f0..b2690c7 100644 --- a/ccid/src/sm.c +++ b/ccid/src/sm.c @@ -578,7 +578,7 @@ int sm_transmit_apdu(const struct sm_ctx *sctx, sc_card_t *card, sc_apdu_t *apdu) { sc_apdu_t sm_apdu; - u8 rbuf[SC_MAX_APDU_BUFFER_SIZE - 2], sbuf[SC_MAX_APDU_BUFFER_SIZE - 4]; + u8 rbuf[0xffff], sbuf[0xffff]; sm_apdu.data = sbuf; sm_apdu.datalen = sizeof sbuf;