From: merlokk Date: Thu, 2 Nov 2017 12:11:42 +0000 (+0200) Subject: tlv decoder works. X-Git-Tag: v3.1.0~133^2~6 X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/23207d748f65f97365a608f2a9abfc3ac5997413?ds=sidebyside;hp=499df9088d5845d954918da51dc339becd4a7da4 tlv decoder works. --- diff --git a/client/cmdhf14a.c b/client/cmdhf14a.c index f3189c10..86cfea2f 100644 --- a/client/cmdhf14a.c +++ b/client/cmdhf14a.c @@ -760,7 +760,7 @@ int CmdHF14AAPDU(const char *cmd) { PrintAndLog("APDU response: %02x %02x - %s", data[datalen - 2], data[datalen - 1], GetAPDUCodeDescription(data[datalen - 2], data[datalen - 1])); - // here TLV decoder... + // TLV decoder if (decodeTLV && datalen > 4) { TLVPrintFromBuffer(data, datalen - 2); } diff --git a/client/emv/emv_tags.c b/client/emv/emv_tags.c index 9bcf2004..1aae847a 100644 --- a/client/emv/emv_tags.c +++ b/client/emv/emv_tags.c @@ -30,7 +30,6 @@ enum emv_tag_t { EMV_TAG_STRING, EMV_TAG_NUMERIC, EMV_TAG_YYMMDD, - EMV_TAG_FCI, }; struct emv_tag { @@ -128,7 +127,7 @@ static const struct emv_tag emv_tags[] = { { 0x5f30, "Service Code", EMV_TAG_NUMERIC }, { 0x5f34, "Application Primary Account Number (PAN) Sequence Number", EMV_TAG_NUMERIC }, { 0x61 , "Application Template" }, - { 0x6f , "File Control Information (FCI) Template", EMV_TAG_FCI }, + { 0x6f , "File Control Information (FCI) Template" }, { 0x70 , "READ RECORD Response Message Template" }, { 0x77 , "Response Message Template Format 2" }, { 0x80 , "Response Message Template Format 1" }, @@ -269,25 +268,6 @@ static void emv_tag_dump_dol(const struct tlv *tlv, const struct emv_tag *tag, F } } -static void emv_tag_dump_fci(const struct tlv *tlv, const struct emv_tag *tag, FILE *f) { - const unsigned char *buf = tlv->value; - size_t left = tlv->len; - - while (left) { - struct tlv doltlv; - const struct emv_tag *doltag; - - if (!tlv_parse_tl(&buf, &left, &doltlv)) { - fprintf(f, "Invalid Tag-Len\n"); - continue; - } - - doltag = emv_get_tag(&doltlv); - - fprintf(f, "\t--%2hx[%02zx]'%s'\n", doltlv.tag, doltlv.len, doltag->name); - } -} - static void emv_tag_dump_string(const struct tlv *tlv, const struct emv_tag *tag, FILE *f) { fprintf(f, "\tString value '"); @@ -471,9 +451,6 @@ bool emv_tag_dump(const struct tlv *tlv, FILE *f) case EMV_TAG_YYMMDD: emv_tag_dump_yymmdd(tlv, tag, f); break; - case EMV_TAG_FCI: - emv_tag_dump_fci(tlv, tag, f); - break; }; return true; diff --git a/client/emv/emvcore.c b/client/emv/emvcore.c index 6f8892fe..9264b110 100644 --- a/client/emv/emvcore.c +++ b/client/emv/emvcore.c @@ -19,7 +19,7 @@ static bool print_cb(void *data, const struct tlv *tlv) { void TLVPrintFromBuffer(uint8_t *data, int datalen) { struct tlvdb *t = NULL; - t = tlvdb_parse(data, datalen); + t = tlvdb_parse_multi(data, datalen); if (t) { PrintAndLog("TLV decoded:");