]> cvs.zerfleddert.de Git - proxmark3-svn/blob - client/emv/apduinfo.h
Add missing includes
[proxmark3-svn] / client / emv / apduinfo.h
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
14 #include "util.h"
15
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
22
23 typedef struct {
24 const char *ID;
25 const uint8_t Type;
26 const char *Description;
27 } APDUCode;
28
29 typedef 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
38 typedef 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
46 typedef 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
58 extern const APDUCode *GetAPDUCode(uint8_t sw1, uint8_t sw2);
59 extern const char *GetAPDUCodeDescription(uint8_t sw1, uint8_t sw2);
60 extern int APDUDecode(uint8_t *data, int len, APDUStruct *apdu);
61 extern int APDUEncode(APDUStruct *apdu, uint8_t *data, int *len);
62 extern int APDUEncodeS(sAPDU *apdu, bool extended, uint16_t le, uint8_t *data, int *len);
63 extern void APDUPrint(APDUStruct apdu);
64 extern void APDUPrintEx(APDUStruct apdu, size_t maxdatalen);
65
66 #endif
Impressum, Datenschutz