]> git.zerfleddert.de Git - proxmark3-svn/blame - client/emv/emvcore.c
Merge pull request #471 from marshmellow42/master
[proxmark3-svn] / client / emv / emvcore.c
CommitLineData
a2bb2735 1//-----------------------------------------------------------------------------
2// Copyright (C) 2017 Merlok
3//
4// This code is licensed to you under the terms of the GNU GPL, version 2 or,
5// at your option, any later version. See the LICENSE.txt file for the text of
6// the license.
7//-----------------------------------------------------------------------------
8// EMV core functions
9//-----------------------------------------------------------------------------
10
11#include "emvcore.h"
12
33a9982c 13static bool print_cb(void *data, const struct tlv *tlv, int level, bool is_leaf) {
43912d63 14 emv_tag_dump(tlv, stdout, level);
33a9982c 15 if (is_leaf) {
16 dump_buffer(tlv->value, tlv->len, stdout, level);
17 }
a2bb2735 18
19 return true;
20}
21
22void TLVPrintFromBuffer(uint8_t *data, int datalen) {
23 struct tlvdb *t = NULL;
23207d74 24 t = tlvdb_parse_multi(data, datalen);
a2bb2735 25 if (t) {
26 PrintAndLog("TLV decoded:");
27
43912d63 28 tlvdb_visit(t, print_cb, NULL, 0);
a2bb2735 29 tlvdb_free(t);
30 } else {
31 PrintAndLog("TLV ERROR: Can't parse response as TLV tree.");
32 }
33}
Impressum, Datenschutz