cppcheck fixes

This commit is contained in:
iceman1001 committed 2022-01-06 18:18:48 +01:00
1 parent e550f8ccc8
commit b3731c6003
8 files changed
+33 -22

No files matched your search

+2 -2
View File
@@ -86,7 +86,7 @@ static uint64_t computeNLM48(uint64_t x, uint64_t y) {
return res;
}
static void computeNLM(uint8_t *res, uint8_t *x, uint8_t *y) {
static void computeNLM(uint8_t *res, const uint8_t *x, const uint8_t *y) {
uint64_t x64 = 0;
uint64_t y64 = 0;
@@ -213,7 +213,7 @@ bool CipurseCCheckCT(CipurseContext_t *ctx, uint8_t *CT) {
return (memcmp(CT, ctx->CT, CIPURSE_AES_KEY_LENGTH) == 0);
}
static uint16_t CipurseCComputeMICCRC(uint8_t *data, size_t len) {
static uint16_t CipurseCComputeMICCRC(const uint8_t *data, size_t len) {
uint16_t initCRC = 0x6363;
for (size_t i = 0; i < len; i++) {
uint8_t ch = data[i] ^ initCRC;
+8 -3
View File
@@ -592,6 +592,9 @@ static int CmdLFHitagReader(const char *Cmd) {
hitag_function htf;
hitag_data htd;
memset(&htd, 0, sizeof(htd));
uint16_t cmd = CMD_LF_HITAG_READER;
if (s01) {
cmd = CMD_LF_HITAGS_READ;
@@ -778,6 +781,8 @@ static int CmdLFHitagWriter(const char *Cmd) {
hitag_function htf;
hitag_data htd;
memset(&htd, 0, sizeof(htd));
if (s03) {
htf = WHTSF_CHALLENGE;
memcpy(htd.auth.NrAr, nrar, sizeof(nrar));
@@ -881,10 +886,10 @@ static int CmdLFHitag2Dump(const char *Cmd) {
// Annotate HITAG protocol
void annotateHitag1(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_response) {
void annotateHitag1(char *exp, size_t size, const uint8_t *cmd, uint8_t cmdsize, bool is_response) {
}
void annotateHitag2(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_response) {
void annotateHitag2(char *exp, size_t size, const uint8_t *cmd, uint8_t cmdsize, bool is_response) {
// iceman: live decrypt of trace?
if (is_response) {
@@ -935,7 +940,7 @@ void annotateHitag2(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool
}
void annotateHitagS(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_response) {
void annotateHitagS(char *exp, size_t size, const uint8_t *cmd, uint8_t cmdsize, bool is_response) {
}
static command_t CommandTable[] = {
+3 -3
View File
@@ -16,8 +16,8 @@
int CmdLFHitag(const char *Cmd);
int readHitagUid(void);
void annotateHitag1(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_response);
void annotateHitag2(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_response);
void annotateHitagS(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_response);
void annotateHitag1(char *exp, size_t size, const uint8_t *cmd, uint8_t cmdsize, bool is_response);
void annotateHitag2(char *exp, size_t size, const uint8_t *cmd, uint8_t cmdsize, bool is_response);
void annotateHitagS(char *exp, size_t size, const uint8_t *cmd, uint8_t cmdsize, bool is_response);
uint8_t hitag1_CRC_check(uint8_t *d, uint32_t nbit);
#endif