mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
add: first part emv @merlokk
This commit is contained in:
parent
ccfcd8e991
commit
23506bd1d7
10 changed files with 1443 additions and 0 deletions
52
client/emv/tlv.h
Normal file
52
client/emv/tlv.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* libopenemv - a library to work with EMV family of smart cards
|
||||
* Copyright (C) 2012, 2015 Dmitry Eremin-Solenikov
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* https://github.com/lumag/emv-tools/blob/master/lib/include/openemv/tlv.h
|
||||
*/
|
||||
|
||||
#ifndef TLV_H
|
||||
#define TLV_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef uint16_t tlv_tag_t;
|
||||
|
||||
struct tlv {
|
||||
tlv_tag_t tag;
|
||||
size_t len;
|
||||
const unsigned char *value;
|
||||
};
|
||||
|
||||
struct tlvdb;
|
||||
typedef bool (*tlv_cb)(void *data, const struct tlv *tlv);
|
||||
|
||||
struct tlvdb *tlvdb_fixed(tlv_tag_t tag, size_t len, const unsigned char *value);
|
||||
struct tlvdb *tlvdb_external(tlv_tag_t tag, size_t len, const unsigned char *value);
|
||||
struct tlvdb *tlvdb_parse(const unsigned char *buf, size_t len);
|
||||
struct tlvdb *tlvdb_parse_multi(const unsigned char *buf, size_t len);
|
||||
void tlvdb_free(struct tlvdb *tlvdb);
|
||||
|
||||
void tlvdb_add(struct tlvdb *tlvdb, struct tlvdb *other);
|
||||
|
||||
void tlvdb_visit(const struct tlvdb *tlvdb, tlv_cb cb, void *data);
|
||||
const struct tlv *tlvdb_get(const struct tlvdb *tlvdb, tlv_tag_t tag, const struct tlv *prev);
|
||||
|
||||
bool tlv_parse_tl(const unsigned char **buf, size_t *len, struct tlv *tlv);
|
||||
unsigned char *tlv_encode(const struct tlv *tlv, size_t *len);
|
||||
bool tlv_is_constructed(const struct tlv *tlv);
|
||||
bool tlv_equal(const struct tlv *a, const struct tlv *b);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue