1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2017 Merlok
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
7 //-----------------------------------------------------------------------------
8 // APDU status bytes information
9 //-----------------------------------------------------------------------------
16 #define APDUCODE_TYPE_NONE 0
17 #define APDUCODE_TYPE_INFO 1
18 #define APDUCODE_TYPE_WARNING 2
19 #define APDUCODE_TYPE_ERROR 3
20 #define APDUCODE_TYPE_SECURITY 4
25 const char *Description
;
28 const APDUCode
*GetAPDUCode(uint8_t sw1
, uint8_t sw2
);
29 const char *GetAPDUCodeDescription(uint8_t sw1
, uint8_t sw2
);
46 } PACKED ExtAPDUHeader
;
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
*sapdu
, 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
);
66 void SAPDUPrint(sAPDU apdu
, size_t maxdatalen
);