mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-30 19:40:37 -07:00
stricter warnings, wip
This commit is contained in:
parent
9358554884
commit
3529aea157
43 changed files with 140 additions and 142 deletions
|
@ -55,8 +55,9 @@ ZLIB = $(OBJDIR)/libz.a
|
|||
|
||||
LIBS = -I$(LUALIBPATH) -I$(MBEDTLSLIBPATH) -I$(JANSSONLIBPATH) -I$(CBORLIBPATH) -I$(ZLIBPATH) -I$(REVENGPATH) -I$(AMIIBOLIBPATH) -I$(HARDNESTEDPATH) -I$(CLIPARSERPATH)
|
||||
INCLUDES_CLIENT += -I./src -I../include -I../common -I../common_fpga $(LIBS)
|
||||
CFLAGS ?= -Wall -Werror -O3
|
||||
#CFLAGS ?= -Wall -Werror -O3 -Wchar-subscripts -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wunused -Wuninitialized -Wpointer-arith -Wredundant-decls -Winline -Wformat -Wformat-security -Winit-self -Wmissing-include-dirs -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wmissing-declarations
|
||||
#CFLAGS ?= -Wall -Werror -O3
|
||||
CFLAGS ?= -Wall -Werror -O3 -Wchar-subscripts -Wundef -Wcast-align -Wwrite-strings -Wunused -Wuninitialized -Wpointer-arith -Winline -Wformat -Wformat-security -Winit-self -Wmissing-include-dirs -Wstrict-prototypes -Wnested-externs -Wmissing-declarations
|
||||
# -Wshadow -Wmissing-prototypes -Wredundant-decls
|
||||
# -Wbad-function-cast -Wextra -Wswitch-enum -Wold-style-definition
|
||||
|
||||
# We cannot just use CFLAGS+=... because it has impact on sub-makes if CFLAGS is defined in env:
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
static char *self;
|
||||
|
||||
void amiitool_usage() {
|
||||
void amiitool_usage(void) {
|
||||
fprintf(stderr,
|
||||
/*"amiitool build %i (commit %s-%08x)\n"*/
|
||||
"by Marcos Del Sol Vives <marcos@dracon.es>\n"
|
||||
|
|
|
@ -143,7 +143,7 @@ int CLIParserParseStringEx(const char *str, void *vargtable[], size_t vargtableL
|
|||
return CLIParserParseArg(argc, argv, vargtable, vargtableLen, allowEmptyExec);
|
||||
}
|
||||
|
||||
void CLIParserFree() {
|
||||
void CLIParserFree(void) {
|
||||
arg_freetable(argtable, argtableLen);
|
||||
argtable = NULL;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "fileutils.h"
|
||||
#include "pm3_cmd.h"
|
||||
|
||||
int openAIDFile(json_t **root, bool verbose) {
|
||||
static int openAIDFile(json_t **root, bool verbose) {
|
||||
json_error_t error;
|
||||
|
||||
char *path;
|
||||
|
@ -42,7 +42,7 @@ out:
|
|||
return retval;
|
||||
}
|
||||
|
||||
int closeAIDFile(json_t *root) {
|
||||
static int closeAIDFile(json_t *root) {
|
||||
|
||||
json_decref(root);
|
||||
return PM3_SUCCESS;
|
||||
|
@ -71,7 +71,7 @@ int AIDSearchFree(json_t *root) {
|
|||
return closeAIDFile(root);
|
||||
}
|
||||
|
||||
const char *jsonStrGet(json_t *data, char *name) {
|
||||
static const char *jsonStrGet(json_t *data, const char *name) {
|
||||
json_t *jstr;
|
||||
|
||||
jstr = json_object_get(data, name);
|
||||
|
@ -88,7 +88,7 @@ const char *jsonStrGet(json_t *data, char *name) {
|
|||
return cstr;
|
||||
}
|
||||
|
||||
bool aidCompare(const char *aidlarge, const char *aidsmall) {
|
||||
static bool aidCompare(const char *aidlarge, const char *aidsmall) {
|
||||
if (strcmp(aidlarge, aidsmall) == 0)
|
||||
return true;
|
||||
|
||||
|
|
|
@ -23,6 +23,6 @@ int PrintAIDDescriptionBuf(json_t *root, uint8_t *aid, size_t aidlen, bool verbo
|
|||
json_t *AIDSearchInit(bool verbose);
|
||||
json_t *AIDSearchGetElm(json_t *root, int elmindx);
|
||||
bool AIDGetFromElm(json_t *data, uint8_t *aid, size_t aidmaxlen, int *aidlen);
|
||||
int AIDSearchFree();
|
||||
int AIDSearchFree(json_t *root);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
static int usage_hf_search() {
|
||||
static int usage_hf_search(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: hf search");
|
||||
PrintAndLogEx(NORMAL, "Will try to find a HF read out of the unknown tag. Stops when found.");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
|
@ -53,7 +53,7 @@ static int usage_hf_search() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int usage_hf_sniff() {
|
||||
static int usage_hf_sniff(void) {
|
||||
PrintAndLogEx(NORMAL, "The high frequence sniffer will assign all available memory on device for sniffed data");
|
||||
PrintAndLogEx(NORMAL, "Use " _YELLOW_("'data samples'")" command to download from device, and " _YELLOW_("'data plot'")" to look at it");
|
||||
PrintAndLogEx(NORMAL, "Press button to quit the sniffing.\n");
|
||||
|
@ -69,7 +69,7 @@ static int usage_hf_sniff() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int usage_hf_tune() {
|
||||
static int usage_hf_tune(void) {
|
||||
PrintAndLogEx(NORMAL, "Continuously measure HF antenna tuning.");
|
||||
PrintAndLogEx(NORMAL, "Press button or Enter to interrupt.");
|
||||
PrintAndLogEx(NORMAL, "Usage: hf tune [h] [<iter>]");
|
||||
|
|
|
@ -1261,7 +1261,7 @@ typedef enum {
|
|||
} nxp_mifare_type_t;
|
||||
|
||||
// According to NXP AN10833 Rev 3.6 MIFARE Type Identification, Table 6
|
||||
int detect_nxp_card(uint8_t sak, uint16_t atqa) {
|
||||
static int detect_nxp_card(uint8_t sak, uint16_t atqa) {
|
||||
int type = MTNONE;
|
||||
|
||||
if (sak == 0x00) {
|
||||
|
@ -1355,7 +1355,7 @@ const uidname uidmap[] = {
|
|||
{0x00, 0x00, "None"}
|
||||
};
|
||||
|
||||
void getTagLabel(uint8_t uid0, uint8_t uid1) {
|
||||
static void getTagLabel(uint8_t uid0, uint8_t uid1) {
|
||||
int i = 0;
|
||||
while (uidmap[i].uid0 != 0x00) {
|
||||
if ((uidmap[i].uid0 == uid0) && (uidmap[i].uid1 == uid1)) {
|
||||
|
|
|
@ -684,7 +684,7 @@ static bool HF14B_Std_Reader(bool verbose) {
|
|||
}
|
||||
|
||||
// test for other 14b type tags (mimic another reader - don't have tags to identify)
|
||||
static bool HF14B_Other_Reader() {
|
||||
static bool HF14B_Other_Reader(void) {
|
||||
|
||||
// uint8_t data[] = {0x00, 0x0b, 0x3f, 0x80};
|
||||
// uint8_t datalen = 4;
|
||||
|
|
|
@ -123,7 +123,7 @@ static int usage_hf_felica_request_response(void) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static void print_status_flag1_interpretation() {
|
||||
static void print_status_flag1_interpretation(void) {
|
||||
PrintAndLogEx(NORMAL, "\nStatus Flag1:");
|
||||
PrintAndLogEx(NORMAL, " - 00h : Indicates the successful completion of a command.");
|
||||
PrintAndLogEx(NORMAL, " - FFh : If an error occurs during the processing of a command that includes no list in the command packet, or if "
|
||||
|
@ -133,7 +133,7 @@ static void print_status_flag1_interpretation() {
|
|||
"indicating the location of the error.");
|
||||
}
|
||||
|
||||
static void print_status_flag2_interpration() {
|
||||
static void print_status_flag2_interpration(void) {
|
||||
PrintAndLogEx(NORMAL, "\nStatus Flag2:");
|
||||
PrintAndLogEx(NORMAL, " - 00h : Indicates the successful completion of a command.");
|
||||
PrintAndLogEx(NORMAL, " - 01h : The calculated result is either less than zero when the purse data is decremented, or exceeds 4"
|
||||
|
@ -167,7 +167,7 @@ static void print_status_flag2_interpration() {
|
|||
PrintAndLogEx(NORMAL, " - C2h : Command is disabled already: This is the error that occurs in issuance commands.");
|
||||
}
|
||||
|
||||
static void print_block_list_element_constraints() {
|
||||
static void print_block_list_element_constraints(void) {
|
||||
PrintAndLogEx(NORMAL, " - Each Block List Element shall satisfy the following conditions:");
|
||||
PrintAndLogEx(NORMAL, " - The value of Service Code List Order shall not exceed Number of Service.");
|
||||
PrintAndLogEx(NORMAL, " - Access Mode shall be 000b.");
|
||||
|
@ -177,22 +177,22 @@ static void print_block_list_element_constraints() {
|
|||
PrintAndLogEx(NORMAL, " - Block Number shall be in the range of the number of Blocks assigned to the specified Service.");
|
||||
}
|
||||
|
||||
static void print_number_of_service_constraints() {
|
||||
static void print_number_of_service_constraints(void) {
|
||||
PrintAndLogEx(NORMAL, " - Number of Service: shall be a positive integer in the range of 1 to 16, inclusive.");
|
||||
}
|
||||
|
||||
static void print_number_of_block_constraints() {
|
||||
static void print_number_of_block_constraints(void) {
|
||||
PrintAndLogEx(NORMAL, " - Number of Block: shall be less than or equal to the maximum number of Blocks that can be read simultaneously. "
|
||||
"The maximum number of Blocks that can be read simultaneously can differ, depending on the product being used. Use as default 01");
|
||||
}
|
||||
|
||||
static void print_service_code_list_constraints() {
|
||||
static void print_service_code_list_constraints(void) {
|
||||
PrintAndLogEx(NORMAL, " - Service Code List: For Service Code List, only Service Code existing in the product shall be specified:");
|
||||
PrintAndLogEx(NORMAL, " - Even when Service Code exists in the product, Service Code not referenced from Block List shall not be specified to Service Code List.");
|
||||
PrintAndLogEx(NORMAL, " - For existence or nonexistence of Service in a product, please check using the Request Service (or Request Service v2) command.");
|
||||
}
|
||||
|
||||
static int usage_hf_felica_read_without_encryption() {
|
||||
static int usage_hf_felica_read_without_encryption(void) {
|
||||
PrintAndLogEx(NORMAL, "\nInfo: Use this command to read Block Data from authentication-not-required Service.");
|
||||
PrintAndLogEx(NORMAL, " - Mode shall be Mode0.");
|
||||
print_number_of_service_constraints();
|
||||
|
@ -215,7 +215,7 @@ static int usage_hf_felica_read_without_encryption() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int usage_hf_felica_write_without_encryption() {
|
||||
static int usage_hf_felica_write_without_encryption(void) {
|
||||
PrintAndLogEx(NORMAL, "\nInfo: Use this command to write Block Data to authentication-not-required Service.");
|
||||
PrintAndLogEx(NORMAL, " - Mode shall be Mode0.");
|
||||
print_number_of_service_constraints();
|
||||
|
@ -234,7 +234,7 @@ static int usage_hf_felica_write_without_encryption() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int usage_hf_felica_request_system_code() {
|
||||
static int usage_hf_felica_request_system_code(void) {
|
||||
PrintAndLogEx(NORMAL, "\nInfo: Use this command to acquire System Code registered to the card.");
|
||||
PrintAndLogEx(NORMAL, " - If a card is divided into more than one System, this command acquires System Code of each System existing in the card.");
|
||||
PrintAndLogEx(NORMAL, "\nUsage: hf felica rqsyscode [-h] [-i]");
|
||||
|
@ -246,7 +246,7 @@ static int usage_hf_felica_request_system_code() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int usage_hf_felica_reset_mode() {
|
||||
static int usage_hf_felica_reset_mode(void) {
|
||||
PrintAndLogEx(NORMAL, "\nInfo: Use this command to reset Mode to Mode 0.");
|
||||
print_status_flag1_interpretation();
|
||||
print_status_flag2_interpration();
|
||||
|
@ -261,7 +261,7 @@ static int usage_hf_felica_reset_mode() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int usage_hf_felica_request_specification_version() {
|
||||
static int usage_hf_felica_request_specification_version(void) {
|
||||
PrintAndLogEx(NORMAL, "\nInfo: Use this command to acquire the version of card OS.");
|
||||
PrintAndLogEx(NORMAL, " - Response:");
|
||||
PrintAndLogEx(NORMAL, " - Format Version: Fixed value 00h. Provided only if Status Flag1 = 00h.");
|
||||
|
@ -283,7 +283,7 @@ static int usage_hf_felica_request_specification_version() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int usage_hf_felica_authentication1() {
|
||||
static int usage_hf_felica_authentication1(void) {
|
||||
PrintAndLogEx(NORMAL, "\nInfo: Initiate mutual authentication. This command must always be executed before Authentication2 command"
|
||||
", and mutual authentication is achieve only after Authentication2 command has succeeded.");
|
||||
PrintAndLogEx(NORMAL, " - Auth1 Parameters:");
|
||||
|
@ -311,7 +311,7 @@ static int usage_hf_felica_authentication1() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int usage_hf_felica_authentication2() {
|
||||
static int usage_hf_felica_authentication2(void) {
|
||||
PrintAndLogEx(NORMAL, "\nInfo: Complete mutual authentication. This command can only be executed subsquent to Authentication1"
|
||||
" command.");
|
||||
PrintAndLogEx(NORMAL, " - Auth2 Parameters:");
|
||||
|
@ -551,7 +551,7 @@ static bool check_last_idm(uint8_t *data, uint16_t datalen) {
|
|||
* @param wr_noCry_resp frame in which the response will be saved.
|
||||
* @return success if response was received.
|
||||
*/
|
||||
int send_wr_unencrypted(uint8_t flags, uint16_t datalen, uint8_t *data, bool verbose, felica_status_response_t *wr_noCry_resp) {
|
||||
static int send_wr_unencrypted(uint8_t flags, uint16_t datalen, uint8_t *data, bool verbose, felica_status_response_t *wr_noCry_resp) {
|
||||
clear_and_send_command(flags, datalen, data, verbose);
|
||||
PacketResponseNG resp;
|
||||
if (!waitCmdFelica(0, &resp, verbose)) {
|
||||
|
@ -1464,7 +1464,7 @@ static int CmdHFFelicaSimLite(const char *Cmd) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static void printSep() {
|
||||
static void printSep(void) {
|
||||
PrintAndLogEx(INFO, "------------------------------------------------------------------------------------");
|
||||
}
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ static int usage_hf_iclass_readblock(void) {
|
|||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_hf_iclass_readtagfile() {
|
||||
static int usage_hf_iclass_readtagfile(void) {
|
||||
PrintAndLogEx(NORMAL, "Print a iClass tag-dump file\n");
|
||||
PrintAndLogEx(NORMAL, "Usage: hf iClass readtagfile [f <filename>] [s <startblock>] [e <endblock>] [v]\n");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
|
|
|
@ -37,7 +37,7 @@ enum MifareAuthSeq {
|
|||
static enum MifareAuthSeq MifareAuthState;
|
||||
static TAuthData AuthData;
|
||||
|
||||
void ClearAuthData() {
|
||||
void ClearAuthData(void) {
|
||||
AuthData.uid = 0;
|
||||
AuthData.nt = 0;
|
||||
AuthData.first_auth = true;
|
||||
|
|
|
@ -3132,7 +3132,7 @@ out:
|
|||
sector_t *k_sector = NULL;
|
||||
uint8_t k_sectorsCount = 40;
|
||||
|
||||
void showSectorTable() {
|
||||
void showSectorTable(void) {
|
||||
if (k_sector != NULL) {
|
||||
printKeyTable(k_sectorsCount, k_sector);
|
||||
free(k_sector);
|
||||
|
@ -4806,7 +4806,7 @@ static int CmdHFMFNDEF(const char *Cmd) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int CmdHFMFPersonalize(const char *cmd) {
|
||||
static int CmdHFMFPersonalize(const char *cmd) {
|
||||
|
||||
CLIParserInit("hf mf personalize",
|
||||
"Personalize the UID of a Mifare Classic EV1 card. This is only possible if it is a 7Byte UID card and if it is not already personalized.",
|
||||
|
|
|
@ -1302,7 +1302,7 @@ static void simulate_MFplus_RNG(uint32_t test_cuid, uint64_t test_key, uint32_t
|
|||
|
||||
}
|
||||
|
||||
static void simulate_acquire_nonces() {
|
||||
static void simulate_acquire_nonces(void) {
|
||||
time_t time1 = time(NULL);
|
||||
last_sample_clock = 0;
|
||||
sample_period = 1000; // for simulation
|
||||
|
@ -2108,7 +2108,7 @@ static uint16_t SumProperty(struct Crypto1State *s) {
|
|||
return (sum_odd * (16 - sum_even) + (16 - sum_odd) * sum_even);
|
||||
}
|
||||
|
||||
static void Tests() {
|
||||
static void Tests(void) {
|
||||
|
||||
if (known_target_key == -1)
|
||||
return;
|
||||
|
|
|
@ -949,7 +949,7 @@ static int CmdHFMFPWrbl(const char *Cmd) {
|
|||
#define AES_KEY_LEN 16
|
||||
#define MAX_KEYS_LIST_LEN 1024
|
||||
|
||||
int MFPKeyCheck(uint8_t startSector, uint8_t endSector, uint8_t startKeyAB, uint8_t endKeyAB,
|
||||
static int MFPKeyCheck(uint8_t startSector, uint8_t endSector, uint8_t startKeyAB, uint8_t endKeyAB,
|
||||
uint8_t keyList[MAX_KEYS_LIST_LEN][AES_KEY_LEN], size_t keyListLen, uint8_t foundKeys[2][64][AES_KEY_LEN + 1],
|
||||
bool verbose) {
|
||||
int res;
|
||||
|
@ -1027,7 +1027,7 @@ int MFPKeyCheck(uint8_t startSector, uint8_t endSector, uint8_t startKeyAB, uint
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
void Fill2bPattern(uint8_t keyList[MAX_KEYS_LIST_LEN][AES_KEY_LEN], size_t *keyListLen, uint32_t *startPattern) {
|
||||
static void Fill2bPattern(uint8_t keyList[MAX_KEYS_LIST_LEN][AES_KEY_LEN], size_t *keyListLen, uint32_t *startPattern) {
|
||||
for (uint32_t pt = *startPattern; pt < 0x10000; pt++) {
|
||||
keyList[*keyListLen][0] = (pt >> 8) & 0xff;
|
||||
keyList[*keyListLen][1] = pt & 0xff;
|
||||
|
|
|
@ -855,7 +855,7 @@ static int ulev1_print_configuration(uint32_t tagtype, uint8_t *data, uint8_t st
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int ulev1_print_counters() {
|
||||
static int ulev1_print_counters(void) {
|
||||
PrintAndLogEx(INFO, "--- " _CYAN_("Tag Counters"));
|
||||
uint8_t tear[1] = {0};
|
||||
uint8_t counter[3] = {0, 0, 0};
|
||||
|
@ -1004,7 +1004,7 @@ static int ulc_magic_test(){
|
|||
return returnValue;
|
||||
}
|
||||
*/
|
||||
static int ul_magic_test() {
|
||||
static int ul_magic_test(void) {
|
||||
// Magic Ultralight tests
|
||||
// 1) take present UID, and try to write it back. OBSOLETE
|
||||
// 2) make a wrong length write to page0, and see if tag answers with ACK/NACK:
|
||||
|
|
|
@ -670,7 +670,7 @@ int CmdLFSniff(const char *Cmd) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static void ChkBitstream() {
|
||||
static void ChkBitstream(void) {
|
||||
// convert to bitstream if necessary
|
||||
for (int i = 0; i < (int)(GraphTraceLen / 2); i++) {
|
||||
if (GraphBuffer[i] > 1 || GraphBuffer[i] < 0) {
|
||||
|
|
|
@ -1055,7 +1055,7 @@ static int CmdEM4x50Dump(const char *Cmd) {
|
|||
|
||||
#define EM_PREAMBLE_LEN 6
|
||||
// download samples from device and copy to Graphbuffer
|
||||
static bool downloadSamplesEM() {
|
||||
static bool downloadSamplesEM(void) {
|
||||
|
||||
// 8 bit preamble + 32 bit word response (max clock (128) * 40bits = 5120 samples)
|
||||
uint8_t got[6000];
|
||||
|
@ -1097,7 +1097,7 @@ static bool doPreambleSearch(size_t *startIdx) {
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool detectFSK() {
|
||||
static bool detectFSK(void) {
|
||||
// detect fsk clock
|
||||
if (GetFskClock("", false) == 0) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - EM: FSK clock failed");
|
||||
|
@ -1112,7 +1112,7 @@ static bool detectFSK() {
|
|||
return true;
|
||||
}
|
||||
// PSK clocks should be easy to detect ( but difficult to demod a non-repeating pattern... )
|
||||
static bool detectPSK() {
|
||||
static bool detectPSK(void) {
|
||||
int ans = GetPskClock("", false);
|
||||
if (ans <= 0) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - EM: PSK clock failed");
|
||||
|
@ -1136,7 +1136,7 @@ static bool detectPSK() {
|
|||
return true;
|
||||
}
|
||||
// try manchester - NOTE: ST only applies to T55x7 tags.
|
||||
static bool detectASK_MAN() {
|
||||
static bool detectASK_MAN(void) {
|
||||
bool stcheck = false;
|
||||
if (ASKDemod_ext("0 0 0", false, false, 1, &stcheck) != PM3_SUCCESS) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - EM: ASK/Manchester Demod failed");
|
||||
|
@ -1145,7 +1145,7 @@ static bool detectASK_MAN() {
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool detectASK_BI() {
|
||||
static bool detectASK_BI(void) {
|
||||
int ans = ASKbiphaseDemod("0 0 1", false);
|
||||
if (ans != PM3_SUCCESS) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - EM: ASK/biphase normal demod failed");
|
||||
|
@ -1158,7 +1158,7 @@ static bool detectASK_BI() {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
static bool detectNRZ() {
|
||||
static bool detectNRZ(void) {
|
||||
int ans = NRZrawDemod("0 0 1", false);
|
||||
if (ans != PM3_SUCCESS) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - EM: NRZ normal demod failed");
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
static char *getHitagTypeStr(uint32_t uid) {
|
||||
static const char *getHitagTypeStr(uint32_t uid) {
|
||||
//uid s/n ********
|
||||
uint8_t type = (uid >> 4) & 0xF;
|
||||
switch (type) {
|
||||
|
|
|
@ -32,7 +32,7 @@ struct pcf7931_config configPcf = {
|
|||
};
|
||||
|
||||
// Resets the configuration settings to default values.
|
||||
int pcf7931_resetConfig() {
|
||||
int pcf7931_resetConfig(void) {
|
||||
memset(configPcf.Pwd, 0xFF, sizeof(configPcf.Pwd));
|
||||
configPcf.InitDelay = PCF7931_DEFAULT_INITDELAY;
|
||||
configPcf.OffsetWidth = PCF7931_DEFAULT_OFFSET_WIDTH;
|
||||
|
@ -40,7 +40,7 @@ int pcf7931_resetConfig() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int pcf7931_printConfig() {
|
||||
int pcf7931_printConfig(void) {
|
||||
PrintAndLogEx(NORMAL, "Password (LSB first on bytes) : %s", sprint_hex(configPcf.Pwd, sizeof(configPcf.Pwd)));
|
||||
PrintAndLogEx(NORMAL, "Tag initialization delay : %d us", configPcf.InitDelay);
|
||||
PrintAndLogEx(NORMAL, "Offset low pulses width : %d us", configPcf.OffsetWidth);
|
||||
|
@ -48,7 +48,7 @@ int pcf7931_printConfig() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int usage_pcf7931_read() {
|
||||
static int usage_pcf7931_read(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: lf pcf7931 read [h] ");
|
||||
PrintAndLogEx(NORMAL, "This command tries to read a PCF7931 tag.");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
|
@ -58,7 +58,7 @@ static int usage_pcf7931_read() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int usage_pcf7931_write() {
|
||||
static int usage_pcf7931_write(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: lf pcf7931 write [h] <block address> <byte address> <data>");
|
||||
PrintAndLogEx(NORMAL, "This command tries to write a PCF7931 tag.");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
|
@ -71,7 +71,7 @@ static int usage_pcf7931_write() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int usage_pcf7931_config() {
|
||||
static int usage_pcf7931_config(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: lf pcf7931 config [h] [r] <pwd> <delay> <offset width> <offset position>");
|
||||
PrintAndLogEx(NORMAL, "This command tries to set the configuration used with PCF7931 commands");
|
||||
PrintAndLogEx(NORMAL, "The time offsets could be useful to correct slew rate generated by the antenna");
|
||||
|
|
|
@ -57,7 +57,7 @@ t55xx_conf_block_t config = {
|
|||
|
||||
t55xx_memory_item_t cardmem[T55x7_BLOCK_COUNT] = {{0}};
|
||||
|
||||
t55xx_conf_block_t Get_t55xx_Config() {
|
||||
t55xx_conf_block_t Get_t55xx_Config(void) {
|
||||
return config;
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ static void print_usage_t55xx_downloadlink(uint8_t ShowAll, uint8_t dl_mode_defa
|
|||
PrintAndLogEx(NORMAL, " 4 - Try all downlink modes%s", (dl_mode_default == 4) ? " (default)" : "");
|
||||
}
|
||||
|
||||
static int usage_t55xx_config() {
|
||||
static int usage_t55xx_config(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: lf t55xx config [c <blk0>] [d <demodulation>] [i [0/1]] [o <offset>] [Q5 [0/1]] [ST [0/1]]");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " h - This help");
|
||||
|
@ -99,7 +99,7 @@ static int usage_t55xx_config() {
|
|||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_t55xx_read() {
|
||||
static int usage_t55xx_read(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: lf t55xx read [r <mode>] b <block> [p <password>] [o] <page1>");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " b <block> - block number to read. Between 0-7");
|
||||
|
@ -119,7 +119,7 @@ static int usage_t55xx_read() {
|
|||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_t55xx_resetread() {
|
||||
static int usage_t55xx_resetread(void) {
|
||||
PrintAndLogEx(NORMAL, "Send Reset Cmd then lf read the stream to attempt to identify the start of it (needs a demod and/or plot after)");
|
||||
PrintAndLogEx(NORMAL, "Usage: lf t55xx resetread [r <mode>]");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
|
@ -130,7 +130,7 @@ static int usage_t55xx_resetread() {
|
|||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_t55xx_write() {
|
||||
static int usage_t55xx_write(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: lf t55xx write [r <mode>] b <block> d <data> [p <password>] [1] [t] [v]");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " b <block> - block number to write. Between 0-7");
|
||||
|
@ -148,7 +148,7 @@ static int usage_t55xx_write() {
|
|||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_t55xx_trace() {
|
||||
static int usage_t55xx_trace(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: lf t55xx trace [1] [r mode]");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
print_usage_t55xx_downloadlink(T55XX_DLMODE_SINGLE, config.downlink_mode);
|
||||
|
@ -160,7 +160,7 @@ static int usage_t55xx_trace() {
|
|||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_t55xx_info() {
|
||||
static int usage_t55xx_info(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: lf t55xx info [1] [r <mode>] [c <blk0> [q]]");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " (default) - read data from tag.");
|
||||
|
@ -180,7 +180,7 @@ static int usage_t55xx_info() {
|
|||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_t55xx_dump() {
|
||||
static int usage_t55xx_dump(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: lf t55xx dump [r <mode>] [p <password> [o]]");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " p <password> - OPTIONAL password 4bytes (8 hex symbols)");
|
||||
|
@ -194,7 +194,7 @@ static int usage_t55xx_dump() {
|
|||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_t55xx_restore() {
|
||||
static int usage_t55xx_restore(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: lf t55xx restore f <filename> [p password]");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " f <filename> - filename of the dump file (.bin/.eml)");
|
||||
|
@ -208,7 +208,7 @@ static int usage_t55xx_restore() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int usage_t55xx_detect() {
|
||||
static int usage_t55xx_detect(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: lf t55xx detect [1] [r <mode>] [p <password>]");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " 1 - if set, use Graphbuffer otherwise read data from tag.");
|
||||
|
@ -222,7 +222,7 @@ static int usage_t55xx_detect() {
|
|||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_t55xx_detectP1() {
|
||||
static int usage_t55xx_detectP1(void) {
|
||||
PrintAndLogEx(NORMAL, "Command: Detect Page 1 of a t55xx chip");
|
||||
PrintAndLogEx(NORMAL, "Usage: lf t55xx p1detect [1] [r <mode>] [p <password>]");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
|
@ -237,7 +237,7 @@ static int usage_t55xx_detectP1() {
|
|||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_t55xx_wakup() {
|
||||
static int usage_t55xx_wakup(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: lf t55xx wakeup [h] [r <mode>] p <password>");
|
||||
PrintAndLogEx(NORMAL, "This commands sends the Answer-On-Request command and leaves the readerfield ON afterwards.");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
|
@ -249,7 +249,7 @@ static int usage_t55xx_wakup() {
|
|||
PrintAndLogEx(NORMAL, " lf t55xx wakeup p 11223344 - send wakeup password");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_t55xx_chk() {
|
||||
static int usage_t55xx_chk(void) {
|
||||
PrintAndLogEx(NORMAL, "This command uses a dictionary attack");
|
||||
PrintAndLogEx(NORMAL, "press " _YELLOW_("'enter'") " to cancel the command");
|
||||
PrintAndLogEx(NORMAL, _RED_("WARNING:") " this may brick non-password protected chips!");
|
||||
|
@ -267,7 +267,7 @@ static int usage_t55xx_chk() {
|
|||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_t55xx_bruteforce() {
|
||||
static int usage_t55xx_bruteforce(void) {
|
||||
PrintAndLogEx(NORMAL, "This command uses bruteforce to scan a number range");
|
||||
PrintAndLogEx(NORMAL, "press " _YELLOW_("'enter'") " to cancel the command");
|
||||
PrintAndLogEx(NORMAL, _RED_("WARNING:") " this may brick non-password protected chips!");
|
||||
|
@ -285,7 +285,7 @@ static int usage_t55xx_bruteforce() {
|
|||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_t55xx_recoverpw() {
|
||||
static int usage_t55xx_recoverpw(void) {
|
||||
PrintAndLogEx(NORMAL, "This command uses a few tricks to try to recover mangled password");
|
||||
PrintAndLogEx(NORMAL, "press " _YELLOW_("'enter'") " to cancel the command");
|
||||
PrintAndLogEx(NORMAL, _RED_("WARNING:") " this may brick non-password protected chips!");
|
||||
|
@ -306,7 +306,7 @@ static int usage_t55xx_recoverpw() {
|
|||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_t55xx_wipe() {
|
||||
static int usage_t55xx_wipe(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: lf t55xx wipe [h] [Q5] [p <password>] [c <blk0>]");
|
||||
PrintAndLogEx(NORMAL, "This commands wipes a tag, fills blocks 1-7 with zeros and a default configuration block");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
|
@ -319,7 +319,7 @@ static int usage_t55xx_wipe() {
|
|||
PrintAndLogEx(NORMAL, " lf t55xx wipe q - wipes a T5555 ( Q5 ) tag, config block 0x6001F004");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_t55xx_deviceconfig() {
|
||||
static int usage_t55xx_deviceconfig(void) {
|
||||
PrintAndLogEx(NORMAL, "Sets t55x7 timings for direct commands. The timings are set here in Field Clocks (FC), \nwhich is converted to (US) on device");
|
||||
PrintAndLogEx(NORMAL, "Usage: lf t55xx deviceconfig [r <mode>] a <gap> b <gap> c <gap> d <gap> e <gap> f <gap> g <gap> [p]");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
|
@ -340,7 +340,7 @@ static int usage_t55xx_deviceconfig() {
|
|||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_t55xx_protect() {
|
||||
static int usage_t55xx_protect(void) {
|
||||
PrintAndLogEx(NORMAL, "This command sets the pwd bit on T5577.");
|
||||
PrintAndLogEx(NORMAL, _RED_("WARNING:") " this locks the tag!");
|
||||
PrintAndLogEx(NORMAL, "Usage: lf t55xx protect [r <mode>] [p <password>] [o] [n <new_password>]");
|
||||
|
@ -356,7 +356,7 @@ static int usage_t55xx_protect() {
|
|||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_t55xx_dangerraw() {
|
||||
static int usage_t55xx_dangerraw(void) {
|
||||
PrintAndLogEx(NORMAL, "This command allows to emit arbitrary raw commands on T5577 and cut the field after arbitrary duration.");
|
||||
PrintAndLogEx(NORMAL, _RED_("WARNING:") " this may lock definitively the tag in an unusable state!");
|
||||
PrintAndLogEx(NORMAL, "Uncontrolled usage can easily write an invalid configuration, activate lock bits,");
|
||||
|
@ -372,7 +372,7 @@ static int usage_t55xx_dangerraw() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int usage_t55xx_clonehelp() {
|
||||
static int usage_t55xx_clonehelp(void) {
|
||||
PrintAndLogEx(NORMAL, "For cloning specific techs on T55xx tags, see commands available in corresponding LF sub-menus, e.g.:");
|
||||
PrintAndLogEx(NORMAL, _GREEN_("lf awid clone"));
|
||||
// todo: rename to clone
|
||||
|
@ -408,13 +408,13 @@ static int CmdT55xxCloneHelp(const char *Cmd) {
|
|||
return usage_t55xx_clonehelp();
|
||||
}
|
||||
|
||||
void T55x7_SaveBlockData(uint8_t idx, uint32_t data) {
|
||||
static void T55x7_SaveBlockData(uint8_t idx, uint32_t data) {
|
||||
if (idx < T55x7_BLOCK_COUNT) {
|
||||
cardmem[idx].valid = true;
|
||||
cardmem[idx].blockdata = data;
|
||||
}
|
||||
}
|
||||
void T55x7_ClearAllBlockData(void) {
|
||||
static void T55x7_ClearAllBlockData(void) {
|
||||
for (uint8_t idx = 0; idx < T55x7_BLOCK_COUNT; idx++) {
|
||||
cardmem[idx].valid = false;
|
||||
cardmem[idx].blockdata = 0x00;
|
||||
|
@ -1011,7 +1011,7 @@ static int SanityOfflineCheck(bool useGraphBuffer) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
void T55xx_Print_DownlinkMode(uint8_t downlink_mode) {
|
||||
static void T55xx_Print_DownlinkMode(uint8_t downlink_mode) {
|
||||
char msg[80];
|
||||
sprintf(msg, "Downlink Mode used : ");
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ static int usage_auto(void) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static void AppendDate(char *s, size_t slen, char *fmt) {
|
||||
static void AppendDate(char *s, size_t slen, const char *fmt) {
|
||||
struct tm *ct, tm_buf;
|
||||
time_t now = time(NULL);
|
||||
#if defined(_WIN32)
|
||||
|
@ -287,7 +287,7 @@ int CommandReceived(char *Cmd) {
|
|||
return CmdsParse(CommandTable, Cmd);
|
||||
}
|
||||
|
||||
command_t *getTopLevelCommandTable() {
|
||||
command_t *getTopLevelCommandTable(void) {
|
||||
return CommandTable;
|
||||
}
|
||||
|
||||
|
|
|
@ -875,7 +875,7 @@ static int CmdSmartList(const char *Cmd) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void smart_brute_prim() {
|
||||
static void smart_brute_prim(void) {
|
||||
|
||||
uint8_t *buf = calloc(PM3_CMD_DATA_SIZE, sizeof(uint8_t));
|
||||
if (!buf)
|
||||
|
|
|
@ -25,7 +25,7 @@ static int CmdHelp(const char *Cmd);
|
|||
static uint8_t *trace;
|
||||
long traceLen = 0;
|
||||
|
||||
static int usage_trace_list() {
|
||||
static int usage_trace_list(void) {
|
||||
PrintAndLogEx(NORMAL, "List protocol data in trace buffer.");
|
||||
PrintAndLogEx(NORMAL, "Usage: trace list <protocol> [f][c| <0|1>");
|
||||
PrintAndLogEx(NORMAL, " f - show frame delay times as well");
|
||||
|
@ -56,14 +56,14 @@ static int usage_trace_list() {
|
|||
PrintAndLogEx(NORMAL, " trace list iclass");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_trace_load() {
|
||||
static int usage_trace_load(void) {
|
||||
PrintAndLogEx(NORMAL, "Load protocol data from file to trace buffer.");
|
||||
PrintAndLogEx(NORMAL, "Usage: trace load <filename>");
|
||||
PrintAndLogEx(NORMAL, "Examples:");
|
||||
PrintAndLogEx(NORMAL, " trace load mytracefile.bin");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_trace_save() {
|
||||
static int usage_trace_save(void) {
|
||||
PrintAndLogEx(NORMAL, "Save protocol data from trace buffer to file.");
|
||||
PrintAndLogEx(NORMAL, "Usage: trace save <filename>");
|
||||
PrintAndLogEx(NORMAL, "Examples:");
|
||||
|
|
|
@ -274,7 +274,7 @@ static int usart_bt_testcomm(uint32_t baudrate, uint8_t parity) {
|
|||
if (ret != PM3_SUCCESS)
|
||||
return ret;
|
||||
|
||||
char *string = "AT+VERSION";
|
||||
const char *string = "AT+VERSION";
|
||||
uint8_t data[PM3_CMD_DATA_SIZE] = {0x00};
|
||||
size_t len = 0;
|
||||
|
||||
|
@ -359,7 +359,7 @@ static int CmdUsartBtFactory(const char *Cmd) {
|
|||
}
|
||||
|
||||
PrintAndLogEx(INFO, "Reconfiguring add-on to default settings.");
|
||||
char *string;
|
||||
const char *string;
|
||||
uint8_t data[PM3_CMD_DATA_SIZE];
|
||||
size_t len = 0;
|
||||
memset(data, 0, sizeof(data));
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
static int usage_wiegand_list() {
|
||||
static int usage_wiegand_list(void) {
|
||||
PrintAndLogEx(NORMAL, "List available wiegand formats");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_wiegand_encode() {
|
||||
static int usage_wiegand_encode(void) {
|
||||
PrintAndLogEx(NORMAL, "Encode wiegand formatted number to raw hex");
|
||||
PrintAndLogEx(NORMAL, "Usage: wiegand encode [w <format>] [<field> <value (decimal)>] {...}");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
|
@ -42,7 +42,7 @@ static int usage_wiegand_encode() {
|
|||
PrintAndLogEx(NORMAL, " wiegand encode w H10301 f 101 c 1337");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_wiegand_decode() {
|
||||
static int usage_wiegand_decode(void) {
|
||||
PrintAndLogEx(NORMAL, "Decode raw hex to wiegand format");
|
||||
PrintAndLogEx(NORMAL, "Usage: wiegand decode [id] <p>");
|
||||
PrintAndLogEx(NORMAL, " p ignore invalid parity");
|
||||
|
@ -52,7 +52,7 @@ static int usage_wiegand_decode() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
void PrintTagId(wiegand_message_t *packed) {
|
||||
static void PrintTagId(wiegand_message_t *packed) {
|
||||
if (packed->Top != 0) {
|
||||
PrintAndLogEx(SUCCESS, "Card ID: %X%08X%08X",
|
||||
(uint32_t)packed->Top,
|
||||
|
|
|
@ -202,7 +202,7 @@ void SendCommandMIX(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, v
|
|||
* A better method could have been to have explicit command-ACKS, so we can know which ACK goes to which
|
||||
* operation. Right now we'll just have to live with this.
|
||||
*/
|
||||
void clearCommandBuffer() {
|
||||
void clearCommandBuffer(void) {
|
||||
//This is a very simple operation
|
||||
pthread_mutex_lock(&rxBufferMutex);
|
||||
cmd_tail = cmd_head;
|
||||
|
|
|
@ -1360,7 +1360,7 @@ static int searchFinalFile(char **foundpath, const char *pm3dir, const char *sea
|
|||
(strcmp(FIRMWARES_SUBDIR, pm3dir) == 0) ||
|
||||
(strcmp(BOOTROM_SUBDIR, pm3dir) == 0) ||
|
||||
(strcmp(FULLIMAGE_SUBDIR, pm3dir) == 0))) {
|
||||
char *above = "../";
|
||||
const char *above = "../";
|
||||
char *path = calloc(strlen(exec_path) + strlen(above) + strlen(pm3dir) + strlen(filename) + 1, sizeof(char));
|
||||
if (path == NULL)
|
||||
goto out;
|
||||
|
|
|
@ -116,7 +116,7 @@ bool isGraphBitstream(void) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void convertGraphFromBitstream() {
|
||||
void convertGraphFromBitstream(void) {
|
||||
convertGraphFromBitstreamEx(1, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -283,7 +283,7 @@ void doMAC_N(uint8_t *address_data_p, uint8_t address_data_size, uint8_t *div_ke
|
|||
}
|
||||
|
||||
#ifndef ON_DEVICE
|
||||
int testMAC() {
|
||||
int testMAC(void) {
|
||||
PrintAndLogEx(SUCCESS, "Testing MAC calculation...");
|
||||
|
||||
//From the "dismantling.IClass" paper:
|
||||
|
|
|
@ -190,7 +190,7 @@ void printarr_human_readable(const char *title, uint8_t *arr, int len) {
|
|||
//-----------------------------
|
||||
|
||||
#ifndef ON_DEVICE
|
||||
static int testBitStream() {
|
||||
static int testBitStream(void) {
|
||||
uint8_t input [] = {0xDE, 0xAD, 0xBE, 0xEF, 0xDE, 0xAD, 0xBE, 0xEF};
|
||||
uint8_t output [] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
BitstreamIn in = { input, sizeof(input) * 8, 0};
|
||||
|
@ -215,7 +215,7 @@ static int testBitStream() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int testReversedBitstream() {
|
||||
static int testReversedBitstream(void) {
|
||||
uint8_t input [] = {0xDE, 0xAD, 0xBE, 0xEF, 0xDE, 0xAD, 0xBE, 0xEF};
|
||||
uint8_t reverse [] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
uint8_t output [] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
|
|
@ -568,7 +568,7 @@ int bruteforceFileNoKeys(const char *filename) {
|
|||
// ----------------------------------------------------------------------------
|
||||
// TEST CODE BELOW
|
||||
// ----------------------------------------------------------------------------
|
||||
static int _testBruteforce() {
|
||||
static int _testBruteforce(void) {
|
||||
|
||||
PrintAndLogEx(INFO, "Testing crack from dumpfile...");
|
||||
|
||||
|
@ -596,7 +596,7 @@ static int _testBruteforce() {
|
|||
return errors;
|
||||
}
|
||||
|
||||
static int _test_iclass_key_permutation() {
|
||||
static int _test_iclass_key_permutation(void) {
|
||||
uint8_t testcase[8] = {0x6c, 0x8d, 0x44, 0xf9, 0x2a, 0x2d, 0x01, 0xbf};
|
||||
uint8_t testcase_output[8] = {0};
|
||||
uint8_t testcase_output_correct[8] = {0x8a, 0x0d, 0xb9, 0x88, 0xbb, 0xa7, 0x90, 0xea};
|
||||
|
@ -622,7 +622,7 @@ static int _test_iclass_key_permutation() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int _testHash1() {
|
||||
static int _testHash1(void) {
|
||||
uint8_t expected[8] = {0x7E, 0x72, 0x2F, 0x40, 0x2D, 0x02, 0x51, 0x42};
|
||||
uint8_t csn[8] = {0x01, 0x02, 0x03, 0x04, 0xF7, 0xFF, 0x12, 0xE0};
|
||||
uint8_t k[8] = {0};
|
||||
|
|
|
@ -219,7 +219,7 @@ static void permute(BitstreamIn *p_in, uint64_t z, int l, int r, BitstreamOut *o
|
|||
}
|
||||
}
|
||||
|
||||
static void printbegin() {
|
||||
static void printbegin(void) {
|
||||
if (debug_print < 2)
|
||||
return;
|
||||
|
||||
|
@ -369,7 +369,7 @@ void diversifyKey(uint8_t csn[8], uint8_t key[8], uint8_t div_key[8]) {
|
|||
hash0(crypt_csn, div_key);
|
||||
}
|
||||
/*
|
||||
static void testPermute() {
|
||||
static void testPermute(void) {
|
||||
uint64_t x = 0;
|
||||
pushbackSixBitByte(&x, 0x00, 0);
|
||||
pushbackSixBitByte(&x, 0x01, 1);
|
||||
|
@ -555,7 +555,7 @@ Testcase testcases[] = {
|
|||
{{0}, {0}, {0}}
|
||||
};
|
||||
|
||||
static int testKeyDiversificationWithMasterkeyTestcases() {
|
||||
static int testKeyDiversificationWithMasterkeyTestcases(void) {
|
||||
int i, error = 0;
|
||||
uint8_t empty[8] = {0};
|
||||
|
||||
|
@ -630,7 +630,7 @@ static int testDES2(uint64_t csn, uint64_t expected) {
|
|||
* @brief doTestsWithKnownInputs
|
||||
* @return
|
||||
*/
|
||||
static int doTestsWithKnownInputs() {
|
||||
static int doTestsWithKnownInputs(void) {
|
||||
// KSel from http://www.proxmark.org/forum/viewtopic.php?pid=10977#p10977
|
||||
int errors = 0;
|
||||
PrintAndLogEx(SUCCESS, "Testing DES encryption");
|
||||
|
|
|
@ -318,6 +318,7 @@ static const luaL_Reg binlib[] = {
|
|||
{NULL, NULL}
|
||||
};
|
||||
|
||||
LUALIB_API int luaopen_binlib(lua_State *L);
|
||||
LUALIB_API int luaopen_binlib(lua_State *L) {
|
||||
luaL_newlib(L, binlib);
|
||||
return 1;
|
||||
|
|
|
@ -126,6 +126,7 @@ static const struct luaL_Reg bitlib[] = {
|
|||
{NULL, NULL}
|
||||
};
|
||||
|
||||
LUALIB_API int luaopen_bit(lua_State *L);
|
||||
LUALIB_API int luaopen_bit(lua_State *L) {
|
||||
luaL_newlib(L, bitlib);
|
||||
//luaL_register(L, "bit", bitlib);
|
||||
|
|
|
@ -44,7 +44,7 @@ static char *prefGetFilename(void) {
|
|||
if (searchHomeFilePath(&path, preferencesFilename, false) == PM3_SUCCESS)
|
||||
return path;
|
||||
else
|
||||
return preferencesFilename;
|
||||
return strdup(preferencesFilename);
|
||||
}
|
||||
|
||||
int preferences_load(void) {
|
||||
|
@ -314,7 +314,7 @@ void preferences_load_callback(json_t *root) {
|
|||
|
||||
// Help Functions
|
||||
|
||||
static int usage_set_emoji() {
|
||||
static int usage_set_emoji(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: pref set emoji <alias | emoji | alttext | erase>");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " "_GREEN_("help")" - This help");
|
||||
|
@ -325,7 +325,7 @@ static int usage_set_emoji() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int usage_set_color() {
|
||||
static int usage_set_color(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: pref set color <off | ansi>");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " "_GREEN_("help")" - This help");
|
||||
|
@ -334,7 +334,7 @@ static int usage_set_color() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int usage_set_debug() {
|
||||
static int usage_set_debug(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: pref set clientdebug <off | simple | full>");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " "_GREEN_("help")" - This help");
|
||||
|
@ -344,7 +344,7 @@ static int usage_set_debug() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
/*
|
||||
static int usage_set_devicedebug() {
|
||||
static int usage_set_devicedebug(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: pref set devicedebug <off | error | info | debug | extended>");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " "_GREEN_("help")" - This help");
|
||||
|
@ -357,7 +357,7 @@ static int usage_set_devicedebug() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
*/
|
||||
static int usage_set_hints() {
|
||||
static int usage_set_hints(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: pref set hints <off | on>");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " "_GREEN_("help")" - This help");
|
||||
|
@ -366,7 +366,7 @@ static int usage_set_hints() {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
/*
|
||||
static int usage_set_savePaths() {
|
||||
static int usage_set_savePaths(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: pref set savepaths [help] [create] [default <path>] [dump <path>] [trace <path>]");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " "_GREEN_("help")" - This help");
|
||||
|
@ -382,7 +382,7 @@ static int usage_set_savePaths() {
|
|||
// typedef enum preferenceId {prefNONE,prefHELP,prefEMOJI,prefCOLOR,prefPLOT,prefOVERLAY,prefHINTS,prefCLIENTDEBUG} preferenceId_t;
|
||||
typedef enum prefShowOpt {prefShowNone, prefShowOLD, prefShowNEW} prefShowOpt_t;
|
||||
|
||||
const char *prefShowMsg(prefShowOpt_t Opt) {
|
||||
static const char *prefShowMsg(prefShowOpt_t Opt) {
|
||||
switch (Opt) {
|
||||
case prefShowOLD:
|
||||
return _YELLOW_("[old]");
|
||||
|
@ -395,7 +395,7 @@ const char *prefShowMsg(prefShowOpt_t Opt) {
|
|||
return "";
|
||||
}
|
||||
|
||||
void showEmojiState(prefShowOpt_t Opt) {
|
||||
static void showEmojiState(prefShowOpt_t Opt) {
|
||||
|
||||
switch (session.emoji_mode) {
|
||||
case ALIAS:
|
||||
|
@ -415,7 +415,7 @@ void showEmojiState(prefShowOpt_t Opt) {
|
|||
}
|
||||
}
|
||||
|
||||
void showColorState(prefShowOpt_t Opt) {
|
||||
static void showColorState(prefShowOpt_t Opt) {
|
||||
|
||||
if (session.supports_colors)
|
||||
PrintAndLogEx(NORMAL, " %s color.................. "_GREEN_("ansi"), prefShowMsg(Opt));
|
||||
|
@ -423,7 +423,7 @@ void showColorState(prefShowOpt_t Opt) {
|
|||
PrintAndLogEx(NORMAL, " %s color.................. "_WHITE_("off"), prefShowMsg(Opt));
|
||||
}
|
||||
|
||||
void showClientDebugState(prefShowOpt_t Opt) {
|
||||
static void showClientDebugState(prefShowOpt_t Opt) {
|
||||
|
||||
switch (session.client_debug_level) {
|
||||
case cdbOFF:
|
||||
|
@ -440,7 +440,7 @@ void showClientDebugState(prefShowOpt_t Opt) {
|
|||
}
|
||||
}
|
||||
/*
|
||||
void showDeviceDebugState(prefShowOpt_t Opt) {
|
||||
static void showDeviceDebugState(prefShowOpt_t Opt) {
|
||||
switch (session.device_debug_level) {
|
||||
case ddbOFF:
|
||||
PrintAndLogEx(NORMAL, " %s device debug........... "_WHITE_("off"), prefShowMsg(Opt));
|
||||
|
@ -463,7 +463,7 @@ void showDeviceDebugState(prefShowOpt_t Opt) {
|
|||
}
|
||||
*/
|
||||
/*
|
||||
void showSavePathState(savePaths_t pathIndex, prefShowOpt_t Opt) {
|
||||
static void showSavePathState(savePaths_t pathIndex, prefShowOpt_t Opt) {
|
||||
|
||||
char tempStr[50];
|
||||
|
||||
|
@ -485,18 +485,19 @@ void showSavePathState(savePaths_t pathIndex, prefShowOpt_t Opt) {
|
|||
else
|
||||
PrintAndLogEx(NORMAL, " %s %s "_GREEN_("%s"), prefShowMsg(Opt), tempStr, session.defaultPaths[pathIndex]);
|
||||
}
|
||||
*/
|
||||
void showPlotPosState(void) {
|
||||
|
||||
static void showPlotPosState(void) {
|
||||
PrintAndLogEx(NORMAL, " Plot window............ X "_GREEN_("%4d")" Y "_GREEN_("%4d")" H "_GREEN_("%4d")" W "_GREEN_("%4d"),
|
||||
session.plot.x, session.plot.y, session.plot.h, session.plot.w);
|
||||
}
|
||||
|
||||
void showOverlayPosState(void) {
|
||||
static void showOverlayPosState(void) {
|
||||
PrintAndLogEx(NORMAL, " Slider/Overlay window.. X "_GREEN_("%4d")" Y "_GREEN_("%4d")" H "_GREEN_("%4d")" W "_GREEN_("%4d"),
|
||||
session.overlay.x, session.overlay.y, session.overlay.h, session.overlay.w);
|
||||
}
|
||||
*/
|
||||
|
||||
void showHintsState(prefShowOpt_t Opt) {
|
||||
static void showHintsState(prefShowOpt_t Opt) {
|
||||
if (session.show_hints)
|
||||
PrintAndLogEx(NORMAL, " %s hints.................. "_GREEN_("on"), prefShowMsg(Opt));
|
||||
else
|
||||
|
@ -850,28 +851,28 @@ static int setCmdSavePaths (const char *Cmd) {
|
|||
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
*/
|
||||
|
||||
int getCmdHelp(const char *Cmd) {
|
||||
static int getCmdHelp(const char *Cmd) {
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
*/
|
||||
|
||||
int getCmdEmoji(const char *Cmd) {
|
||||
static int getCmdEmoji(const char *Cmd) {
|
||||
showEmojiState(prefShowNone);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int getCmdHint(const char *Cmd) {
|
||||
static int getCmdHint(const char *Cmd) {
|
||||
showHintsState(prefShowNone);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int getCmdColor(const char *Cmd) {
|
||||
static int getCmdColor(const char *Cmd) {
|
||||
showColorState(prefShowNone);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int getCmdDebug(const char *Cmd) {
|
||||
static int getCmdDebug(const char *Cmd) {
|
||||
showClientDebugState(prefShowNone);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
@ -904,12 +905,12 @@ static int setCmdHelp(const char *Cmd) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int CmdPrefGet(const char *Cmd) {
|
||||
static int CmdPrefGet(const char *Cmd) {
|
||||
clearCommandBuffer();
|
||||
return CmdsParse(getCommandTable, Cmd);
|
||||
}
|
||||
|
||||
int CmdPrefSet(const char *Cmd) {
|
||||
static int CmdPrefSet(const char *Cmd) {
|
||||
clearCommandBuffer();
|
||||
return CmdsParse(setCommandTable, Cmd);
|
||||
}
|
||||
|
|
|
@ -59,7 +59,6 @@ extern uint8_t g_debugMode;
|
|||
#ifndef FILE_PATH_SIZE
|
||||
#define FILE_PATH_SIZE 1000
|
||||
#endif
|
||||
extern uint8_t gui_serial_port_name[FILE_PATH_SIZE];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "proxgui.h"
|
||||
#include <QtGui>
|
||||
#include "ui.h"
|
||||
#include "comms.h"
|
||||
|
||||
extern "C" int preferences_save(void);
|
||||
|
||||
|
|
|
@ -116,8 +116,8 @@ static void showBanner(void) {
|
|||
static const char *prompt_dev = "";
|
||||
static const char *prompt_ctx = "";
|
||||
|
||||
static void prompt_compose(char *buf, size_t buflen, const char *prompt_ctx, const char *prompt_dev) {
|
||||
snprintf(buf, buflen - 1, PROXPROMPT_COMPOSE, prompt_dev, prompt_ctx);
|
||||
static void prompt_compose(char *buf, size_t buflen, const char *promptctx, const char *promptdev) {
|
||||
snprintf(buf, buflen - 1, PROXPROMPT_COMPOSE, promptdev, promptctx);
|
||||
}
|
||||
|
||||
static int check_comm(void) {
|
||||
|
@ -155,11 +155,11 @@ int push_cmdscriptfile(char *path, bool stayafter) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static FILE *current_cmdscriptfile() {
|
||||
static FILE *current_cmdscriptfile(void) {
|
||||
return cmdscriptfile[cmdscriptfile_idx];
|
||||
}
|
||||
|
||||
static bool pop_cmdscriptfile() {
|
||||
static bool pop_cmdscriptfile(void) {
|
||||
fclose(cmdscriptfile[cmdscriptfile_idx]);
|
||||
cmdscriptfile[cmdscriptfile_idx--] = NULL;
|
||||
if (cmdscriptfile_idx == 0)
|
||||
|
|
|
@ -823,12 +823,6 @@ void wiegand_add_parity_swapped(uint8_t *target, uint8_t *source, uint8_t length
|
|||
*(target) = GetParity(source + length / 2, EVEN, length / 2);
|
||||
}
|
||||
|
||||
// xor two arrays together for len items. The dst array contains the new xored values.
|
||||
void xor(unsigned char *dst, unsigned char *src, size_t len) {
|
||||
for (; len > 0; len--, dst++, src++)
|
||||
*dst ^= *src;
|
||||
}
|
||||
|
||||
// Pack a bitarray into a uint32_t.
|
||||
uint32_t PackBits(uint8_t start, uint8_t len, uint8_t *bits) {
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
# define FILE_PATH_SIZE 1000
|
||||
#endif
|
||||
|
||||
uint8_t g_debugMode;
|
||||
uint8_t g_printAndLog;
|
||||
extern uint8_t g_debugMode;
|
||||
extern uint8_t g_printAndLog;
|
||||
|
||||
#define PRINTANDLOG_PRINT 1
|
||||
#define PRINTANDLOG_LOG 2
|
||||
|
|
|
@ -602,7 +602,7 @@ static const cardformat_t FormatTable[] = {
|
|||
{NULL, NULL, NULL, NULL, {0, 0, 0, 0, 0}} // Must null terminate array
|
||||
};
|
||||
|
||||
void HIDListFormats() {
|
||||
void HIDListFormats(void) {
|
||||
if (FormatTable[0].Name == NULL)
|
||||
return;
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ typedef struct {
|
|||
cardformatdescriptor_t Fields;
|
||||
} cardformat_t;
|
||||
|
||||
void HIDListFormats();
|
||||
void HIDListFormats(void);
|
||||
int HIDFindCardFormat(const char *format);
|
||||
cardformat_t HIDGetCardFormat(int idx);
|
||||
bool HIDPack(int format_idx, wiegand_card_t *card, wiegand_message_t *packed);
|
||||
|
|
|
@ -64,7 +64,7 @@ bool set_bit_by_position(wiegand_message_t *data, bool value, uint8_t pos) {
|
|||
* If the definition of the wiegand_message struct changes, this function must also
|
||||
* be updated to match.
|
||||
*/
|
||||
void message_datacopy(wiegand_message_t *src, wiegand_message_t *dest) {
|
||||
static void message_datacopy(wiegand_message_t *src, wiegand_message_t *dest) {
|
||||
dest->Bot = src->Bot;
|
||||
dest->Mid = src->Mid;
|
||||
dest->Top = src->Top;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue