mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-11-12 04:26:41 +08:00
d19754567d
* .h include only the strict minimum for their own parsing * this forces all files to include explicitment their needs and not count on far streched dependencies * this helps Makefile to rebuild only the minimum * according to this rule, most standalone .h are now gone * big app.h is gone * remove seldom __cplusplus, if c++ happens, everything will have to be done properly anyway * all unrequired include were removed * split common/ into common/ (client+arm) and common_arm/ (os+bootloader) * bring zlib to common/ * bring stuff not really/not yet used in common back to armsrc/ or client/ * bring liblua into client/ * bring uart into client/ * move some portions of code around (dbprint, protocols,...) * rename unused files into *_disabled.[ch] to make it explicit * rename soft Uarts between 14a, 14b and iclass, so a standalone could use several without clash * remove PrintAndLogDevice * move deprecated-hid-flasher from client to tools * Makefiles * treat deps in armsrc/ as in client/ * client: stop on warning (-Werror), same as for armsrc/ Tested on: * all standalone modes * Linux
66 lines
1.7 KiB
C
66 lines
1.7 KiB
C
//-----------------------------------------------------------------------------
|
|
// Copyright (C) 2017 Merlok
|
|
//
|
|
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
|
// at your option, any later version. See the LICENSE.txt file for the text of
|
|
// the license.
|
|
//-----------------------------------------------------------------------------
|
|
// APDU status bytes information
|
|
//-----------------------------------------------------------------------------
|
|
|
|
#ifndef APDUINFO_H__
|
|
#define APDUINFO_H__
|
|
|
|
#include "common.h"
|
|
|
|
#define APDUCODE_TYPE_NONE 0
|
|
#define APDUCODE_TYPE_INFO 1
|
|
#define APDUCODE_TYPE_WARNING 2
|
|
#define APDUCODE_TYPE_ERROR 3
|
|
#define APDUCODE_TYPE_SECURITY 4
|
|
|
|
typedef struct {
|
|
const char *ID;
|
|
const uint8_t Type;
|
|
const char *Description;
|
|
} APDUCode;
|
|
|
|
const APDUCode *GetAPDUCode(uint8_t sw1, uint8_t sw2);
|
|
const char *GetAPDUCodeDescription(uint8_t sw1, uint8_t sw2);
|
|
|
|
typedef struct {
|
|
uint8_t CLA;
|
|
uint8_t INS;
|
|
uint8_t P1;
|
|
uint8_t P2;
|
|
uint8_t Lc;
|
|
uint8_t *data;
|
|
} PACKED sAPDU;
|
|
|
|
typedef struct {
|
|
uint8_t cla;
|
|
uint8_t ins;
|
|
uint8_t p1;
|
|
uint8_t p2;
|
|
uint8_t lc[3];
|
|
} PACKED ExtAPDUHeader;
|
|
|
|
typedef struct {
|
|
uint8_t cla;
|
|
uint8_t ins;
|
|
uint8_t p1;
|
|
uint8_t p2;
|
|
uint16_t lc;
|
|
uint8_t *data;
|
|
uint32_t le;
|
|
bool extended_apdu;
|
|
uint8_t case_type;
|
|
} PACKED APDUStruct;
|
|
|
|
extern int APDUDecode(uint8_t *data, int len, APDUStruct *apdu);
|
|
extern int APDUEncode(APDUStruct *apdu, uint8_t *data, int *len);
|
|
extern int APDUEncodeS(sAPDU *apdu, bool extended, uint16_t le, uint8_t *data, int *len);
|
|
extern void APDUPrint(APDUStruct apdu);
|
|
extern void APDUPrintEx(APDUStruct apdu, size_t maxdatalen);
|
|
|
|
#endif
|