stricter warnings, wip
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "commonutil.h" // ARRAYLEN
|
||||
#include "cmdparser.h" // for command_t
|
||||
#include "ui.h" // for show graph controls
|
||||
#include "proxgui.h"
|
||||
#include "graph.h" // for graph data
|
||||
#include "comms.h"
|
||||
#include "lfdemod.h" // for demod code
|
||||
@@ -287,7 +288,7 @@ static int usage_data_buffclear(void) {
|
||||
PrintAndLogEx(NORMAL, " h This help");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_data_fsktonrz() {
|
||||
static int usage_data_fsktonrz(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: data fsktonrz c <clock> l <fc_low> f <fc_high>");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " h This help");
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "cmdhfcryptorf.h" // CryptoRF
|
||||
#include "cmdtrace.h" // trace list
|
||||
#include "ui.h"
|
||||
#include "proxgui.h"
|
||||
#include "cmddata.h"
|
||||
#include "graph.h"
|
||||
#include "fpga.h"
|
||||
|
||||
@@ -1245,7 +1245,7 @@ int CmdHF14A(const char *Cmd) {
|
||||
return CmdsParse(CommandTable, Cmd);
|
||||
}
|
||||
|
||||
static void printTag(char *tag) {
|
||||
static void printTag(const char *tag) {
|
||||
PrintAndLogEx(SUCCESS, "POSSIBLE TYPE:" _YELLOW_(" %s"), tag);
|
||||
}
|
||||
|
||||
@@ -1340,7 +1340,7 @@ int detect_nxp_card(uint8_t sak, uint16_t atqa) {
|
||||
typedef struct {
|
||||
uint8_t uid0;
|
||||
uint8_t uid1;
|
||||
char *desc;
|
||||
const char *desc;
|
||||
} uidname;
|
||||
|
||||
const uidname uidmap[] = {
|
||||
|
||||
@@ -170,7 +170,7 @@ typedef enum {
|
||||
CL_AMISC7 = 0xFF,
|
||||
} aidcluster_h;
|
||||
|
||||
static char *cluster_to_text(uint8_t cluster) {
|
||||
static const char *cluster_to_text(uint8_t cluster) {
|
||||
switch (cluster) {
|
||||
case CL_ADMIN:
|
||||
return "card administration";
|
||||
@@ -375,7 +375,7 @@ static char *getVersionStr(uint8_t major, uint8_t minor) {
|
||||
}
|
||||
|
||||
|
||||
int DESFIRESendApdu(bool activate_field, bool leavefield_on, sAPDU apdu, uint8_t *result, int max_result_len, int *result_len, uint16_t *sw) {
|
||||
static int DESFIRESendApdu(bool activate_field, bool leavefield_on, sAPDU apdu, uint8_t *result, int max_result_len, int *result_len, uint16_t *sw) {
|
||||
|
||||
*result_len = 0;
|
||||
if (sw) *sw = 0;
|
||||
@@ -433,7 +433,7 @@ int DESFIRESendApdu(bool activate_field, bool leavefield_on, sAPDU apdu, uint8_t
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static char *getstatus(uint16_t *sw) {
|
||||
static const char *getstatus(uint16_t *sw) {
|
||||
if (sw == NULL) return "--> sw argument error. This should never happen !";
|
||||
if (((*sw >> 8) & 0xFF) == 0x91) {
|
||||
switch (*sw & 0xFF) {
|
||||
@@ -500,7 +500,7 @@ static char *getstatus(uint16_t *sw) {
|
||||
return "Unknown error";
|
||||
}
|
||||
|
||||
static char *GetErrorString(int res, uint16_t *sw) {
|
||||
static const char *GetErrorString(int res, uint16_t *sw) {
|
||||
switch (res) {
|
||||
case PM3_EAPDU_FAIL:
|
||||
return getstatus(sw);
|
||||
@@ -642,7 +642,7 @@ static nxp_cardtype_t getCardType(uint8_t major, uint8_t minor) {
|
||||
return DESFIRE_UNKNOWN;
|
||||
}
|
||||
|
||||
int handler_desfire_auth(mfdes_authinput_t *payload, mfdes_auth_res_t *rpayload, bool defaultkey) {
|
||||
static int handler_desfire_auth(mfdes_authinput_t *payload, mfdes_auth_res_t *rpayload, bool defaultkey) {
|
||||
// 3 different way to authenticate AUTH (CRC16) , AUTH_ISO (CRC32) , AUTH_AES (CRC32)
|
||||
// 4 different crypto arg1 DES, 3DES, 3K3DES, AES
|
||||
// 3 different communication modes, PLAIN,MAC,CRYPTO
|
||||
@@ -913,7 +913,7 @@ int handler_desfire_auth(mfdes_authinput_t *payload, mfdes_auth_res_t *rpayload,
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
void AuthToError(int error) {
|
||||
static void AuthToError(int error) {
|
||||
switch (error) {
|
||||
case 1:
|
||||
PrintAndLogEx(SUCCESS, "Sending auth command failed");
|
||||
@@ -953,7 +953,7 @@ void AuthToError(int error) {
|
||||
}
|
||||
}
|
||||
// -- test if card supports 0x0A
|
||||
static int test_desfire_authenticate() {
|
||||
static int test_desfire_authenticate(void) {
|
||||
uint8_t data[] = {0x00};
|
||||
sAPDU apdu = {0x90, MFDES_AUTHENTICATE, 0x00, 0x00, 0x01, data}; // 0x0A, KEY 0
|
||||
int recv_len = 0;
|
||||
@@ -968,7 +968,7 @@ static int test_desfire_authenticate() {
|
||||
}
|
||||
|
||||
// -- test if card supports 0x1A
|
||||
static int test_desfire_authenticate_iso() {
|
||||
static int test_desfire_authenticate_iso(void) {
|
||||
uint8_t data[] = {0x00};
|
||||
sAPDU apdu = {0x90, MFDES_AUTHENTICATE_ISO, 0x00, 0x00, 0x01, data}; // 0x1A, KEY 0
|
||||
int recv_len = 0;
|
||||
@@ -983,7 +983,7 @@ static int test_desfire_authenticate_iso() {
|
||||
}
|
||||
|
||||
// -- test if card supports 0xAA
|
||||
static int test_desfire_authenticate_aes() {
|
||||
static int test_desfire_authenticate_aes(void) {
|
||||
uint8_t data[] = {0x00};
|
||||
sAPDU apdu = {0x90, MFDES_AUTHENTICATE_AES, 0x00, 0x00, 0x01, data}; // 0xAA, KEY 0
|
||||
int recv_len = 0;
|
||||
@@ -1210,7 +1210,7 @@ static int handler_desfire_keyversion(uint8_t curr_key, uint8_t *num_versions) {
|
||||
return res;
|
||||
}
|
||||
|
||||
static int handler_desfire_commit_transaction() {
|
||||
static int handler_desfire_commit_transaction(void) {
|
||||
sAPDU apdu = {0x90, MFDES_COMMIT_TRANSACTION, 0x00, 0x00, 0x00, NULL}; //0xC7
|
||||
int recv_len = 0;
|
||||
uint16_t sw = 0;
|
||||
@@ -1225,7 +1225,7 @@ static int handler_desfire_commit_transaction() {
|
||||
return res;
|
||||
}
|
||||
|
||||
/*static int handler_desfire_abort_transaction() {
|
||||
/*static int handler_desfire_abort_transaction(void) {
|
||||
sAPDU apdu = {0x90, MFDES_ABORT_TRANSACTION, 0x00, 0x00, 0x00, NULL}; //0xA7
|
||||
int recv_len = 0;
|
||||
uint16_t sw = 0;
|
||||
@@ -1647,7 +1647,7 @@ static int handler_desfire_create_backup_file(mfdes_file_t *file) {
|
||||
return res;
|
||||
}
|
||||
|
||||
int getKeySettings(uint8_t *aid) {
|
||||
static int getKeySettings(uint8_t *aid) {
|
||||
if (aid == NULL) return PM3_EINVARG;
|
||||
|
||||
int res = 0;
|
||||
@@ -3558,7 +3558,7 @@ static int CmdHF14ADesAuth(const char *Cmd) {
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
void DesFill2bPattern(uint8_t deskeyList[MAX_KEYS_LIST_LEN][8], size_t *deskeyListLen, uint8_t aeskeyList[MAX_KEYS_LIST_LEN][16], size_t *aeskeyListLen, uint8_t k3kkeyList[MAX_KEYS_LIST_LEN][24], size_t *k3kkeyListLen, uint32_t *startPattern) {
|
||||
static void DesFill2bPattern(uint8_t deskeyList[MAX_KEYS_LIST_LEN][8], size_t *deskeyListLen, uint8_t aeskeyList[MAX_KEYS_LIST_LEN][16], size_t *aeskeyListLen, uint8_t k3kkeyList[MAX_KEYS_LIST_LEN][24], size_t *k3kkeyListLen, uint32_t *startPattern) {
|
||||
for (uint32_t pt = *startPattern; pt < 0x10000; pt++) {
|
||||
if (*deskeyListLen != MAX_KEYS_LIST_LEN) {
|
||||
deskeyList[*deskeyListLen][0] = (pt >> 8) & 0xff;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "lfdemod.h" // device/client demods of LF signals
|
||||
#include "ui.h" // for show graph controls
|
||||
#include "proxgui.h"
|
||||
#include "graph.h" // for graph data
|
||||
#include "cmddata.h" // for `lf search`
|
||||
#include "cmdlfawid.h" // for awid menu
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "util_posix.h"
|
||||
#include "protocols.h"
|
||||
#include "ui.h"
|
||||
#include "proxgui.h"
|
||||
#include "graph.h"
|
||||
#include "cmddata.h"
|
||||
#include "cmdlf.h"
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "cliparser.h"
|
||||
#include "commonutil.h"
|
||||
#include "ui.h" // PrintAndLog
|
||||
#include "proxgui.h"
|
||||
#include "lfdemod.h" // parityTest, bitbytes_to_byte
|
||||
#include "cmddata.h"
|
||||
#include "cmdlf.h" // lf_read
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "comms.h"
|
||||
#include "commonutil.h"
|
||||
#include "protocols.h"
|
||||
#include "proxgui.h"
|
||||
#include "graph.h"
|
||||
#include "cmddata.h"
|
||||
#include "lfdemod.h"
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "comms.h"
|
||||
#include "crc16.h"
|
||||
#include "ui.h"
|
||||
#include "proxgui.h"
|
||||
#include "graph.h"
|
||||
#include "cmdlfti.h"
|
||||
|
||||
|
||||
@@ -1151,7 +1151,7 @@ int loadFileDICTIONARY_safe(const char *preferredName, void **pdata, uint8_t key
|
||||
fclose(f);
|
||||
goto out;
|
||||
} else {
|
||||
memset(*pdata + (mem_size - block_size), 0, block_size);
|
||||
memset((uint8_t *)*pdata + (mem_size - block_size), 0, block_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1171,7 +1171,7 @@ int loadFileDICTIONARY_safe(const char *preferredName, void **pdata, uint8_t key
|
||||
|
||||
uint64_t key = strtoull(line, NULL, 16);
|
||||
|
||||
num_to_bytes(key, keylen >> 1, *pdata + (*keycnt * (keylen >> 1)));
|
||||
num_to_bytes(key, keylen >> 1, (uint8_t *)*pdata + (*keycnt * (keylen >> 1)));
|
||||
|
||||
(*keycnt)++;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "ui.h"
|
||||
#include "proxgui.h"
|
||||
#include "util.h" //param_get32ex
|
||||
#include "lfdemod.h"
|
||||
#include "cmddata.h" //for g_debugmode
|
||||
|
||||
@@ -61,7 +61,6 @@ void pushBit(BitstreamOut *stream, bool bit);
|
||||
int bitsLeft(BitstreamIn *stream);
|
||||
#ifndef ON_DEVICE
|
||||
int testCipherUtils(void);
|
||||
int testMAC(void);
|
||||
#endif
|
||||
void push6bits(BitstreamOut *stream, uint8_t bits);
|
||||
void EncryptDES(bool key[56], bool outBlk[64], bool inBlk[64], int verbose) ;
|
||||
|
||||
@@ -48,22 +48,12 @@ extern session_arg_t session;
|
||||
#endif
|
||||
#define MAX_PRINT_BUFFER 2048
|
||||
|
||||
void ShowGui(void);
|
||||
void HideGraphWindow(void);
|
||||
void ShowGraphWindow(void);
|
||||
void RepaintGraphWindow(void);
|
||||
void PrintAndLogOptions(const char *str[][2], size_t size, size_t space);
|
||||
void PrintAndLogEx(logLevel_t level, const char *fmt, ...);
|
||||
void SetFlushAfterWrite(bool value);
|
||||
void memcpy_filter_ansi(void *dest, const void *src, size_t n, bool filter);
|
||||
void memcpy_filter_emoji(void *dest, const void *src, size_t n, emojiMode_t mode);
|
||||
|
||||
extern double CursorScaleFactor;
|
||||
extern int PlotGridX, PlotGridY, PlotGridXdefault, PlotGridYdefault, GridOffset;
|
||||
extern uint32_t CursorCPos, CursorDPos;
|
||||
extern bool GridLocked;
|
||||
extern bool showDemod;
|
||||
|
||||
int searchHomeFilePath(char **foundpath, const char *filename, bool create_home);
|
||||
|
||||
extern pthread_mutex_t print_lock;
|
||||
|
||||
@@ -87,7 +87,6 @@ void wiegand_add_parity(uint8_t *target, uint8_t *source, uint8_t length);
|
||||
void wiegand_add_parity_swapped(uint8_t *target, uint8_t *source, uint8_t length);
|
||||
|
||||
//void xor(unsigned char *dst, unsigned char *src, size_t len);
|
||||
int32_t le24toh(uint8_t data[3]);
|
||||
|
||||
uint32_t PackBits(uint8_t start, uint8_t len, uint8_t *bits);
|
||||
uint64_t HornerScheme(uint64_t num, uint64_t divider, uint64_t factor);
|
||||
|
||||
Reference in New Issue
Block a user