]> git.zerfleddert.de Git - proxmark3-svn/blame - client/emv/apduinfo.h
fix 'hf iclass sim':
[proxmark3-svn] / client / emv / apduinfo.h
CommitLineData
fe346768 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// APDU status bytes information
9//-----------------------------------------------------------------------------
10
11#ifndef APDUINFO_H__
12#define APDUINFO_H__
13
5a446cb2 14#include "util.h"
fe346768 15
5a446cb2 16
17#define APDUCODE_TYPE_NONE 0
18#define APDUCODE_TYPE_INFO 1
19#define APDUCODE_TYPE_WARNING 2
20#define APDUCODE_TYPE_ERROR 3
21#define APDUCODE_TYPE_SECURITY 4
fe346768 22
23typedef struct {
24 const char *ID;
25 const uint8_t Type;
26 const char *Description;
27} APDUCode;
5a446cb2 28
29typedef struct {
30 uint8_t CLA;
31 uint8_t INS;
32 uint8_t P1;
33 uint8_t P2;
34 uint8_t Lc;
35 uint8_t *data;
36} PACKED sAPDU;
37
38typedef struct {
39 uint8_t cla;
40 uint8_t ins;
41 uint8_t p1;
42 uint8_t p2;
43 uint8_t lc[3];
44} PACKED ExtAPDUHeader;
45
46typedef struct {
47 uint8_t cla;
48 uint8_t ins;
49 uint8_t p1;
50 uint8_t p2;
51 uint16_t lc;
52 uint8_t *data;
53 uint32_t le;
54 bool extended_apdu;
55 uint8_t case_type;
56} PACKED APDUStruct;
57
58extern const APDUCode *GetAPDUCode(uint8_t sw1, uint8_t sw2);
59extern const char *GetAPDUCodeDescription(uint8_t sw1, uint8_t sw2);
60extern int APDUDecode(uint8_t *data, int len, APDUStruct *apdu);
61extern int APDUEncode(APDUStruct *apdu, uint8_t *data, int *len);
62extern int APDUEncodeS(sAPDU *apdu, bool extended, uint16_t le, uint8_t *data, int *len);
63extern void APDUPrint(APDUStruct apdu);
64extern void APDUPrintEx(APDUStruct apdu, size_t maxdatalen);
fe346768 65
66#endif
Impressum, Datenschutz