diff --git a/client/src/cmdhfcipurse.c b/client/src/cmdhfcipurse.c index c1e55e942..357db1341 100644 --- a/client/src/cmdhfcipurse.c +++ b/client/src/cmdhfcipurse.c @@ -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 diff --git a/client/src/iso7816/apduinfo.c b/client/src/iso7816/apduinfo.c index 5c9a36f76..7e8cc1d5b 100644 --- a/client/src/iso7816/apduinfo.c +++ b/client/src/iso7816/apduinfo.c @@ -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; diff --git a/client/src/iso7816/apduinfo.h b/client/src/iso7816/apduinfo.h index d07d5f36e..abe6ad6d5 100644 --- a/client/src/iso7816/apduinfo.h +++ b/client/src/iso7816/apduinfo.h @@ -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;