- fixed compiling errors
- adjusted secure messaging to support extended length apdus - card has to support extended length, this is hardcoded at the moment, but should better be done in the appropriate card driver git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@274 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user