mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-16 10:03:04 -07:00
Reduce scope of a number of globals:
APDUInFramingEnable atsFSC uid_label_map apdu_in_framing_enable uidmapping KENC_type KMAC_type jpeg_header jpeg2k_header *card_types card_app2_limit iclass_config_types jooks jooks_figures nfc_secret desdefaultkeys aesdefaultkeys k3kdefaultkeys CardAddresses default_3des_keys default_pwd_pack UL_TYPES_ARRAY UL_MEMORY_ARRAY fdxbCountryMapping translateTable invTranslateTable preamble paradox_lut pcf7931_config config DiArray FiArray FArray crc64_table signalprop
This commit is contained in:
parent
b209b63a73
commit
d88c98a786
17 changed files with 43 additions and 43 deletions
|
@ -33,7 +33,7 @@
|
|||
#include "nfc/ndef.h" // NDEFRecordsDecodeAndPrint
|
||||
#include "cmdnfc.h" // print_type4_cc_info
|
||||
|
||||
bool APDUInFramingEnable = true;
|
||||
static bool APDUInFramingEnable = true;
|
||||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
static int waitCmd(bool i_select, uint32_t timeout, bool verbose);
|
||||
|
@ -182,7 +182,7 @@ static const hintAIDListT hintAIDList[] = {
|
|||
|
||||
// iso14a apdu input frame length
|
||||
static uint16_t g_frame_len = 0;
|
||||
uint16_t atsFSC[] = {16, 24, 32, 40, 48, 64, 96, 128, 256};
|
||||
static uint16_t atsFSC[] = {16, 24, 32, 40, 48, 64, 96, 128, 256};
|
||||
|
||||
static int CmdHF14AList(const char *Cmd) {
|
||||
return CmdTraceListAlias(Cmd, "hf 14a", "14a");
|
||||
|
@ -1573,7 +1573,7 @@ typedef struct {
|
|||
const char *desc;
|
||||
} uid_label_name;
|
||||
|
||||
const uid_label_name uid_label_map[] = {
|
||||
static const uid_label_name uid_label_map[] = {
|
||||
// UID0, UID1, TEXT
|
||||
{0x02, 0x84, "M24SR64-Y"},
|
||||
{0x02, 0xA3, "25TA02KB-P"},
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
|
||||
// iso14b apdu input frame length
|
||||
static uint16_t apdu_frame_length = 0;
|
||||
uint16_t ats_fsc[] = {16, 24, 32, 40, 48, 64, 96, 128, 256};
|
||||
bool apdu_in_framing_enable = true;
|
||||
//static uint16_t ats_fsc[] = {16, 24, 32, 40, 48, 64, 96, 128, 256};
|
||||
static bool apdu_in_framing_enable = true;
|
||||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ typedef struct {
|
|||
const char *desc;
|
||||
} productName_t;
|
||||
|
||||
const productName_t uidmapping[] = {
|
||||
static const productName_t uidmapping[] = {
|
||||
|
||||
// UID, #significant Bits, "Vendor(+Product)"
|
||||
{ 0xE001000000000000LL, 16, "Motorola UK" },
|
||||
|
|
|
@ -46,8 +46,8 @@
|
|||
#define EMRTD_AID_MRTD {0xA0, 0x00, 0x00, 0x02, 0x47, 0x10, 0x01}
|
||||
|
||||
// DESKey Types
|
||||
const uint8_t KENC_type[4] = {0x00, 0x00, 0x00, 0x01};
|
||||
const uint8_t KMAC_type[4] = {0x00, 0x00, 0x00, 0x02};
|
||||
static const uint8_t KENC_type[4] = {0x00, 0x00, 0x00, 0x01};
|
||||
static const uint8_t KMAC_type[4] = {0x00, 0x00, 0x00, 0x02};
|
||||
|
||||
static int emrtd_dump_ef_dg2(uint8_t *file_contents, size_t file_length, const char *path);
|
||||
static int emrtd_dump_ef_dg5(uint8_t *file_contents, size_t file_length, const char *path);
|
||||
|
@ -704,8 +704,8 @@ static bool emrtd_select_and_read(uint8_t *dataout, size_t *dataoutlen, uint16_t
|
|||
return true;
|
||||
}
|
||||
|
||||
const uint8_t jpeg_header[4] = { 0xFF, 0xD8, 0xFF, 0xE0 };
|
||||
const uint8_t jpeg2k_header[6] = { 0x00, 0x00, 0x00, 0x0C, 0x6A, 0x50 };
|
||||
static const uint8_t jpeg_header[4] = { 0xFF, 0xD8, 0xFF, 0xE0 };
|
||||
static const uint8_t jpeg2k_header[6] = { 0x00, 0x00, 0x00, 0x0C, 0x6A, 0x50 };
|
||||
|
||||
static int emrtd_dump_ef_dg2(uint8_t *file_contents, size_t file_length, const char *path) {
|
||||
int offset, datalen = 0;
|
||||
|
|
|
@ -153,7 +153,7 @@ static void iclass_upload_emul(uint8_t *d, uint16_t n, uint16_t *bytes_sent) {
|
|||
}
|
||||
}
|
||||
|
||||
const char *card_types[] = {
|
||||
static const char *card_types[] = {
|
||||
"PicoPass 16K / 16", // 000
|
||||
"PicoPass 32K with current book 16K / 16", // 001
|
||||
"Unknown Card Type!", // 010
|
||||
|
@ -164,7 +164,7 @@ const char *card_types[] = {
|
|||
"PicoPass 32K with current book 16K / 2", // 111
|
||||
};
|
||||
|
||||
uint8_t card_app2_limit[] = {
|
||||
static uint8_t card_app2_limit[] = {
|
||||
0xff,
|
||||
0xff,
|
||||
0xff,
|
||||
|
@ -175,7 +175,7 @@ uint8_t card_app2_limit[] = {
|
|||
0xff,
|
||||
};
|
||||
|
||||
iclass_config_card_item_t iclass_config_types[14] = {
|
||||
static iclass_config_card_item_t iclass_config_types[14] = {
|
||||
{"", ""},
|
||||
{"", ""},
|
||||
{"", ""},
|
||||
|
|
|
@ -38,7 +38,7 @@ typedef struct {
|
|||
} PACKED jooki_test_t;
|
||||
|
||||
// sample set for selftest.
|
||||
jooki_test_t jooks[] = {
|
||||
static jooki_test_t jooks[] = {
|
||||
{ {0x04, 0xDA, 0xB7, 0x6A, 0xE7, 0x4C, 0x80}, "ruxow8lnn88uyeX+", 0x01, 0x00},
|
||||
{ {0x04, 0xf0, 0x22, 0xc2, 0x33, 0x5e, 0x80}, "\0", 0x01, 0x00},
|
||||
{ {0x04, 0x8C, 0xEC, 0xDA, 0xF0, 0x4A, 0x80}, "ONrsVf7jX6IaSNV6", 0x01, 0x01},
|
||||
|
@ -51,7 +51,7 @@ jooki_test_t jooks[] = {
|
|||
{ {0x04, 0x28, 0xF4, 0xDA, 0xF0, 0x4A, 0x81}, "7WzlgEzqLgwTnWNy", 0x01, 0x05},
|
||||
};
|
||||
|
||||
jooki_figure_t jooks_figures[] = {
|
||||
static jooki_figure_t jooks_figures[] = {
|
||||
{0x01, 0x00, "Dragon", "Figurine"},
|
||||
{0x01, 0x01, "Fox", "Figurine"},
|
||||
{0x01, 0x02, "Ghost", "Figurine"},
|
||||
|
@ -115,8 +115,8 @@ static int jooki_lookup(uint8_t tid, uint8_t fid) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
const uint8_t jooki_secret[] = {0x20, 0x20, 0x20, 0x6D, 0x24, 0x0B, 0xEB, 0x94, 0x2C, 0x80, 0x45, 0x16};
|
||||
const uint8_t NFC_SECRET[] = { 0x03, 0x9c, 0x25, 0x6f, 0xb9, 0x2e, 0xe8, 0x08, 0x09, 0x83, 0xd9, 0x33, 0x56};
|
||||
//static const uint8_t jooki_secret[] = {0x20, 0x20, 0x20, 0x6D, 0x24, 0x0B, 0xEB, 0x94, 0x2C, 0x80, 0x45, 0x16};
|
||||
static const uint8_t nfc_secret[] = { 0x03, 0x9c, 0x25, 0x6f, 0xb9, 0x2e, 0xe8, 0x08, 0x09, 0x83, 0xd9, 0x33, 0x56};
|
||||
|
||||
#define JOOKI_UID_LEN 7
|
||||
#define JOOKI_IV_LEN 3
|
||||
|
@ -140,9 +140,9 @@ static int jooki_encode(uint8_t *iv, uint8_t tid, uint8_t fid, uint8_t *uid, uin
|
|||
for (uint8_t i = 0; i < JOOKI_PLAIN_LEN; i++) {
|
||||
|
||||
if (i < 3)
|
||||
enc[i] = d[i] ^ NFC_SECRET[i];
|
||||
enc[i] = d[i] ^ nfc_secret[i];
|
||||
else
|
||||
enc[i] = d[i] ^ NFC_SECRET[i] ^ d[i % 3];
|
||||
enc[i] = d[i] ^ nfc_secret[i] ^ d[i % 3];
|
||||
}
|
||||
|
||||
PrintAndLogEx(DEBUG, "encoded result.... %s", sprint_hex(enc, sizeof(enc)));
|
||||
|
@ -164,9 +164,9 @@ static int jooki_decode(uint8_t *b64, uint8_t *result) {
|
|||
|
||||
for (uint8_t i = 0; i < JOOKI_PLAIN_LEN; i++) {
|
||||
if (i < 3)
|
||||
result[i] = ndef[i] ^ NFC_SECRET[i];
|
||||
result[i] = ndef[i] ^ nfc_secret[i];
|
||||
else
|
||||
result[i] = ndef[i] ^ NFC_SECRET[i] ^ ndef[i % 3] ^ NFC_SECRET[i % 3];
|
||||
result[i] = ndef[i] ^ nfc_secret[i] ^ ndef[i % 3] ^ nfc_secret[i % 3];
|
||||
}
|
||||
PrintAndLogEx(DEBUG, "(decode_jooki) plain......... %s", sprint_hex(result, sizeof(ndef)));
|
||||
return PM3_SUCCESS;
|
||||
|
|
|
@ -45,21 +45,21 @@
|
|||
#define MAX_KEYS_LIST_LEN 1024
|
||||
|
||||
#define status(x) ( ((uint16_t)(0x91<<8)) + (uint16_t)x )
|
||||
|
||||
uint8_t desdefaultkeys[3][8] = {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //Official
|
||||
/*
|
||||
static uint8_t desdefaultkeys[3][8] = {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //Official
|
||||
{0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47},
|
||||
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}
|
||||
};
|
||||
|
||||
uint8_t aesdefaultkeys[5][16] = {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //Official, TRF7970A
|
||||
static uint8_t aesdefaultkeys[5][16] = {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //Official, TRF7970A
|
||||
{0x79, 0x70, 0x25, 0x53, 0x79, 0x70, 0x25, 0x53, 0x79, 0x70, 0x25, 0x53, 0x79, 0x70, 0x25, 0x53}, // TRF7970A
|
||||
{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF}, // TRF7970A
|
||||
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
|
||||
{0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f}
|
||||
};
|
||||
|
||||
uint8_t k3kdefaultkeys[1][24] = {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
|
||||
|
||||
static uint8_t k3kdefaultkeys[1][24] = {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
|
||||
*/
|
||||
typedef struct mfdes_authinput {
|
||||
uint8_t mode;
|
||||
uint8_t algo;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "crypto/libpcrypto.h"
|
||||
|
||||
static const uint8_t DefaultKey[16] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||
uint16_t CardAddresses[] = {0x9000, 0x9001, 0x9002, 0x9003, 0x9004, 0xA000, 0xA001, 0xA080, 0xA081, 0xC000, 0xC001};
|
||||
static uint16_t CardAddresses[] = {0x9000, 0x9001, 0x9002, 0x9003, 0x9004, 0xA000, 0xA001, 0xA080, 0xA081, 0xC000, 0xC001};
|
||||
|
||||
typedef enum {
|
||||
MFP_UNKNOWN = 0,
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
uint8_t default_3des_keys[][16] = {
|
||||
static uint8_t default_3des_keys[][16] = {
|
||||
{ 0x42, 0x52, 0x45, 0x41, 0x4b, 0x4d, 0x45, 0x49, 0x46, 0x59, 0x4f, 0x55, 0x43, 0x41, 0x4e, 0x21 }, // 3des std key
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // all zeroes
|
||||
{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, // 0x00-0x0F
|
||||
|
@ -54,12 +54,12 @@ uint8_t default_3des_keys[][16] = {
|
|||
{ 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF } // 11 22 33
|
||||
};
|
||||
|
||||
uint8_t default_pwd_pack[][4] = {
|
||||
static uint8_t default_pwd_pack[][4] = {
|
||||
{0xFF, 0xFF, 0xFF, 0xFF}, // PACK 0x00,0x00 -- factory default
|
||||
{0x4E, 0x45, 0x78, 0x54},
|
||||
};
|
||||
|
||||
uint32_t UL_TYPES_ARRAY[] = {
|
||||
static uint32_t UL_TYPES_ARRAY[] = {
|
||||
UNKNOWN, UL, UL_C, UL_EV1_48, UL_EV1_128, NTAG,
|
||||
NTAG_203, NTAG_210, NTAG_212, NTAG_213, NTAG_215, NTAG_216,
|
||||
MY_D, MY_D_NFC, MY_D_MOVE, MY_D_MOVE_NFC, MY_D_MOVE_LEAN, FUDAN_UL,
|
||||
|
@ -67,7 +67,7 @@ uint32_t UL_TYPES_ARRAY[] = {
|
|||
NTAG_213_C, NTAG_210u
|
||||
};
|
||||
|
||||
uint8_t UL_MEMORY_ARRAY[ARRAYLEN(UL_TYPES_ARRAY)] = {
|
||||
static uint8_t UL_MEMORY_ARRAY[ARRAYLEN(UL_TYPES_ARRAY)] = {
|
||||
MAX_UL_BLOCKS, MAX_UL_BLOCKS, MAX_ULC_BLOCKS, MAX_ULEV1a_BLOCKS, MAX_ULEV1b_BLOCKS, MAX_NTAG_203,
|
||||
MAX_NTAG_203, MAX_NTAG_210, MAX_NTAG_212, MAX_NTAG_213, MAX_NTAG_215, MAX_NTAG_216,
|
||||
MAX_UL_BLOCKS, MAX_MY_D_NFC, MAX_MY_D_MOVE, MAX_MY_D_MOVE, MAX_MY_D_MOVE_LEAN, MAX_UL_BLOCKS,
|
||||
|
|
|
@ -213,7 +213,7 @@ static int CmdFDXBdemodBI(const char *Cmd) {
|
|||
// For the country part:
|
||||
// wget -q -O - "https://en.wikipedia.org/w/index.php?title=List_of_ISO_3166_country_codes&action=raw" | awk '/id=/{match($0, /\[\[([^\]|]*)/, a); name=a[1];getline;getline;getline;getline;getline;match($0, /numeric#([0-9]*)/, a);num=a[1]; if (num != "") {printf " { %3u, \"%s\" },\n", num, name}}'
|
||||
// Beware the bottom of the list contains also Manufacturers list
|
||||
const fdxbCountryMapping_t fdxbCountryMapping[] = {
|
||||
static const fdxbCountryMapping_t fdxbCountryMapping[] = {
|
||||
{ 4, "Afghanistan" },
|
||||
{ 8, "Albania" },
|
||||
{ 12, "Algeria" },
|
||||
|
|
|
@ -33,9 +33,9 @@
|
|||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
const uint8_t translateTable[10] = {8, 2, 1, 12, 4, 5, 10, 13, 0, 9};
|
||||
const uint8_t invTranslateTable[16] = {8, 2, 1, 0xff, 4, 5, 0xff, 0xff, 0, 9, 6, 0xff, 3, 7, 0xff, 0xff};
|
||||
const uint8_t preamble[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}; // zero inside
|
||||
static const uint8_t translateTable[10] = {8, 2, 1, 12, 4, 5, 10, 13, 0, 9};
|
||||
static const uint8_t invTranslateTable[16] = {8, 2, 1, 0xff, 4, 5, 0xff, 0xff, 0, 9, 6, 0xff, 3, 7, 0xff, 0xff};
|
||||
static const uint8_t preamble[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}; // zero inside
|
||||
|
||||
static uint8_t isEven_64_63(const uint8_t *data) { // 8
|
||||
uint32_t tmp[2];
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
const uint8_t paradox_lut[] = {
|
||||
static const uint8_t paradox_lut[] = {
|
||||
0xDB, 0xFC, 0x3F, 0xC5, 0x50, 0x14, 0x05, 0x47,
|
||||
0x9F, 0xED, 0x7D, 0x59, 0x22, 0x84, 0x21, 0x4E,
|
||||
0x39, 0x48, 0x12, 0x88, 0x53, 0xDE, 0xBB, 0xE4,
|
||||
|
|
|
@ -23,7 +23,7 @@ static int CmdHelp(const char *Cmd);
|
|||
#define PCF7931_DEFAULT_OFFSET_POSITION 0
|
||||
|
||||
// Default values - Configuration
|
||||
struct pcf7931_config configPcf = {
|
||||
static struct pcf7931_config configPcf = {
|
||||
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
PCF7931_DEFAULT_INITDELAY,
|
||||
PCF7931_DEFAULT_OFFSET_WIDTH,
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
//static uint8_t bit_rates[9] = {8, 16, 32, 40, 50, 64, 100, 128, 0};
|
||||
|
||||
// Default configuration
|
||||
t55xx_conf_block_t config = {
|
||||
static t55xx_conf_block_t config = {
|
||||
.modulation = DEMOD_ASK,
|
||||
.inverted = false,
|
||||
.offset = 0x00,
|
||||
|
|
|
@ -68,7 +68,7 @@ static uint8_t GetATRTA1(uint8_t *atr, size_t atrlen) {
|
|||
return 0x11; // default value is 0x11, corresponding to fmax=5 MHz, Fi=372, Di=1.
|
||||
}
|
||||
|
||||
int DiArray[] = {
|
||||
static int DiArray[] = {
|
||||
0, // b0000 RFU
|
||||
1, // b0001
|
||||
2,
|
||||
|
@ -87,7 +87,7 @@ int DiArray[] = {
|
|||
0 // b1111 RFU
|
||||
};
|
||||
|
||||
int FiArray[] = {
|
||||
static int FiArray[] = {
|
||||
372, // b0000 Historical note: in ISO/IEC 7816-3:1989, this was assigned to cards with internal clock
|
||||
372, // b0001
|
||||
558, // b0010
|
||||
|
@ -106,7 +106,7 @@ int FiArray[] = {
|
|||
0 // b1111 RFU
|
||||
};
|
||||
|
||||
float FArray[] = {
|
||||
static float FArray[] = {
|
||||
4, // b0000 Historical note: in ISO/IEC 7816-3:1989, this was assigned to cards with internal clock
|
||||
5, // b0001
|
||||
6, // b0010
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#define CRC64_ISO_PRESET 0xFFFFFFFFFFFFFFFF
|
||||
#define CRC64_ECMA_PRESET 0x0000000000000000
|
||||
|
||||
const uint64_t crc64_table[] = {
|
||||
static const uint64_t crc64_table[] = {
|
||||
0x0000000000000000, 0x42F0E1EBA9EA3693, 0x85E1C3D753D46D26, 0xC711223CFA3E5BB5,
|
||||
0x493366450E42ECDF, 0x0BC387AEA7A8DA4C, 0xCCD2A5925D9681F9, 0x8E224479F47CB76A,
|
||||
0x9266CC8A1C85D9BE, 0xD0962D61B56FEF2D, 0x17870F5D4F51B498, 0x5577EEB6E6BB820B,
|
||||
|
|
|
@ -62,7 +62,7 @@ uint8_t g_debugMode = 0;
|
|||
# define prnt Dbprintf
|
||||
#endif
|
||||
|
||||
signal_t signalprop = { 255, -255, 0, 0, true };
|
||||
static signal_t signalprop = { 255, -255, 0, 0, true };
|
||||
signal_t *getSignalProperties(void) {
|
||||
return &signalprop;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue