mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-08 09:10:06 +08:00
apdu rename and print
This commit is contained in:
parent
16b6d7e529
commit
1169a6cf1b
2 changed files with 19 additions and 5 deletions
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include "apduinfo.h"
|
||||
|
||||
#include "util.h"
|
||||
|
||||
const APDUCode APDUCodeTable[] = {
|
||||
// ID Type Description
|
||||
{"XXXX", APDUCODE_TYPE_NONE, ""}, // blank string
|
||||
|
@ -315,9 +317,9 @@ const char *GetAPDUCodeDescription(uint8_t sw1, uint8_t sw2) {
|
|||
return APDUCodeTable[0].Description; //empty string
|
||||
}
|
||||
|
||||
int apdu_decode(uint8_t *data, size_t len, APDU_STRUCT *apdu)
|
||||
int APDUDecode(uint8_t *data, size_t len, APDUStruct *apdu)
|
||||
{
|
||||
EXT_APDU_HEADER *hapdu = (EXT_APDU_HEADER *)data;
|
||||
ExtAPDUHeader *hapdu = (ExtAPDUHeader *)data;
|
||||
|
||||
apdu->cla = hapdu->cla;
|
||||
apdu->ins = hapdu->ins;
|
||||
|
@ -426,3 +428,13 @@ int apdu_decode(uint8_t *data, size_t len, APDU_STRUCT *apdu)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APDUEncode(APDUStruct apdu, uint8_t *data, size_t len) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void APDUPrint(APDUStruct apdu) {
|
||||
PrintAndLogEx(INFO, "apdu: %scase=%02x cla=%02x ins=%02x p1=%02x p2=%02x lc=%d le=%d\n",
|
||||
apdu.extended_apdu ? "[e]":"", apdu.case_type, apdu.cla, apdu.ins, apdu.p1, apdu.p2, apdu.lc, apdu.le);
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ typedef struct
|
|||
uint8_t p1;
|
||||
uint8_t p2;
|
||||
uint8_t lc[3];
|
||||
} __attribute__((packed)) EXT_APDU_HEADER;
|
||||
} __attribute__((packed)) ExtAPDUHeader;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -52,8 +52,10 @@ typedef struct
|
|||
uint32_t le;
|
||||
bool extended_apdu;
|
||||
uint8_t case_type;
|
||||
} __attribute__((packed)) APDU_STRUCT;
|
||||
extern int apdu_decode(uint8_t *data, size_t len, APDU_STRUCT *apdu);
|
||||
} __attribute__((packed)) APDUStruct;
|
||||
|
||||
extern int APDUDecode(uint8_t *data, size_t len, APDUStruct *apdu);
|
||||
extern int APDUEncode(APDUStruct apdu, uint8_t *data, size_t len);
|
||||
extern void APDUPrint(APDUStruct apdu);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue