mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
cppcheck fixes for const
This commit is contained in:
parent
6bb301f4da
commit
d2c290c7c3
9 changed files with 18 additions and 18 deletions
|
@ -32,10 +32,10 @@
|
||||||
|
|
||||||
static int CmdHelp(const char *Cmd);
|
static int CmdHelp(const char *Cmd);
|
||||||
|
|
||||||
static uint8_t calculateLRC(uint8_t *bytes, uint8_t len) {
|
static uint8_t calculateLRC(const uint8_t *d, uint8_t n) {
|
||||||
uint8_t lcr = 0;
|
uint8_t lcr = 0;
|
||||||
for (uint8_t i = 0; i < len; i++)
|
for (uint8_t i = 0; i < n; i++)
|
||||||
lcr ^= bytes[i];
|
lcr ^= d[i];
|
||||||
return lcr;
|
return lcr;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -521,7 +521,7 @@ static char *get_st_chip_model(uint8_t data) {
|
||||||
return retStr;
|
return retStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *get_st_lock_info(uint8_t model, uint8_t *lockbytes, uint8_t blk) {
|
static char *get_st_lock_info(uint8_t model, const uint8_t *lockbytes, uint8_t blk) {
|
||||||
|
|
||||||
static char str[16];
|
static char str[16];
|
||||||
char *s = str;
|
char *s = str;
|
||||||
|
@ -687,11 +687,11 @@ static char *get_st_lock_info(uint8_t model, uint8_t *lockbytes, uint8_t blk) {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t get_st_chipid(uint8_t *uid) {
|
static uint8_t get_st_chipid(const uint8_t *uid) {
|
||||||
return uid[5] >> 2;
|
return uid[5] >> 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t get_st_cardsize(uint8_t *uid) {
|
static uint8_t get_st_cardsize(const uint8_t *uid) {
|
||||||
uint8_t chipid = get_st_chipid(uid);
|
uint8_t chipid = get_st_chipid(uid);
|
||||||
switch (chipid) {
|
switch (chipid) {
|
||||||
case 0x0:
|
case 0x0:
|
||||||
|
|
|
@ -314,7 +314,7 @@ static int CmdHFCryptoRFDump(const char *Cmd) {
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
|
|
||||||
// select
|
// select
|
||||||
int status = 0;
|
int status;
|
||||||
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, 2000)) {
|
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, 2000)) {
|
||||||
status = resp.oldarg[0];
|
status = resp.oldarg[0];
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
|
|
|
@ -74,7 +74,7 @@ static const char *em_get_card_str(uint32_t config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// even parity COLUMN
|
// even parity COLUMN
|
||||||
static bool em4x05_col_parity_test(uint8_t *bs, size_t size, uint8_t rows, uint8_t cols, uint8_t pType) {
|
static bool em4x05_col_parity_test(const uint8_t *bs, size_t size, uint8_t rows, uint8_t cols, uint8_t pType) {
|
||||||
if (rows * cols > size) return false;
|
if (rows * cols > size) return false;
|
||||||
uint8_t colP = 0;
|
uint8_t colP = 0;
|
||||||
|
|
||||||
|
@ -1889,7 +1889,7 @@ int CmdEM4x05Unlock(const char *Cmd) {
|
||||||
return exit_code;
|
return exit_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t em4x05_Sniff_GetNextBitStart(size_t idx, size_t sc, int *data, size_t *pulsesamples) {
|
static size_t em4x05_Sniff_GetNextBitStart(size_t idx, size_t sc, const int *data, size_t *pulsesamples) {
|
||||||
while ((idx < sc) && (data[idx] <= 10)) // find a going high
|
while ((idx < sc) && (data[idx] <= 10)) // find a going high
|
||||||
idx++;
|
idx++;
|
||||||
|
|
||||||
|
@ -1905,7 +1905,7 @@ static size_t em4x05_Sniff_GetNextBitStart(size_t idx, size_t sc, int *data, siz
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t static em4x05_Sniff_GetBlock(char *bits, bool fwd) {
|
static uint32_t em4x05_Sniff_GetBlock(const char *bits, bool fwd) {
|
||||||
uint32_t value = 0;
|
uint32_t value = 0;
|
||||||
uint8_t idx;
|
uint8_t idx;
|
||||||
bool parityerror = false;
|
bool parityerror = false;
|
||||||
|
|
|
@ -44,7 +44,7 @@ static uint8_t nexwatch_parity_swap(uint8_t parity) {
|
||||||
}
|
}
|
||||||
// parity check
|
// parity check
|
||||||
// from 32b hex id, 4b mode,
|
// from 32b hex id, 4b mode,
|
||||||
static uint8_t nexwatch_parity(uint8_t hexid[5]) {
|
static uint8_t nexwatch_parity(const uint8_t hexid[5]) {
|
||||||
uint8_t p = 0;
|
uint8_t p = 0;
|
||||||
for (uint8_t i = 0; i < 5; i++) {
|
for (uint8_t i = 0; i < 5; i++) {
|
||||||
p ^= NIBBLE_HIGH(hexid[i]);
|
p ^= NIBBLE_HIGH(hexid[i]);
|
||||||
|
|
|
@ -3905,7 +3905,7 @@ static int CmdT55xxProtect(const char *Cmd) {
|
||||||
// if the difference between a and b is less then or eq to d i.e. does a = b +/- d
|
// if the difference between a and b is less then or eq to d i.e. does a = b +/- d
|
||||||
#define APPROX_EQ(a, b, d) ((abs(a - b) <= d) ? true : false)
|
#define APPROX_EQ(a, b, d) ((abs(a - b) <= d) ? true : false)
|
||||||
|
|
||||||
static uint8_t t55sniff_get_packet(int *pulseBuffer, char *data, uint8_t width0, uint8_t width1, uint8_t tolerance) {
|
static uint8_t t55sniff_get_packet(const int *pulseBuffer, char *data, uint8_t width0, uint8_t width1, uint8_t tolerance) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
uint8_t len = 0;
|
uint8_t len = 0;
|
||||||
|
|
|
@ -59,7 +59,7 @@ out:
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t GetATRTA1(uint8_t *atr, size_t atrlen) {
|
static uint8_t GetATRTA1(const uint8_t *atr, size_t atrlen) {
|
||||||
if (atrlen > 2) {
|
if (atrlen > 2) {
|
||||||
uint8_t T0 = atr[1];
|
uint8_t T0 = atr[1];
|
||||||
if (T0 & 0x10)
|
if (T0 & 0x10)
|
||||||
|
@ -258,7 +258,7 @@ static void PrintATR(uint8_t *atr, size_t atrlen) {
|
||||||
|
|
||||||
static int smart_wait(uint8_t *out, int maxoutlen, bool verbose) {
|
static int smart_wait(uint8_t *out, int maxoutlen, bool verbose) {
|
||||||
int i = 4;
|
int i = 4;
|
||||||
uint32_t len = 0;
|
uint32_t len;
|
||||||
do {
|
do {
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
|
|
|
@ -585,7 +585,7 @@ exit:
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bin_xor(uint8_t *d1, uint8_t *d2, size_t len) {
|
void bin_xor(uint8_t *d1, const uint8_t *d2, size_t len) {
|
||||||
for (size_t i = 0; i < len; i++)
|
for (size_t i = 0; i < len; i++)
|
||||||
d1[i] = d1[i] ^ d2[i];
|
d1[i] = d1[i] ^ d2[i];
|
||||||
}
|
}
|
||||||
|
@ -598,7 +598,7 @@ void AddISO9797M2Padding(uint8_t *ddata, size_t *ddatalen, uint8_t *sdata, size_
|
||||||
ddata[sdatalen] = ISO9797_M2_PAD_BYTE;
|
ddata[sdatalen] = ISO9797_M2_PAD_BYTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t FindISO9797M2PaddingDataLen(uint8_t *data, size_t datalen) {
|
size_t FindISO9797M2PaddingDataLen(const uint8_t *data, size_t datalen) {
|
||||||
for (int i = datalen; i > 0; i--) {
|
for (int i = datalen; i > 0; i--) {
|
||||||
if (data[i - 1] == 0x80)
|
if (data[i - 1] == 0x80)
|
||||||
return i - 1;
|
return i - 1;
|
||||||
|
|
|
@ -47,11 +47,11 @@ char *ecdsa_get_error(int ret);
|
||||||
|
|
||||||
int ecdsa_nist_test(bool verbose);
|
int ecdsa_nist_test(bool verbose);
|
||||||
|
|
||||||
void bin_xor(uint8_t *d1, uint8_t *d2, size_t len);
|
void bin_xor(uint8_t *d1, const uint8_t *d2, size_t len);
|
||||||
|
|
||||||
#define ISO9797_M2_PAD_BYTE 0x80
|
#define ISO9797_M2_PAD_BYTE 0x80
|
||||||
void AddISO9797M2Padding(uint8_t *ddata, size_t *ddatalen, uint8_t *sdata, size_t sdatalen, size_t blocklen);
|
void AddISO9797M2Padding(uint8_t *ddata, size_t *ddatalen, uint8_t *sdata, size_t sdatalen, size_t blocklen);
|
||||||
size_t FindISO9797M2PaddingDataLen(uint8_t *data, size_t datalen);
|
size_t FindISO9797M2PaddingDataLen(const uint8_t *data, size_t datalen);
|
||||||
|
|
||||||
|
|
||||||
#endif /* libpcrypto.h */
|
#endif /* libpcrypto.h */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue