mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
good const, bad const, fixing -Wincompatible-pointer-types-discards-qualifiers
This commit is contained in:
parent
e703dcb8ad
commit
7f76fea21a
45 changed files with 124 additions and 124 deletions
|
@ -236,7 +236,7 @@ int opterr = 1; /* if error message should be printed */
|
|||
int optind = 1; /* index into parent argv vector */
|
||||
int optopt = '?'; /* character checked for validity */
|
||||
int optreset; /* reset getopt */
|
||||
char *optarg; /* argument associated with option */
|
||||
const char *optarg; /* argument associated with option */
|
||||
#endif
|
||||
|
||||
#define PRINT_ERROR ((opterr) && (*options != ':'))
|
||||
|
@ -259,7 +259,7 @@ static int parse_long_options(char *const *, const char *,
|
|||
static int gcd(int, int);
|
||||
static void permute_args(int, int, int, char *const *);
|
||||
|
||||
static char *place = EMSG; /* option letter processing */
|
||||
static const char *place = EMSG; /* option letter processing */
|
||||
|
||||
/* XXX: set optreset to 1 rather than these two */
|
||||
static int nonopt_start = -1; /* first non option argument (for permute) */
|
||||
|
@ -377,7 +377,7 @@ permute_args(int panonopt_start, int panonopt_end, int opt_end,
|
|||
static int
|
||||
parse_long_options(char *const *nargv, const char *options,
|
||||
const struct option *long_options, int *idx, int short_too) {
|
||||
char *current_argv, *has_equal;
|
||||
const char *current_argv, *has_equal;
|
||||
size_t current_argv_len;
|
||||
int i, match;
|
||||
|
||||
|
@ -4325,9 +4325,9 @@ void arg_print_option(FILE *fp,
|
|||
static
|
||||
void arg_print_gnuswitch(FILE *fp, struct arg_hdr * *table) {
|
||||
int tabindex;
|
||||
char *format1 = " -%c";
|
||||
char *format2 = " [-%c";
|
||||
char *suffix = "";
|
||||
const char *format1 = " -%c";
|
||||
const char *format2 = " [-%c";
|
||||
const char *suffix = "";
|
||||
|
||||
/* print all mandatory switches that are without argument values */
|
||||
for (tabindex = 0;
|
||||
|
|
|
@ -14,12 +14,12 @@
|
|||
|
||||
void **argtable = NULL;
|
||||
size_t argtableLen = 0;
|
||||
char *programName = NULL;
|
||||
char *programHint = NULL;
|
||||
char *programHelp = NULL;
|
||||
const char *programName = NULL;
|
||||
const char *programHint = NULL;
|
||||
const char *programHelp = NULL;
|
||||
char buf[500] = {0};
|
||||
|
||||
int CLIParserInit(char *vprogramName, char *vprogramHint, char *vprogramHelp) {
|
||||
int CLIParserInit(const char *vprogramName, const char *vprogramHint, const char *vprogramHelp) {
|
||||
argtable = NULL;
|
||||
argtableLen = 0;
|
||||
programName = vprogramName;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#define CLIGetHexWithReturn(paramnum, data, datalen) if (CLIParamHexToBuf(arg_get_str(paramnum), data, sizeof(data), datalen)) {CLIParserFree();return 1;}
|
||||
#define CLIGetStrWithReturn(paramnum, data, datalen) if (CLIParamStrToBuf(arg_get_str(paramnum), data, sizeof(data), datalen)) {CLIParserFree();return 1;}
|
||||
|
||||
int CLIParserInit(char *vprogramName, char *vprogramHint, char *vprogramHelp);
|
||||
int CLIParserInit(const char *vprogramName, const char *vprogramHint, const char *vprogramHelp);
|
||||
int CLIParserParseString(const char *str, void *vargtable[], size_t vargtableLen, bool allowEmptyExec);
|
||||
int CLIParserParseStringEx(const char *str, void *vargtable[], size_t vargtableLen, bool allowEmptyExec, bool clueData);
|
||||
int CLIParserParseArg(int argc, char **argv, void *vargtable[], size_t vargtableLen, bool allowEmptyExec);
|
||||
|
|
|
@ -68,7 +68,7 @@ int getopt_long_only(int, char *const *, const char *,
|
|||
#define _GETOPT_DECLARED
|
||||
int getopt(int, char *const [], const char *);
|
||||
|
||||
extern char *optarg; /* getopt(3) external variables */
|
||||
extern const char *optarg; /* getopt(3) external variables */
|
||||
extern int optind, opterr, optopt;
|
||||
#endif
|
||||
#ifndef _OPTRESET_DECLARED
|
||||
|
|
|
@ -136,7 +136,7 @@ static const manufactureName manufactureMapping[] = {
|
|||
// get a product description based on the UID
|
||||
// uid[8] tag uid
|
||||
// returns description of the best match
|
||||
char *getTagInfo(uint8_t uid) {
|
||||
const char *getTagInfo(uint8_t uid) {
|
||||
|
||||
int i;
|
||||
int len = sizeof(manufactureMapping) / sizeof(manufactureName);
|
||||
|
@ -566,7 +566,7 @@ int CmdHF14AInfo(const char *Cmd) {
|
|||
pos++;
|
||||
}
|
||||
if (card.ats[0] > pos && card.ats[0] < card.ats_len - 2) {
|
||||
char *tip = "";
|
||||
const char *tip = "";
|
||||
if (card.ats[0] - pos >= 7) {
|
||||
if (memcmp(card.ats + pos, "\xC1\x05\x2F\x2F\x01\xBC\xD6", 7) == 0) {
|
||||
tip = "-> MIFARE Plus X 2K or 4K";
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
// structure and database for uid -> tagtype lookups
|
||||
typedef struct {
|
||||
uint8_t uid;
|
||||
char *desc;
|
||||
const char *desc;
|
||||
} manufactureName;
|
||||
|
||||
int CmdHF14A(const char *Cmd);
|
||||
|
@ -48,7 +48,7 @@ int CmdHF14ACmdRaw(const char *Cmd);
|
|||
int CmdHF14ACUIDs(const char *Cmd);
|
||||
int CmdHF14AAntiFuzz(const char *Cmd);
|
||||
|
||||
char *getTagInfo(uint8_t uid);
|
||||
const char *getTagInfo(uint8_t uid);
|
||||
int Hf14443_4aGetCardData(iso14a_card_select_t *card);
|
||||
int ExchangeAPDU14a(uint8_t *datain, int datainlen, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen);
|
||||
int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen);
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
typedef struct {
|
||||
uint64_t uid;
|
||||
int mask; // how many MSB bits used
|
||||
char *desc;
|
||||
const char *desc;
|
||||
} productName;
|
||||
|
||||
const productName uidmapping[] = {
|
||||
|
@ -235,7 +235,7 @@ int getUID(uint8_t *buf) {
|
|||
// get a product description based on the UID
|
||||
// uid[8] tag uid
|
||||
// returns description of the best match
|
||||
static char *getTagInfo_15(uint8_t *uid) {
|
||||
static const char *getTagInfo_15(uint8_t *uid) {
|
||||
uint64_t myuid, mask;
|
||||
int i = 0, best = -1;
|
||||
memcpy(&myuid, uid, sizeof(uint64_t));
|
||||
|
@ -259,7 +259,7 @@ static char *getTagInfo_15(uint8_t *uid) {
|
|||
}
|
||||
|
||||
// return a clear-text message to an errorcode
|
||||
static char *TagErrorStr(uint8_t error) {
|
||||
static const char *TagErrorStr(uint8_t error) {
|
||||
switch (error) {
|
||||
case 0x01:
|
||||
return "The command is not supported";
|
||||
|
@ -350,7 +350,7 @@ int usage_15_dump(void) {
|
|||
return 0;
|
||||
}
|
||||
int usage_15_restore(void) {
|
||||
char *options[][2] = {
|
||||
const char *options[][2] = {
|
||||
{"h", "this help"},
|
||||
{"-2", "use slower '1 out of 256' mode"},
|
||||
{"-o", "set OPTION Flag (needed for TI)"},
|
||||
|
@ -364,7 +364,7 @@ int usage_15_restore(void) {
|
|||
return 0;
|
||||
}
|
||||
int usage_15_raw(void) {
|
||||
char *options[][2] = {
|
||||
const char *options[][2] = {
|
||||
{"-r", "do not read response" },
|
||||
{"-2", "use slower '1 out of 256' mode" },
|
||||
{"-c", "calculate and append CRC" },
|
||||
|
|
|
@ -621,7 +621,7 @@ void CheckSlash(char *fileName) {
|
|||
strcat(fileName, "/");
|
||||
}
|
||||
|
||||
int GetExistsFileNameJson(char *prefixDir, char *reqestedFileName, char *fileName) {
|
||||
int GetExistsFileNameJson(const char *prefixDir, const char *reqestedFileName, char *fileName) {
|
||||
fileName[0] = 0x00;
|
||||
strcpy(fileName, get_my_executable_directory());
|
||||
CheckSlash(fileName);
|
||||
|
|
|
@ -253,7 +253,7 @@ char *GetVersionStr(uint8_t major, uint8_t minor) {
|
|||
void GetKeySettings(uint8_t *aid) {
|
||||
|
||||
char messStr[512] = {0x00};
|
||||
char *str = messStr;
|
||||
const char *str = messStr;
|
||||
uint8_t isOK = 0;
|
||||
uint32_t options;
|
||||
UsbCommand c = {CMD_MIFARE_DESFIRE};
|
||||
|
|
|
@ -109,7 +109,7 @@ static void print_progress_header(void) {
|
|||
}
|
||||
|
||||
|
||||
void hardnested_print_progress(uint32_t nonces, char *activity, float brute_force, uint64_t min_diff_print_time) {
|
||||
void hardnested_print_progress(uint32_t nonces, const char *activity, float brute_force, uint64_t min_diff_print_time) {
|
||||
static uint64_t last_print_time = 0;
|
||||
if (msclock() - last_print_time > min_diff_print_time) {
|
||||
last_print_time = msclock();
|
||||
|
|
|
@ -42,7 +42,7 @@ typedef struct noncelist {
|
|||
} noncelist_t;
|
||||
|
||||
int mfnestedhard(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *trgkey, bool nonce_file_read, bool nonce_file_write, bool slow, int tests, uint64_t *foundkey, char *filename);
|
||||
void hardnested_print_progress(uint32_t nonces, char *activity, float brute_force, uint64_t min_diff_print_time);
|
||||
void hardnested_print_progress(uint32_t nonces, const char *activity, float brute_force, uint64_t min_diff_print_time);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ int CmdTIDemod(const char *Cmd) {
|
|||
|
||||
//crc = crc16_ccitt(message, sizeof(message);
|
||||
|
||||
char *crcStr = (crc == (shift2 & 0xFFFF)) ? _GREEN_("Passed") : _RED_("Failed");
|
||||
const char *crcStr = (crc == (shift2 & 0xFFFF)) ? _GREEN_("Passed") : _RED_("Failed");
|
||||
|
||||
PrintAndLogEx(INFO, "Tag data = %08X%08X [Crc %04X %s]", shift1, shift0, crc, crcStr);
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ void dumpCommandsRecursive(const command_t cmds[], int markdown) {
|
|||
}
|
||||
|
||||
while (cmds[i].Name) {
|
||||
char *cmd_offline = "N";
|
||||
const char *cmd_offline = "N";
|
||||
if (cmds[i].Help[0] == '{' && ++i) continue;
|
||||
|
||||
if (cmds[i].Offline)
|
||||
|
|
|
@ -56,7 +56,7 @@ int str_ends_with(const char *str, const char *suffix) {
|
|||
/**
|
||||
* Utility to check the ending of a string (used to check file suffix)
|
||||
*/
|
||||
bool endsWith(char *base, char *str) {
|
||||
bool endsWith(const char *base, const char *str) {
|
||||
int blen = strlen(base);
|
||||
int slen = strlen(str);
|
||||
return (blen >= slen) && (0 == strcmp(base + blen - slen, str));
|
||||
|
@ -125,7 +125,7 @@ int CmdScriptRun(const char *Cmd) {
|
|||
int arg_len = 0;
|
||||
sscanf(Cmd, "%127s%n %255[^\n\r]%n", script_name, &name_len, arguments, &arg_len);
|
||||
|
||||
char *suffix = "";
|
||||
const char *suffix = "";
|
||||
if (!endsWith(script_name, ".lua")) {
|
||||
suffix = ".lua";
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
|
|||
}
|
||||
|
||||
// Draw the CRC column
|
||||
char *crc = (crcStatus == 0 ? "!crc" : (crcStatus == 1 ? " ok " : " "));
|
||||
const char *crc = (crcStatus == 0 ? "!crc" : (crcStatus == 1 ? " ok " : " "));
|
||||
|
||||
EndOfTransmissionTimestamp = timestamp + duration;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ enum asn1_tag_t {
|
|||
|
||||
struct asn1_tag {
|
||||
tlv_tag_t tag;
|
||||
char *name;
|
||||
const char *name;
|
||||
enum asn1_tag_t type;
|
||||
const void *data;
|
||||
};
|
||||
|
|
|
@ -71,7 +71,7 @@ static bool print_cb(void *data, const struct tlv *tlv, int level, bool is_leaf)
|
|||
return true;
|
||||
}
|
||||
|
||||
int asn1_print(uint8_t *asn1buf, size_t asn1buflen, char *indent) {
|
||||
int asn1_print(uint8_t *asn1buf, size_t asn1buflen, const char *indent) {
|
||||
|
||||
struct tlvdb *t = tlvdb_parse_multi(asn1buf, asn1buflen);
|
||||
if (t) {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
int asn1_print(uint8_t *asn1buf, size_t asn1buflen, char *indent);
|
||||
int asn1_print(uint8_t *asn1buf, size_t asn1buflen, const char *indent);
|
||||
int ecdsa_asn1_get_signature(uint8_t *signature, size_t signaturelen, uint8_t *rval, uint8_t *sval);
|
||||
|
||||
#endif /* asn1utils.h */
|
||||
|
|
|
@ -121,7 +121,7 @@ int sha512hash(uint8_t *input, int length, uint8_t *hash) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int ecdsa_init_str(mbedtls_ecdsa_context *ctx, char *key_d, char *key_x, char *key_y) {
|
||||
int ecdsa_init_str(mbedtls_ecdsa_context *ctx, const char *key_d, const char *key_x, const char *key_y) {
|
||||
if (!ctx)
|
||||
return 1;
|
||||
|
||||
|
@ -279,7 +279,7 @@ exit:
|
|||
return res;
|
||||
}
|
||||
|
||||
int ecdsa_signature_create_test(char *key_d, char *key_x, char *key_y, char *random, uint8_t *input, int length, uint8_t *signature, size_t *signaturelen) {
|
||||
int ecdsa_signature_create_test(const char *key_d, const char *key_x, const char *key_y, const char *random, uint8_t *input, int length, uint8_t *signature, size_t *signaturelen) {
|
||||
int res;
|
||||
*signaturelen = 0;
|
||||
|
||||
|
@ -299,7 +299,7 @@ int ecdsa_signature_create_test(char *key_d, char *key_x, char *key_y, char *ran
|
|||
return res;
|
||||
}
|
||||
|
||||
int ecdsa_signature_verify_keystr(char *key_x, char *key_y, uint8_t *input, int length, uint8_t *signature, size_t signaturelen) {
|
||||
int ecdsa_signature_verify_keystr(const char *key_x, const char *key_y, uint8_t *input, int length, uint8_t *signature, size_t signaturelen) {
|
||||
int res;
|
||||
uint8_t shahash[32] = {0};
|
||||
res = sha256hash(input, length, shahash);
|
||||
|
|
|
@ -277,7 +277,7 @@ int CodeCmp(const char *code1, const char *code2) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
const APDUCode *const GetAPDUCode(uint8_t sw1, uint8_t sw2) {
|
||||
const APDUCode * GetAPDUCode(uint8_t sw1, uint8_t sw2) {
|
||||
char buf[6] = {0};
|
||||
int res;
|
||||
int mineq = APDUCodeTableLen;
|
||||
|
|
|
@ -28,7 +28,7 @@ typedef struct {
|
|||
const char *Description;
|
||||
} APDUCode;
|
||||
|
||||
const APDUCode *const GetAPDUCode(uint8_t sw1, uint8_t sw2);
|
||||
const APDUCode *GetAPDUCode(uint8_t sw1, uint8_t sw2);
|
||||
const char *GetAPDUCodeDescription(uint8_t sw1, uint8_t sw2);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -652,7 +652,7 @@ void InitTransactionParameters(struct tlvdb *tlvRoot, bool paramLoadJSON, enum T
|
|||
}
|
||||
|
||||
//9F66:(Terminal Transaction Qualifiers (TTQ)) len:4
|
||||
char *qVSDC = "\x26\x00\x00\x00";
|
||||
const char *qVSDC = "\x26\x00\x00\x00";
|
||||
if (GenACGPO) {
|
||||
qVSDC = "\x26\x80\x00\x00";
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ enum emv_tag_t {
|
|||
|
||||
struct emv_tag {
|
||||
tlv_tag_t tag;
|
||||
char *name;
|
||||
const char *name;
|
||||
enum emv_tag_t type;
|
||||
const void *data;
|
||||
};
|
||||
|
@ -819,8 +819,8 @@ bool emv_tag_dump(const struct tlv *tlv, FILE *f, int level) {
|
|||
return true;
|
||||
}
|
||||
|
||||
char *emv_get_tag_name(const struct tlv *tlv) {
|
||||
static char *defstr = "";
|
||||
const char *emv_get_tag_name(const struct tlv *tlv) {
|
||||
static const char *defstr = "";
|
||||
|
||||
if (!tlv)
|
||||
return defstr;
|
||||
|
|
|
@ -35,6 +35,6 @@
|
|||
# define EMVCID_REASON_MASK 0x07
|
||||
|
||||
bool emv_tag_dump(const struct tlv *tlv, FILE *f, int level);
|
||||
char *emv_get_tag_name(const struct tlv *tlv);
|
||||
const char *emv_get_tag_name(const struct tlv *tlv);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -20,7 +20,7 @@ static const char *PSElist [] = {
|
|||
};
|
||||
//static const size_t PSElistLen = sizeof(PSElist)/sizeof(char*);
|
||||
|
||||
char *TransactionTypeStr[] = {
|
||||
const char *TransactionTypeStr[] = {
|
||||
"MSD",
|
||||
"VSDC",
|
||||
"qVCDCMCHIP",
|
||||
|
@ -434,7 +434,7 @@ int EMVSearchPSE(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldO
|
|||
int res;
|
||||
bool fileFound = false;
|
||||
|
||||
char *PSE_or_PPSE = PSENum == 1 ? "PSE" : "PPSE";
|
||||
const char *PSE_or_PPSE = PSENum == 1 ? "PSE" : "PPSE";
|
||||
|
||||
// select PPSE
|
||||
res = EMVSelectPSE(channel, ActivateField, true, PSENum, data, sizeof(data), &datalen, &sw);
|
||||
|
|
|
@ -43,7 +43,7 @@ enum TransactionType {
|
|||
TT_QVSDCMCHIP,
|
||||
TT_CDA,
|
||||
};
|
||||
extern char *TransactionTypeStr[];
|
||||
extern const char *TransactionTypeStr[];
|
||||
|
||||
typedef struct {
|
||||
uint8_t CLA;
|
||||
|
|
|
@ -60,7 +60,7 @@ static const ApplicationDataElm ApplicationData[] = {
|
|||
};
|
||||
int ApplicationDataLen = sizeof(ApplicationData) / sizeof(ApplicationDataElm);
|
||||
|
||||
char *GetApplicationDataName(tlv_tag_t tag) {
|
||||
const char *GetApplicationDataName(tlv_tag_t tag) {
|
||||
for (int i = 0; i < ApplicationDataLen; i++)
|
||||
if (ApplicationData[i].Tag == tag)
|
||||
return ApplicationData[i].Name;
|
||||
|
@ -68,7 +68,7 @@ char *GetApplicationDataName(tlv_tag_t tag) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int JsonSaveJsonObject(json_t *root, char *path, json_t *value) {
|
||||
int JsonSaveJsonObject(json_t *root, const char *path, json_t *value) {
|
||||
json_error_t error;
|
||||
|
||||
if (strlen(path) < 1)
|
||||
|
@ -86,15 +86,15 @@ int JsonSaveJsonObject(json_t *root, char *path, json_t *value) {
|
|||
}
|
||||
}
|
||||
|
||||
int JsonSaveInt(json_t *root, char *path, int value) {
|
||||
int JsonSaveInt(json_t *root, const char *path, int value) {
|
||||
return JsonSaveJsonObject(root, path, json_integer(value));
|
||||
}
|
||||
|
||||
int JsonSaveStr(json_t *root, char *path, char *value) {
|
||||
int JsonSaveStr(json_t *root, const char *path, const char *value) {
|
||||
return JsonSaveJsonObject(root, path, json_string(value));
|
||||
};
|
||||
|
||||
int JsonSaveBufAsHexCompact(json_t *elm, char *path, uint8_t *data, size_t datalen) {
|
||||
int JsonSaveBufAsHexCompact(json_t *elm, const char *path, uint8_t *data, size_t datalen) {
|
||||
char *msg = sprint_hex_inrow(data, datalen);
|
||||
if (msg && strlen(msg) && msg[strlen(msg) - 1] == ' ')
|
||||
msg[strlen(msg) - 1] = '\0';
|
||||
|
@ -102,7 +102,7 @@ int JsonSaveBufAsHexCompact(json_t *elm, char *path, uint8_t *data, size_t datal
|
|||
return JsonSaveStr(elm, path, msg);
|
||||
}
|
||||
|
||||
int JsonSaveBufAsHex(json_t *elm, char *path, uint8_t *data, size_t datalen) {
|
||||
int JsonSaveBufAsHex(json_t *elm, const char *path, uint8_t *data, size_t datalen) {
|
||||
char *msg = sprint_hex(data, datalen);
|
||||
if (msg && strlen(msg) && msg[strlen(msg) - 1] == ' ')
|
||||
msg[strlen(msg) - 1] = '\0';
|
||||
|
@ -110,7 +110,7 @@ int JsonSaveBufAsHex(json_t *elm, char *path, uint8_t *data, size_t datalen) {
|
|||
return JsonSaveStr(elm, path, msg);
|
||||
}
|
||||
|
||||
int JsonSaveHex(json_t *elm, char *path, uint64_t data, int datalen) {
|
||||
int JsonSaveHex(json_t *elm, const char *path, uint64_t data, int datalen) {
|
||||
uint8_t bdata[8] = {0};
|
||||
int len = 0;
|
||||
if (!datalen) {
|
||||
|
@ -130,7 +130,7 @@ int JsonSaveHex(json_t *elm, char *path, uint64_t data, int datalen) {
|
|||
return JsonSaveBufAsHex(elm, path, bdata, len);
|
||||
}
|
||||
|
||||
int JsonSaveTLVValue(json_t *root, char *path, struct tlvdb *tlvdbelm) {
|
||||
int JsonSaveTLVValue(json_t *root, const char *path, struct tlvdb *tlvdbelm) {
|
||||
const struct tlv *tlvelm = tlvdb_get_tlv(tlvdbelm);
|
||||
if (tlvelm)
|
||||
return JsonSaveBufAsHex(root, path, (uint8_t *)tlvelm->value, tlvelm->len);
|
||||
|
@ -138,7 +138,7 @@ int JsonSaveTLVValue(json_t *root, char *path, struct tlvdb *tlvdbelm) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int JsonSaveTLVElm(json_t *elm, char *path, struct tlv *tlvelm, bool saveName, bool saveValue, bool saveAppDataLink) {
|
||||
int JsonSaveTLVElm(json_t *elm, const char *path, struct tlv *tlvelm, bool saveName, bool saveValue, bool saveAppDataLink) {
|
||||
json_error_t error;
|
||||
|
||||
if (strlen(path) < 1 || !tlvelm)
|
||||
|
@ -164,11 +164,11 @@ int JsonSaveTLVElm(json_t *elm, char *path, struct tlv *tlvelm, bool saveName, b
|
|||
}
|
||||
|
||||
if (saveAppDataLink) {
|
||||
char *AppDataName = GetApplicationDataName(tlvelm->tag);
|
||||
const char *AppDataName = GetApplicationDataName(tlvelm->tag);
|
||||
if (AppDataName)
|
||||
JsonSaveStr(obj, "appdata", AppDataName);
|
||||
} else {
|
||||
char *name = emv_get_tag_name(tlvelm);
|
||||
const char *name = emv_get_tag_name(tlvelm);
|
||||
if (saveName && name && strlen(name) > 0 && strncmp(name, "Unknown", 7))
|
||||
JsonSaveStr(obj, "name", emv_get_tag_name(tlvelm));
|
||||
JsonSaveHex(obj, "tag", tlvelm->tag, 0);
|
||||
|
@ -182,15 +182,15 @@ int JsonSaveTLVElm(json_t *elm, char *path, struct tlv *tlvelm, bool saveName, b
|
|||
return 0;
|
||||
}
|
||||
|
||||
int JsonSaveTLVTreeElm(json_t *elm, char *path, struct tlvdb *tlvdbelm, bool saveName, bool saveValue, bool saveAppDataLink) {
|
||||
int JsonSaveTLVTreeElm(json_t *elm, const char *path, struct tlvdb *tlvdbelm, bool saveName, bool saveValue, bool saveAppDataLink) {
|
||||
return JsonSaveTLVElm(elm, path, (struct tlv *)tlvdb_get_tlv(tlvdbelm), saveName, saveValue, saveAppDataLink);
|
||||
}
|
||||
|
||||
int JsonSaveTLVTree(json_t *root, json_t *elm, char *path, struct tlvdb *tlvdbelm) {
|
||||
int JsonSaveTLVTree(json_t *root, json_t *elm, const char *path, struct tlvdb *tlvdbelm) {
|
||||
struct tlvdb *tlvp = tlvdbelm;
|
||||
while (tlvp) {
|
||||
const struct tlv *tlvpelm = tlvdb_get_tlv(tlvp);
|
||||
char *AppDataName = NULL;
|
||||
const char *AppDataName = NULL;
|
||||
if (tlvpelm)
|
||||
AppDataName = GetApplicationDataName(tlvpelm->tag);
|
||||
|
||||
|
@ -265,7 +265,7 @@ bool HexToBuffer(const char *errormsg, const char *hexvalue, uint8_t *buffer, si
|
|||
return true;
|
||||
}
|
||||
|
||||
int JsonLoadStr(json_t *root, char *path, char *value) {
|
||||
int JsonLoadStr(json_t *root, const char *path, char *value) {
|
||||
if (!value)
|
||||
return 1;
|
||||
|
||||
|
@ -282,7 +282,7 @@ int JsonLoadStr(json_t *root, char *path, char *value) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int JsonLoadBufAsHex(json_t *elm, char *path, uint8_t *data, size_t maxbufferlen, size_t *datalen) {
|
||||
int JsonLoadBufAsHex(json_t *elm, const char *path, uint8_t *data, size_t maxbufferlen, size_t *datalen) {
|
||||
if (datalen)
|
||||
*datalen = 0;
|
||||
|
||||
|
|
|
@ -15,26 +15,26 @@
|
|||
|
||||
typedef struct {
|
||||
tlv_tag_t Tag;
|
||||
char *Name;
|
||||
const char *Name;
|
||||
} ApplicationDataElm;
|
||||
|
||||
char *GetApplicationDataName(tlv_tag_t tag);
|
||||
const char *GetApplicationDataName(tlv_tag_t tag);
|
||||
|
||||
int JsonSaveJsonObject(json_t *root, char *path, json_t *value);
|
||||
int JsonSaveStr(json_t *root, char *path, char *value);
|
||||
int JsonSaveInt(json_t *root, char *path, int value);
|
||||
int JsonSaveBufAsHexCompact(json_t *elm, char *path, uint8_t *data, size_t datalen);
|
||||
int JsonSaveBufAsHex(json_t *elm, char *path, uint8_t *data, size_t datalen);
|
||||
int JsonSaveHex(json_t *elm, char *path, uint64_t data, int datalen);
|
||||
int JsonSaveJsonObject(json_t *root, const char *path, json_t *value);
|
||||
int JsonSaveStr(json_t *root, const char *path, const char *value);
|
||||
int JsonSaveInt(json_t *root, const char *path, int value);
|
||||
int JsonSaveBufAsHexCompact(json_t *elm, const char *path, uint8_t *data, size_t datalen);
|
||||
int JsonSaveBufAsHex(json_t *elm, const char *path, uint8_t *data, size_t datalen);
|
||||
int JsonSaveHex(json_t *elm, const char *path, uint64_t data, int datalen);
|
||||
|
||||
int JsonSaveTLVValue(json_t *root, char *path, struct tlvdb *tlvdbelm);
|
||||
int JsonSaveTLVElm(json_t *elm, char *path, struct tlv *tlvelm, bool saveName, bool saveValue, bool saveAppDataLink);
|
||||
int JsonSaveTLVTreeElm(json_t *elm, char *path, struct tlvdb *tlvdbelm, bool saveName, bool saveValue, bool saveAppDataLink);
|
||||
int JsonSaveTLVValue(json_t *root, const char *path, struct tlvdb *tlvdbelm);
|
||||
int JsonSaveTLVElm(json_t *elm, const char *path, struct tlv *tlvelm, bool saveName, bool saveValue, bool saveAppDataLink);
|
||||
int JsonSaveTLVTreeElm(json_t *elm, const char *path, struct tlvdb *tlvdbelm, bool saveName, bool saveValue, bool saveAppDataLink);
|
||||
|
||||
int JsonSaveTLVTree(json_t *root, json_t *elm, char *path, struct tlvdb *tlvdbelm);
|
||||
int JsonSaveTLVTree(json_t *root, json_t *elm, const char *path, struct tlvdb *tlvdbelm);
|
||||
|
||||
int JsonLoadStr(json_t *root, char *path, char *value);
|
||||
int JsonLoadBufAsHex(json_t *elm, char *path, uint8_t *data, size_t maxbufferlen, size_t *datalen);
|
||||
int JsonLoadStr(json_t *root, const char *path, char *value);
|
||||
int JsonLoadBufAsHex(json_t *elm, const char *path, uint8_t *data, size_t maxbufferlen, size_t *datalen);
|
||||
|
||||
bool ParamLoadFromJson(struct tlvdb *tlv);
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ static CborError dumprecursive(uint8_t cmdCode, bool isResponse, CborValue *it,
|
|||
if (cmdCode > 0 && nestingLevel == 1 && isMapType && !(elmCount % 2)) {
|
||||
int64_t val;
|
||||
cbor_value_get_int64(it, &val);
|
||||
char *desc = fido2GetCmdMemberDescription(cmdCode, isResponse, val);
|
||||
const char *desc = fido2GetCmdMemberDescription(cmdCode, isResponse, val);
|
||||
if (desc)
|
||||
printf(" (%s)", desc);
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ CborError CborGetStringValueBuf(CborValue *elm) {
|
|||
return CborGetStringValue(elm, stringBuf, sizeof(stringBuf), NULL);
|
||||
};
|
||||
|
||||
int CBOREncodeElm(json_t *root, char *rootElmId, CborEncoder *encoder) {
|
||||
int CBOREncodeElm(json_t *root, const char *rootElmId, CborEncoder *encoder) {
|
||||
json_t *elm = NULL;
|
||||
if (rootElmId && strlen(rootElmId) && rootElmId[0] == '$')
|
||||
elm = json_path_get(root, rootElmId);
|
||||
|
|
|
@ -32,7 +32,7 @@ CborError CborGetArrayStringValue(CborValue *elm, char *data, size_t maxdatalen,
|
|||
CborError CborGetStringValue(CborValue *elm, char *data, size_t maxdatalen, size_t *datalen);
|
||||
CborError CborGetStringValueBuf(CborValue *elm);
|
||||
|
||||
int CBOREncodeElm(json_t *root, char *rootElmId, CborEncoder *encoder);
|
||||
int CBOREncodeElm(json_t *root, const char *rootElmId, CborEncoder *encoder);
|
||||
CborError CBOREncodeClientDataHash(json_t *root, CborEncoder *encoder);
|
||||
|
||||
#endif /* __CBORTOOLS_H__ */
|
||||
|
|
|
@ -19,15 +19,15 @@ static const char COSEEmptyStr[] = "";
|
|||
|
||||
typedef struct {
|
||||
int Value;
|
||||
char *Name;
|
||||
char *Description;
|
||||
const char *Name;
|
||||
const char *Description;
|
||||
} COSEValueNameDesc_t;
|
||||
|
||||
typedef struct {
|
||||
int Value;
|
||||
char *Type;
|
||||
char *Name;
|
||||
char *Description;
|
||||
const char *Type;
|
||||
const char *Name;
|
||||
const char *Description;
|
||||
} COSEValueTypeNameDesc_t;
|
||||
|
||||
// kty - Key Type Values
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
|
||||
typedef struct {
|
||||
uint8_t ErrorCode;
|
||||
char *ShortDescription;
|
||||
char *Description;
|
||||
const char *ShortDescription;
|
||||
const char *Description;
|
||||
} fido2Error_t;
|
||||
|
||||
fido2Error_t fido2Errors[] = {
|
||||
|
@ -84,7 +84,7 @@ typedef struct {
|
|||
fido2Commands Command;
|
||||
fido2PacketType PckType;
|
||||
int MemberNumber;
|
||||
char *Description;
|
||||
const char *Description;
|
||||
} fido2Desc_t;
|
||||
|
||||
fido2Desc_t fido2CmdGetInfoRespDesc[] = {
|
||||
|
@ -149,7 +149,7 @@ fido2Desc_t fido2CmdGetInfoRespDesc[] = {
|
|||
{fido2COSEKey, ptResponse, -4, "d - private key"},
|
||||
};
|
||||
|
||||
char *fido2GetCmdErrorDescription(uint8_t errorCode) {
|
||||
const char *fido2GetCmdErrorDescription(uint8_t errorCode) {
|
||||
for (int i = 0; i < sizeof(fido2Errors) / sizeof(fido2Error_t); i++)
|
||||
if (fido2Errors[i].ErrorCode == errorCode)
|
||||
return fido2Errors[i].Description;
|
||||
|
@ -157,7 +157,7 @@ char *fido2GetCmdErrorDescription(uint8_t errorCode) {
|
|||
return fido2Errors[0].Description;
|
||||
}
|
||||
|
||||
char *fido2GetCmdMemberDescription(uint8_t cmdCode, bool isResponse, int memberNum) {
|
||||
const char *fido2GetCmdMemberDescription(uint8_t cmdCode, bool isResponse, int memberNum) {
|
||||
for (int i = 0; i < sizeof(fido2CmdGetInfoRespDesc) / sizeof(fido2Desc_t); i++)
|
||||
if (fido2CmdGetInfoRespDesc[i].Command == cmdCode &&
|
||||
fido2CmdGetInfoRespDesc[i].PckType == (isResponse ? ptResponse : ptQuery) &&
|
||||
|
|
|
@ -45,8 +45,8 @@ int FIDO2GetAssertion(uint8_t *params, uint8_t paramslen, uint8_t *Result, size_
|
|||
|
||||
int FIDOCheckDERAndGetKey(uint8_t *der, size_t derLen, bool verbose, uint8_t *publicKey, size_t publicKeyMaxLen);
|
||||
|
||||
char *fido2GetCmdMemberDescription(uint8_t cmdCode, bool isResponse, int memberNum);
|
||||
char *fido2GetCmdErrorDescription(uint8_t errorCode);
|
||||
const char *fido2GetCmdMemberDescription(uint8_t cmdCode, bool isResponse, int memberNum);
|
||||
const char *fido2GetCmdErrorDescription(uint8_t errorCode);
|
||||
|
||||
bool CheckrpIdHash(json_t *json, uint8_t *hash);
|
||||
int FIDO2CreateMakeCredentionalReq(json_t *root, uint8_t *data, size_t maxdatalen, size_t *datalen);
|
||||
|
|
|
@ -123,7 +123,7 @@ typedef union {
|
|||
#endif
|
||||
|
||||
// typedefs and declaration of functions:
|
||||
typedef const uint64_t crack_states_bitsliced_t(uint32_t, uint8_t *, statelist_t *, uint32_t *, uint64_t *, uint32_t, uint8_t *, noncelist_t *);
|
||||
typedef uint64_t crack_states_bitsliced_t(uint32_t, uint8_t *, statelist_t *, uint32_t *, uint64_t *, uint32_t, uint8_t *, noncelist_t *);
|
||||
crack_states_bitsliced_t crack_states_bitsliced_AVX512;
|
||||
crack_states_bitsliced_t crack_states_bitsliced_AVX2;
|
||||
crack_states_bitsliced_t crack_states_bitsliced_AVX;
|
||||
|
@ -205,7 +205,7 @@ void BITSLICE_TEST_NONCES(uint32_t nonces_to_bruteforce, uint32_t *bf_test_nonce
|
|||
}
|
||||
|
||||
|
||||
const uint64_t CRACK_STATES_BITSLICED(uint32_t cuid, uint8_t *best_first_bytes, statelist_t *p, uint32_t *keys_found, uint64_t *num_keys_tested, uint32_t nonces_to_bruteforce, uint8_t *bf_test_nonce_2nd_byte, noncelist_t *nonces) {
|
||||
uint64_t CRACK_STATES_BITSLICED(uint32_t cuid, uint8_t *best_first_bytes, statelist_t *p, uint32_t *keys_found, uint64_t *num_keys_tested, uint32_t nonces_to_bruteforce, uint8_t *bf_test_nonce_2nd_byte, noncelist_t *nonces) {
|
||||
|
||||
// Unlike aczid's implementation this doesn't roll back at all when performing bitsliced bruteforce.
|
||||
// We know that the best first byte is already shifted in. Testing with the remaining three bytes of
|
||||
|
@ -586,7 +586,7 @@ SIMDExecInstr GetSIMDInstrAuto() {
|
|||
}
|
||||
|
||||
// determine the available instruction set at runtime and call the correct function
|
||||
const uint64_t crack_states_bitsliced_dispatch(uint32_t cuid, uint8_t *best_first_bytes, statelist_t *p, uint32_t *keys_found, uint64_t *num_keys_tested, uint32_t nonces_to_bruteforce, uint8_t *bf_test_nonce_2nd_byte, noncelist_t *nonces) {
|
||||
uint64_t crack_states_bitsliced_dispatch(uint32_t cuid, uint8_t *best_first_bytes, statelist_t *p, uint32_t *keys_found, uint64_t *num_keys_tested, uint32_t nonces_to_bruteforce, uint8_t *bf_test_nonce_2nd_byte, noncelist_t *nonces) {
|
||||
switch (GetSIMDInstrAuto()) {
|
||||
#if defined (__i386__) || defined (__x86_64__)
|
||||
#if !defined(__APPLE__) || (defined(__APPLE__) && (__clang_major__ > 8 || __clang_major__ == 8 && __clang_minor__ >= 1))
|
||||
|
@ -651,7 +651,7 @@ void bitslice_test_nonces_dispatch(uint32_t nonces_to_bruteforce, uint32_t *bf_t
|
|||
}
|
||||
|
||||
// Entries to dispatched function calls
|
||||
const uint64_t crack_states_bitsliced(uint32_t cuid, uint8_t *best_first_bytes, statelist_t *p, uint32_t *keys_found, uint64_t *num_keys_tested, uint32_t nonces_to_bruteforce, uint8_t *bf_test_nonce_2nd_byte, noncelist_t *nonces) {
|
||||
uint64_t crack_states_bitsliced(uint32_t cuid, uint8_t *best_first_bytes, statelist_t *p, uint32_t *keys_found, uint64_t *num_keys_tested, uint32_t nonces_to_bruteforce, uint8_t *bf_test_nonce_2nd_byte, noncelist_t *nonces) {
|
||||
return (*crack_states_bitsliced_function_p)(cuid, best_first_bytes, p, keys_found, num_keys_tested, nonces_to_bruteforce, bf_test_nonce_2nd_byte, nonces);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ typedef enum {
|
|||
void SetSIMDInstr(SIMDExecInstr instr);
|
||||
SIMDExecInstr GetSIMDInstrAuto(void);
|
||||
|
||||
const uint64_t crack_states_bitsliced(uint32_t cuid, uint8_t *best_first_bytes, statelist_t *p, uint32_t *keys_found, uint64_t *num_keys_tested, uint32_t nonces_to_bruteforce, uint8_t *bf_test_nonce_2nd_byte, noncelist_t *nonces);
|
||||
uint64_t crack_states_bitsliced(uint32_t cuid, uint8_t *best_first_bytes, statelist_t *p, uint32_t *keys_found, uint64_t *num_keys_tested, uint32_t nonces_to_bruteforce, uint8_t *bf_test_nonce_2nd_byte, noncelist_t *nonces);
|
||||
void bitslice_test_nonces(uint32_t nonces_to_bruteforce, uint32_t *bf_test_nonce, uint8_t *bf_test_nonce_par);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -142,7 +142,7 @@ void reverse_arraycopy(uint8_t *arr, uint8_t *dest, size_t len) {
|
|||
}
|
||||
}
|
||||
|
||||
void printarr(char *name, uint8_t *arr, int len) {
|
||||
void printarr(const char *name, uint8_t *arr, int len) {
|
||||
int cx, i;
|
||||
size_t outsize = 40 + strlen(name) + len * 5;
|
||||
char *output = calloc(outsize, sizeof(char));
|
||||
|
@ -155,7 +155,7 @@ void printarr(char *name, uint8_t *arr, int len) {
|
|||
free(output);
|
||||
}
|
||||
|
||||
void printvar(char *name, uint8_t *arr, int len) {
|
||||
void printvar(const char *name, uint8_t *arr, int len) {
|
||||
int cx, i;
|
||||
size_t outsize = 40 + strlen(name) + len * 2;
|
||||
char *output = calloc(outsize, sizeof(char));
|
||||
|
@ -168,7 +168,7 @@ void printvar(char *name, uint8_t *arr, int len) {
|
|||
free(output);
|
||||
}
|
||||
|
||||
void printarr_human_readable(char *title, uint8_t *arr, int len) {
|
||||
void printarr_human_readable(const char *title, uint8_t *arr, int len) {
|
||||
int cx, i;
|
||||
size_t outsize = 100 + strlen(title) + len * 4;
|
||||
char *output = calloc(outsize, sizeof(char));
|
||||
|
|
|
@ -69,7 +69,7 @@ uint64_t x_bytes_to_num(uint8_t *src, size_t len);
|
|||
uint8_t reversebytes(uint8_t b);
|
||||
void reverse_arraybytes(uint8_t *arr, size_t len);
|
||||
void reverse_arraycopy(uint8_t *arr, uint8_t *dest, size_t len);
|
||||
void printarr(char *name, uint8_t *arr, int len);
|
||||
void printvar(char *name, uint8_t *arr, int len);
|
||||
void printarr_human_readable(char *title, uint8_t *arr, int len);
|
||||
void printarr(const char *name, uint8_t *arr, int len);
|
||||
void printvar(const char *name, uint8_t *arr, int len);
|
||||
void printarr_human_readable(const char *title, uint8_t *arr, int len);
|
||||
#endif // CIPHERUTILS_H
|
||||
|
|
|
@ -221,7 +221,7 @@ void printbegin() {
|
|||
PrintAndLogDevice(NORMAL, " | x| y|z0|z1|z2|z3|z4|z5|z6|z7|");
|
||||
}
|
||||
|
||||
void printState(char *desc, uint64_t c) {
|
||||
void printState(const char *desc, uint64_t c) {
|
||||
if (debug_print < 2)
|
||||
return;
|
||||
|
||||
|
@ -569,7 +569,7 @@ int testKeyDiversificationWithMasterkeyTestcases() {
|
|||
return error;
|
||||
}
|
||||
|
||||
void print64bits(char *name, uint64_t val) {
|
||||
void print64bits(const char *name, uint64_t val) {
|
||||
printf("%s%08x%08x\n", name, (uint32_t)(val >> 32), (uint32_t)(val & 0xFFFFFFFF));
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ AccessConditions_t MFAccessConditionsTrailer[] = {
|
|||
{0x07, "rdCbyAB"}
|
||||
};
|
||||
|
||||
char *mfGetAccessConditionsDesc(uint8_t blockn, uint8_t *data) {
|
||||
const char *mfGetAccessConditionsDesc(uint8_t blockn, uint8_t *data) {
|
||||
static char StaticNone[] = "none";
|
||||
|
||||
uint8_t data1 = ((data[1] >> 4) & 0x0f) >> blockn;
|
||||
|
|
|
@ -40,7 +40,7 @@ typedef enum {
|
|||
|
||||
typedef struct {
|
||||
uint8_t cond;
|
||||
char *description;
|
||||
const char *description;
|
||||
} AccessConditions_t;
|
||||
|
||||
void mfpSetVerboseMode(bool verbose);
|
||||
|
@ -55,7 +55,7 @@ int MFPReadBlock(mf4Session *session, bool plain, uint8_t blockNum, uint8_t bloc
|
|||
int MFPWriteBlock(mf4Session *session, uint8_t blockNum, uint8_t *data, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen, uint8_t *mac);
|
||||
int mfpReadSector(uint8_t sectorNo, uint8_t keyType, uint8_t *key, uint8_t *dataout, bool verbose);
|
||||
|
||||
char *mfGetAccessConditionsDesc(uint8_t blockn, uint8_t *data);
|
||||
const char *mfGetAccessConditionsDesc(uint8_t blockn, uint8_t *data);
|
||||
|
||||
uint8_t mfNumBlocksPerSector(uint8_t sectorNo);
|
||||
uint8_t mfFirstBlockOfSector(uint8_t sectorNo);
|
||||
|
|
|
@ -19,11 +19,11 @@ bool GridLocked = false;
|
|||
bool showDemod = true;
|
||||
|
||||
pthread_mutex_t print_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static char *logfilename = "proxmark3.log";
|
||||
static const char *logfilename = "proxmark3.log";
|
||||
|
||||
float complex cexpf(float complex Z);
|
||||
|
||||
void PrintAndLogOptions(char *str[][2], size_t size, size_t space) {
|
||||
void PrintAndLogOptions(const char *str[][2], size_t size, size_t space) {
|
||||
char buff[2000] = "Options:\n";
|
||||
char format[2000] = "";
|
||||
size_t counts[2] = {0, 0};
|
||||
|
@ -56,7 +56,7 @@ void PrintAndLogEx(logLevel_t level, const char *fmt, ...) {
|
|||
char buffer2[MAX_PRINT_BUFFER + 20] = {0};
|
||||
char *token = NULL;
|
||||
// {NORMAL, SUCCESS, INFO, FAILED, WARNING, ERR, DEBUG}
|
||||
static char *prefixes[7] = { "", "[+] ", "[=] ", "[-] ", "[!] ", "[!!] ", "[#] "};
|
||||
static const char *prefixes[7] = { "", "[+] ", "[=] ", "[-] ", "[!] ", "[!!] ", "[#] "};
|
||||
|
||||
switch (level) {
|
||||
case ERR:
|
||||
|
@ -118,7 +118,7 @@ void PrintAndLogEx(logLevel_t level, const char *fmt, ...) {
|
|||
}
|
||||
}
|
||||
|
||||
void PrintAndLog(char *fmt, ...) {
|
||||
void PrintAndLog(const char *fmt, ...) {
|
||||
char *saved_line;
|
||||
int saved_point;
|
||||
va_list argptr, argptr2;
|
||||
|
|
|
@ -33,8 +33,8 @@ void ShowGui(void);
|
|||
void HideGraphWindow(void);
|
||||
void ShowGraphWindow(void);
|
||||
void RepaintGraphWindow(void);
|
||||
void PrintAndLog(char *fmt, ...);
|
||||
void PrintAndLogOptions(char *str[][2], size_t size, size_t space);
|
||||
void PrintAndLog(const char *fmt, ...);
|
||||
void PrintAndLogOptions(const char *str[][2], size_t size, size_t space);
|
||||
void PrintAndLogEx(logLevel_t level, const char *fmt, ...);
|
||||
void SetLogFilename(char *fn);
|
||||
void SetFlushAfterWrite(bool value);
|
||||
|
|
|
@ -58,7 +58,7 @@ int ukbhit(void) {
|
|||
// log files functions
|
||||
|
||||
// open, appped and close logfile
|
||||
void AddLogLine(char *fn, char *data, char *c) {
|
||||
void AddLogLine(const char *fn, const char *data, const char *c) {
|
||||
FILE *f = NULL;
|
||||
char filename[FILE_PATH_SIZE] = {0x00};
|
||||
int len = 0;
|
||||
|
@ -80,18 +80,18 @@ void AddLogLine(char *fn, char *data, char *c) {
|
|||
fclose(f);
|
||||
}
|
||||
|
||||
void AddLogHex(char *fn, char *extData, const uint8_t *data, const size_t len) {
|
||||
void AddLogHex(const char *fn, const char *extData, const uint8_t *data, const size_t len) {
|
||||
AddLogLine(fn, extData, sprint_hex(data, len));
|
||||
}
|
||||
|
||||
void AddLogUint64(char *fn, char *data, const uint64_t value) {
|
||||
void AddLogUint64(const char *fn, const char *data, const uint64_t value) {
|
||||
char buf[20] = {0};
|
||||
memset(buf, 0x00, sizeof(buf));
|
||||
sprintf(buf, "%016" PRIx64 "", value);
|
||||
AddLogLine(fn, data, buf);
|
||||
}
|
||||
|
||||
void AddLogCurrentDT(char *fn) {
|
||||
void AddLogCurrentDT(const char *fn) {
|
||||
char buf[20];
|
||||
memset(buf, 0x00, sizeof(buf));
|
||||
struct tm *curTime;
|
||||
|
@ -106,7 +106,7 @@ void AddLogCurrentDT(char *fn) {
|
|||
// param *uid - pointer to uid byte array
|
||||
// param *ext - ".log"
|
||||
// param uidlen - length of uid array.
|
||||
void FillFileNameByUID(char *filenamePrefix, uint8_t *uid, const char *ext, int uidlen) {
|
||||
void FillFileNameByUID(char *filenamePrefix, const uint8_t *uid, const char *ext, const int uidlen) {
|
||||
if (filenamePrefix == NULL || uid == NULL || ext == NULL) {
|
||||
printf("[!] error parameter is NULL\n");
|
||||
return;
|
||||
|
|
|
@ -189,11 +189,11 @@
|
|||
uint8_t g_debugMode;
|
||||
|
||||
int ukbhit(void);
|
||||
void AddLogLine(char *fn, char *data, char *c);
|
||||
void AddLogHex(char *fn, char *extData, const uint8_t *data, const size_t len);
|
||||
void AddLogUint64(char *fn, char *data, const uint64_t value);
|
||||
void AddLogCurrentDT(char *fn);
|
||||
void FillFileNameByUID(char *filenamePrefix, uint8_t *uid, const char *ext, int uidlen);
|
||||
void AddLogLine(const char *fn, const char *data, const char *c);
|
||||
void AddLogHex(const char *fn, const char *extData, const uint8_t *data, const size_t len);
|
||||
void AddLogUint64(const char *fn, const char *data, const uint64_t value);
|
||||
void AddLogCurrentDT(const char *fn);
|
||||
void FillFileNameByUID(char *filenamePrefix, const uint8_t *uid, const char *ext, const int uidlen);
|
||||
|
||||
// fill buffer from structure [{uint8_t data, size_t length},...]
|
||||
int FillBuffer(uint8_t *data, size_t maxDataLength, size_t *dataLength, ...);
|
||||
|
|
|
@ -90,7 +90,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
|
|||
timeout.tv_usec = 300000; // 300 000 micro seconds
|
||||
|
||||
char *colon = strrchr(addrstr, ':');
|
||||
char *portstr;
|
||||
const char *portstr;
|
||||
if (colon) {
|
||||
portstr = colon + 1;
|
||||
*colon = '\0';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue