mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-25 07:35:40 -07:00
refactoring. add ability to produce command specific apdu codes
This commit is contained in:
parent
788e712a6c
commit
43577b3db4
3 changed files with 15 additions and 13 deletions
|
@ -56,11 +56,6 @@ static const PxSE_AID_t PxSE_AID_LIST[] = {
|
|||
{{0xA0, 0x00, 0x00, 0x05, 0x07, 0x06, 0x00}, "Proximity Micro-Payment System Environment (PMSE)" }
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
const uint16_t Code;
|
||||
const char *Description;
|
||||
} APDUSpcCodeDescription_t;
|
||||
|
||||
static const APDUSpcCodeDescription_t SelectAPDUCodeDescriptions[] = {
|
||||
{0x6984, "Key is blocked for use as key encryption key" },
|
||||
{0x6985, "Command not allowed on deactivated ADF or maximum files count already reached" },
|
||||
|
@ -72,14 +67,6 @@ static const APDUSpcCodeDescription_t SelectAPDUCodeDescriptions[] = {
|
|||
{0x6A89, "AID already exists" }
|
||||
};
|
||||
|
||||
static const char *GetSpecificAPDUCodeDesc(const APDUSpcCodeDescription_t *desc, const size_t desclen, uint16_t code) {
|
||||
for (int i = 0; i < desclen; i++) {
|
||||
if (desc[i].Code == code)
|
||||
return desc[i].Description;
|
||||
}
|
||||
return GetAPDUCodeDescription(code >> 8, code & 0xff);
|
||||
}
|
||||
|
||||
static uint8_t defaultKeyId = 1;
|
||||
static uint8_t defaultKey[CIPURSE_AES_KEY_LENGTH] = CIPURSE_DEFAULT_KEY;
|
||||
#define CIPURSE_MAX_AID_LENGTH 16
|
||||
|
|
|
@ -329,6 +329,14 @@ const char *GetAPDUCodeDescription(uint8_t sw1, uint8_t sw2) {
|
|||
return APDUCodeTable[0].Description; //empty string
|
||||
}
|
||||
|
||||
const char *GetSpecificAPDUCodeDesc(const APDUSpcCodeDescription_t *desc, const size_t desclen, uint16_t code) {
|
||||
for (int i = 0; i < desclen; i++) {
|
||||
if (desc[i].Code == code)
|
||||
return desc[i].Description;
|
||||
}
|
||||
return GetAPDUCodeDescription(code >> 8, code & 0xff);
|
||||
}
|
||||
|
||||
int APDUDecode(uint8_t *data, int len, APDU_t *apdu) {
|
||||
ExtAPDUHeader_t *hapdu = (ExtAPDUHeader_t *)data;
|
||||
|
||||
|
|
|
@ -38,6 +38,13 @@ typedef struct {
|
|||
const APDUCode_t *GetAPDUCode(uint8_t sw1, uint8_t sw2);
|
||||
const char *GetAPDUCodeDescription(uint8_t sw1, uint8_t sw2);
|
||||
|
||||
typedef struct {
|
||||
const uint16_t Code;
|
||||
const char *Description;
|
||||
} APDUSpcCodeDescription_t;
|
||||
|
||||
const char *GetSpecificAPDUCodeDesc(const APDUSpcCodeDescription_t *desc, const size_t desclen, uint16_t code);
|
||||
|
||||
typedef struct {
|
||||
uint8_t CLA;
|
||||
uint8_t INS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue