diff --git a/client/src/cmdhf14a.c b/client/src/cmdhf14a.c index 8783da0d6..51bdd3677 100644 --- a/client/src/cmdhf14a.c +++ b/client/src/cmdhf14a.c @@ -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"}, diff --git a/client/src/cmdhf14b.c b/client/src/cmdhf14b.c index 2d86fb51f..0aea52f1a 100644 --- a/client/src/cmdhf14b.c +++ b/client/src/cmdhf14b.c @@ -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); diff --git a/client/src/cmdhf15.c b/client/src/cmdhf15.c index 4b6a9a977..b74e4bc3d 100644 --- a/client/src/cmdhf15.c +++ b/client/src/cmdhf15.c @@ -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" }, diff --git a/client/src/cmdhfemrtd.c b/client/src/cmdhfemrtd.c index 8ccb88879..1d90993bf 100644 --- a/client/src/cmdhfemrtd.c +++ b/client/src/cmdhfemrtd.c @@ -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; diff --git a/client/src/cmdhficlass.c b/client/src/cmdhficlass.c index 965bc05e8..42269f3a9 100644 --- a/client/src/cmdhficlass.c +++ b/client/src/cmdhficlass.c @@ -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] = { {"", ""}, {"", ""}, {"", ""}, diff --git a/client/src/cmdhfjooki.c b/client/src/cmdhfjooki.c index 2758a7cb2..a8ab0d9c8 100644 --- a/client/src/cmdhfjooki.c +++ b/client/src/cmdhfjooki.c @@ -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; diff --git a/client/src/cmdhfmfdes.c b/client/src/cmdhfmfdes.c index b90a16606..d688ee364 100644 --- a/client/src/cmdhfmfdes.c +++ b/client/src/cmdhfmfdes.c @@ -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; diff --git a/client/src/cmdhfmfp.c b/client/src/cmdhfmfp.c index 9318abadb..849796998 100644 --- a/client/src/cmdhfmfp.c +++ b/client/src/cmdhfmfp.c @@ -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, diff --git a/client/src/cmdhfmfu.c b/client/src/cmdhfmfu.c index d12078b63..4806a8139 100644 --- a/client/src/cmdhfmfu.c +++ b/client/src/cmdhfmfu.c @@ -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, diff --git a/client/src/cmdlffdxb.c b/client/src/cmdlffdxb.c index cf3325501..8168ef244 100644 --- a/client/src/cmdlffdxb.c +++ b/client/src/cmdlffdxb.c @@ -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" }, diff --git a/client/src/cmdlfnedap.c b/client/src/cmdlfnedap.c index 41bb9c2de..98a6d2d31 100644 --- a/client/src/cmdlfnedap.c +++ b/client/src/cmdlfnedap.c @@ -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]; diff --git a/client/src/cmdlfparadox.c b/client/src/cmdlfparadox.c index 0e9c553c9..bff6449bd 100644 --- a/client/src/cmdlfparadox.c +++ b/client/src/cmdlfparadox.c @@ -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, diff --git a/client/src/cmdlfpcf7931.c b/client/src/cmdlfpcf7931.c index bd744f8ba..be685bb0c 100644 --- a/client/src/cmdlfpcf7931.c +++ b/client/src/cmdlfpcf7931.c @@ -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, diff --git a/client/src/cmdlft55xx.c b/client/src/cmdlft55xx.c index 709424645..d0410d698 100644 --- a/client/src/cmdlft55xx.c +++ b/client/src/cmdlft55xx.c @@ -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, diff --git a/client/src/cmdsmartcard.c b/client/src/cmdsmartcard.c index fcd52abf8..4394bd7b5 100644 --- a/client/src/cmdsmartcard.c +++ b/client/src/cmdsmartcard.c @@ -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 diff --git a/common/crc64.c b/common/crc64.c index 3bdc596ac..eaa5249ab 100644 --- a/common/crc64.c +++ b/common/crc64.c @@ -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, diff --git a/common/lfdemod.c b/common/lfdemod.c index d202d9aa0..91f7361bd 100644 --- a/common/lfdemod.c +++ b/common/lfdemod.c @@ -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; }