From 51d6fa13ebe56398cbc6e3a315eb76cca2feb51a Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sat, 6 Apr 2019 21:46:00 +0200 Subject: [PATCH] arg names --- client/cliparser/argtable3.h | 2 +- client/cliparser/cliparser.h | 4 +-- client/cmddata.c | 30 ++++++++++---------- client/cmddata.h | 4 +-- client/cmdlf.c | 6 ++-- client/cmdlfawid.c | 2 +- client/cmdlfcotag.c | 2 +- client/cmdlfem4x.c | 6 ++-- client/cmdlffdx.c | 4 +-- client/cmdlfguard.c | 2 +- client/cmdlfhid.c | 2 +- client/cmdlfindala.c | 2 +- client/cmdlfio.c | 2 +- client/cmdlfjablotron.c | 2 +- client/cmdlfkeri.c | 2 +- client/cmdlfnedap.c | 2 +- client/cmdlfnexwatch.c | 2 +- client/cmdlfnoralsy.c | 2 +- client/cmdlfpac.c | 2 +- client/cmdlfparadox.c | 2 +- client/cmdlfpresco.c | 2 +- client/cmdlfpyramid.c | 2 +- client/cmdlfsecurakey.c | 2 +- client/cmdlfviking.c | 2 +- client/cmdlfvisa2000.c | 2 +- client/graph.c | 12 ++++---- client/hardnested/hardnested_bf_core.h | 4 +-- client/hardnested/hardnested_bitarray_core.c | 4 +-- client/mifare/mifarehost.h | 2 +- common/crc.c | 6 ++-- common/crc16.c | 16 +++++------ common/crc16.h | 2 +- 32 files changed, 69 insertions(+), 69 deletions(-) diff --git a/client/cliparser/argtable3.h b/client/cliparser/argtable3.h index a442ec0d5..c3ec479ea 100644 --- a/client/cliparser/argtable3.h +++ b/client/cliparser/argtable3.h @@ -271,7 +271,7 @@ struct arg_date *arg_daten(const char *shortopts, int maxcount, const char *glossary); -struct arg_end *arg_end(int maxerrors); +struct arg_end *arg_end(int maxcount); /**** other functions *******************************************/ diff --git a/client/cliparser/cliparser.h b/client/cliparser/cliparser.h index 7dd3584bc..d1fa19bce 100644 --- a/client/cliparser/cliparser.h +++ b/client/cliparser/cliparser.h @@ -32,9 +32,9 @@ #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 CLIParserParseString(const char *str, void *argtable[], size_t vargtableLen, bool allowEmptyExec); +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 *argtable[], size_t vargtableLen, bool allowEmptyExec); +int CLIParserParseArg(int argc, char **argv, void *vargtable[], size_t vargtableLen, bool allowEmptyExec); void CLIParserFree(); int CLIParamHexToBuf(struct arg_str *argstr, uint8_t *data, int maxdatalen, int *datalen); diff --git a/client/cmddata.c b/client/cmddata.c index 5b3074433..959472c58 100644 --- a/client/cmddata.c +++ b/client/cmddata.c @@ -237,26 +237,26 @@ int usage_data_fsktonrz() { //set the demod buffer with given array of binary (one bit per byte) //by marshmellow -void setDemodBuf(uint8_t *buf, size_t size, size_t start_idx) { - if (buf == NULL) return; +void setDemodBuff(uint8_t *buff, size_t size, size_t start_idx) { + if (buff == NULL) return; if (size > MAX_DEMOD_BUF_LEN - start_idx) size = MAX_DEMOD_BUF_LEN - start_idx; for (size_t i = 0; i < size; i++) - DemodBuffer[i] = buf[start_idx++]; + DemodBuffer[i] = buff[start_idx++]; DemodBufferLen = size; } -bool getDemodBuf(uint8_t *buf, size_t *size) { - if (buf == NULL) return false; +bool getDemodBuff(uint8_t *buff, size_t *size) { + if (buff == NULL) return false; if (size == NULL) return false; if (*size == 0) return false; *size = (*size > DemodBufferLen) ? DemodBufferLen : *size; - memcpy(buf, DemodBuffer, *size); + memcpy(buff, DemodBuffer, *size); return true; } @@ -521,7 +521,7 @@ int ASKDemod_ext(const char *Cmd, bool verbose, bool emSearch, uint8_t askType, if (verbose) PrintAndLogEx(DEBUG, "DEBUG: (ASKDemod_ext) Using clock:%d, invert:%d, bits found:%d", clk, invert, BitLen); //output - setDemodBuf(bits, BitLen, 0); + setDemodBuff(bits, BitLen, 0); setClockGrid(clk, startIdx); if (verbose) { @@ -608,7 +608,7 @@ int Cmdmandecoderaw(const char *Cmd) { size_t idx = 0; if (Em410xDecode(bits, &size, &idx, &hi, &id) == 1) { //need to adjust to set bitstream back to manchester encoded data - //setDemodBuf(bits, size, idx); + //setDemodBuff(bits, size, idx); printEM410x(hi, id); } } @@ -638,7 +638,7 @@ int CmdBiphaseDecodeRaw(const char *Cmd) { uint8_t bits[MAX_DEMOD_BUF_LEN] = {0}; size = sizeof(bits); - if (!getDemodBuf(bits, &size)) return 0; + if (!getDemodBuff(bits, &size)) return 0; errCnt = BiphaseRawDecode(bits, &size, &offset, invert); if (errCnt < 0) { @@ -658,7 +658,7 @@ int CmdBiphaseDecodeRaw(const char *Cmd) { //remove first bit from raw demod if (offset) - setDemodBuf(DemodBuffer, DemodBufferLen - offset, offset); + setDemodBuff(DemodBuffer, DemodBufferLen - offset, offset); setClockGrid(g_DemodClock, g_DemodStartIdx + g_DemodClock * offset / 2); return 1; @@ -696,7 +696,7 @@ int ASKbiphaseDemod(const char *Cmd, bool verbose) { return 0; } //success set DemodBuffer and return - setDemodBuf(BitStream, size, 0); + setDemodBuff(BitStream, size, 0); setClockGrid(clk, startIdx + clk * offset / 2); if (g_debugMode || verbose) { PrintAndLogEx(NORMAL, "Biphase Decoded using offset: %d - clock: %d - # errors:%d - data:", offset, clk, errCnt); @@ -1067,7 +1067,7 @@ int FSKrawDemod(const char *Cmd, bool verbose) { int startIdx = 0; int size = fskdemod(bits, BitLen, rfLen, invert, fchigh, fclow, &startIdx); if (size > 0) { - setDemodBuf(bits, size, 0); + setDemodBuff(bits, size, 0); setClockGrid(rfLen, startIdx); // Now output the bitstream to the scrollback by line of 16 bits @@ -1135,7 +1135,7 @@ int PSKDemod(const char *Cmd, bool verbose) { } } //prime demod buffer for output - setDemodBuf(bits, bitlen, 0); + setDemodBuff(bits, bitlen, 0); setClockGrid(clk, startIdx); return 1; } @@ -1185,7 +1185,7 @@ int CmdIdteckDemod(const char *Cmd) { return 0; } } - setDemodBuf(DemodBuffer, 64, idx); + setDemodBuff(DemodBuffer, 64, idx); //got a good demod uint32_t id = 0; @@ -1238,7 +1238,7 @@ int NRZrawDemod(const char *Cmd, bool verbose) { } if (verbose || g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: (NRZrawDemod) Tried NRZ Demod using Clock: %d - invert: %d - Bits Found: %d", clk, invert, BitLen); //prime demod buffer for output - setDemodBuf(bits, BitLen, 0); + setDemodBuff(bits, BitLen, 0); setClockGrid(clk, clkStartIdx); diff --git a/client/cmddata.h b/client/cmddata.h index 5f0fe80e0..cca722ed4 100644 --- a/client/cmddata.h +++ b/client/cmddata.h @@ -36,8 +36,8 @@ command_t *CmdDataCommands(); int CmdData(const char *Cmd); void printDemodBuff(void); -void setDemodBuf(uint8_t *buff, size_t size, size_t startIdx); -bool getDemodBuf(uint8_t *buff, size_t *size); +void setDemodBuff(uint8_t *buff, size_t size, size_t start_idx); +bool getDemodBuff(uint8_t *buff, size_t *size); void save_restoreDB(uint8_t saveOpt);// option '1' to save DemodBuffer any other to restore int CmdPrintDemodBuff(const char *Cmd); diff --git a/client/cmdlf.c b/client/cmdlf.c index 263e73749..1ea81b6ed 100644 --- a/client/cmdlf.c +++ b/client/cmdlf.c @@ -509,7 +509,7 @@ int CmdLFfskSim(const char *Cmd) { } } } else { - setDemodBuf(data, dataLen, 0); + setDemodBuff(data, dataLen, 0); } //default if not found @@ -603,7 +603,7 @@ int CmdLFaskSim(const char *Cmd) { if (clk == 0) clk = GetAskClock("0", false); } else { - setDemodBuf(data, dataLen, 0); + setDemodBuff(data, dataLen, 0); } if (clk == 0) clk = 64; if (encoding == 0) clk /= 2; //askraw needs to double the clock speed @@ -704,7 +704,7 @@ int CmdLFpskSim(const char *Cmd) { PrintAndLogEx(NORMAL, "carrier: %d", carrier); } else { - setDemodBuf(data, dataLen, 0); + setDemodBuff(data, dataLen, 0); } if (clk == 0) clk = 32; diff --git a/client/cmdlfawid.c b/client/cmdlfawid.c index 72fc913da..72bd48a07 100644 --- a/client/cmdlfawid.c +++ b/client/cmdlfawid.c @@ -267,7 +267,7 @@ int CmdAWIDDemod(const char *Cmd) { return 0; } - setDemodBuf(bits, size, idx); + setDemodBuff(bits, size, idx); setClockGrid(50, waveIdx + (idx * 50)); diff --git a/client/cmdlfcotag.c b/client/cmdlfcotag.c index ec26c89ff..53b0d0451 100644 --- a/client/cmdlfcotag.c +++ b/client/cmdlfcotag.c @@ -40,7 +40,7 @@ int CmdCOTAGDemod(const char *Cmd) { return -1; } - setDemodBuf(bits, bitlen, 0); + setDemodBuff(bits, bitlen, 0); //got a good demod uint16_t cn = bytebits_to_byteLSBF(bits + 1, 16); diff --git a/client/cmdlfem4x.c b/client/cmdlfem4x.c index 8d5ebb68b..b3e0c42dd 100644 --- a/client/cmdlfem4x.c +++ b/client/cmdlfem4x.c @@ -356,7 +356,7 @@ int AskEm410xDecode(bool verbose, uint32_t *hi, uint64_t *lo) { size_t idx = 0; uint8_t bits[512] = {0}; size_t size = sizeof(bits); - if (!getDemodBuf(bits, &size)) { + if (!getDemodBuff(bits, &size)) { PrintAndLogEx(DEBUG, "DEBUG: Error - Em410x problem during copy from ASK demod"); return 0; } @@ -381,7 +381,7 @@ int AskEm410xDecode(bool verbose, uint32_t *hi, uint64_t *lo) { } //set GraphBuffer for clone or sim command - setDemodBuf(DemodBuffer, (size == 40) ? 64 : 128, idx + 1); + setDemodBuff(DemodBuffer, (size == 40) ? 64 : 128, idx + 1); setClockGrid(g_DemodClock, g_DemodStartIdx + ((idx + 1)*g_DemodClock)); PrintAndLogEx(DEBUG, "DEBUG: Em410x idx: %d, Len: %d, Printing Demod Buffer:", idx, size); @@ -1109,7 +1109,7 @@ bool setDemodBufferEM(uint32_t *word, size_t idx) { PrintAndLogEx(DEBUG, "DEBUG: Error - EM, failed removing parity"); return false; } - setDemodBuf(DemodBuffer, 32, 0); + setDemodBuff(DemodBuffer, 32, 0); *word = bytebits_to_byteLSBF(DemodBuffer, 32); return true; } diff --git a/client/cmdlffdx.c b/client/cmdlffdx.c index 972ef9627..46dd0c8ca 100644 --- a/client/cmdlffdx.c +++ b/client/cmdlffdx.c @@ -186,7 +186,7 @@ int CmdFDXBdemodBI(const char *Cmd) { return 0; } - setDemodBuf(bs, 128, preambleIndex); + setDemodBuff(bs, 128, preambleIndex); // remove marker bits (1's every 9th digit after preamble) (pType = 2) size = removeParity(bs, preambleIndex + 11, 9, 2, 117); @@ -256,7 +256,7 @@ int CmdFdxDemod(const char *Cmd) { } // set and leave DemodBuffer intact - setDemodBuf(DemodBuffer, 128, preambleIndex); + setDemodBuff(DemodBuffer, 128, preambleIndex); setClockGrid(g_DemodClock, g_DemodStartIdx + (preambleIndex * g_DemodClock)); // remove marker bits (1's every 9th digit after preamble) (pType = 2) size = removeParity(DemodBuffer, 11, 9, 2, 117); diff --git a/client/cmdlfguard.c b/client/cmdlfguard.c index a3f8bbec9..1f89a87ef 100644 --- a/client/cmdlfguard.c +++ b/client/cmdlfguard.c @@ -220,7 +220,7 @@ int CmdGuardDemod(const char *Cmd) { PrintAndLogEx(DEBUG, "DEBUG: gProxII byte %u after xor: %02x", (unsigned int)idx, ByteStream[idx]); } - setDemodBuf(DemodBuffer, 96, preambleIndex); + setDemodBuff(DemodBuffer, 96, preambleIndex); setClockGrid(g_DemodClock, g_DemodStartIdx + (preambleIndex * g_DemodClock)); //ByteStream contains 8 Bytes (64 bits) of decrypted raw tag data diff --git a/client/cmdlfhid.c b/client/cmdlfhid.c index b44a5e68a..9dbb721cd 100644 --- a/client/cmdlfhid.c +++ b/client/cmdlfhid.c @@ -155,7 +155,7 @@ int CmdHIDDemod(const char *Cmd) { return 0; } - setDemodBuf(bits, size, idx); + setDemodBuff(bits, size, idx); setClockGrid(50, waveIdx + (idx * 50)); if (hi2 == 0 && hi == 0 && lo == 0) { diff --git a/client/cmdlfindala.c b/client/cmdlfindala.c index c6be8bd29..b1d970575 100644 --- a/client/cmdlfindala.c +++ b/client/cmdlfindala.c @@ -208,7 +208,7 @@ int CmdIndalaDemod(const char *Cmd) { PrintAndLogEx(DEBUG, "DEBUG: Error - Indala: error demoding psk idx: %d", idx); return 0; } - setDemodBuf(DemodBuffer, size, idx); + setDemodBuff(DemodBuffer, size, idx); setClockGrid(g_DemodClock, g_DemodStartIdx + (idx * g_DemodClock)); //convert UID to HEX diff --git a/client/cmdlfio.c b/client/cmdlfio.c index df994b1a1..ae18ec4f7 100644 --- a/client/cmdlfio.c +++ b/client/cmdlfio.c @@ -112,7 +112,7 @@ int CmdIOProxDemod(const char *Cmd) { } return 0; } - setDemodBuf(bits, size, idx); + setDemodBuff(bits, size, idx); setClockGrid(64, waveIdx + (idx * 64)); if (idx == 0) { diff --git a/client/cmdlfjablotron.c b/client/cmdlfjablotron.c index e445b20b6..08312db4b 100644 --- a/client/cmdlfjablotron.c +++ b/client/cmdlfjablotron.c @@ -117,7 +117,7 @@ int CmdJablotronDemod(const char *Cmd) { return 0; } - setDemodBuf(DemodBuffer, 64, ans); + setDemodBuff(DemodBuffer, 64, ans); setClockGrid(g_DemodClock, g_DemodStartIdx + (ans * g_DemodClock)); //got a good demod diff --git a/client/cmdlfkeri.c b/client/cmdlfkeri.c index 199e639a9..c3df3e7be 100644 --- a/client/cmdlfkeri.c +++ b/client/cmdlfkeri.c @@ -84,7 +84,7 @@ int CmdKeriDemod(const char *Cmd) { return 0; } - setDemodBuf(DemodBuffer, size, idx); + setDemodBuff(DemodBuffer, size, idx); setClockGrid(g_DemodClock, g_DemodStartIdx + (idx * g_DemodClock)); //got a good demod diff --git a/client/cmdlfnedap.c b/client/cmdlfnedap.c index 320f07d6a..e03401e84 100644 --- a/client/cmdlfnedap.c +++ b/client/cmdlfnedap.c @@ -165,7 +165,7 @@ int CmdLFNedapDemod(const char *Cmd) { raw[1] = bytebits_to_byte(DemodBuffer + idx + 64, 32); raw[2] = bytebits_to_byte(DemodBuffer + idx + 32, 32); raw[3] = bytebits_to_byte(DemodBuffer + idx, 32); - setDemodBuf(DemodBuffer, 128, idx); + setDemodBuff(DemodBuffer, 128, idx); setClockGrid(g_DemodClock, g_DemodStartIdx + (idx * g_DemodClock)); uint8_t firstParity = GetParity(DemodBuffer, EVEN, 63); diff --git a/client/cmdlfnexwatch.c b/client/cmdlfnexwatch.c index 3d5c1083b..ffe3bd785 100644 --- a/client/cmdlfnexwatch.c +++ b/client/cmdlfnexwatch.c @@ -57,7 +57,7 @@ int CmdNexWatchDemod(const char *Cmd) { return 0; } - setDemodBuf(DemodBuffer, size, idx + 4); + setDemodBuff(DemodBuffer, size, idx + 4); setClockGrid(g_DemodClock, g_DemodStartIdx + ((idx + 4)*g_DemodClock)); idx = 8 + 32; // 8 = preamble, 32 = reserved bits (always 0) diff --git a/client/cmdlfnoralsy.c b/client/cmdlfnoralsy.c index 0f515ba43..e2c4a5c90 100644 --- a/client/cmdlfnoralsy.c +++ b/client/cmdlfnoralsy.c @@ -128,7 +128,7 @@ int CmdNoralsyDemod(const char *Cmd) { } return 0; } - setDemodBuf(DemodBuffer, 96, ans); + setDemodBuff(DemodBuffer, 96, ans); setClockGrid(g_DemodClock, g_DemodStartIdx + (ans * g_DemodClock)); //got a good demod diff --git a/client/cmdlfpac.c b/client/cmdlfpac.c index 643e5295f..7c7742d95 100644 --- a/client/cmdlfpac.c +++ b/client/cmdlfpac.c @@ -46,7 +46,7 @@ int CmdPacDemod(const char *Cmd) { return 0; } - setDemodBuf(DemodBuffer, 128, ans); + setDemodBuff(DemodBuffer, 128, ans); setClockGrid(g_DemodClock, g_DemodStartIdx + (ans * g_DemodClock)); //got a good demod diff --git a/client/cmdlfparadox.c b/client/cmdlfparadox.c index 23d45bc27..5cca09b4e 100644 --- a/client/cmdlfparadox.c +++ b/client/cmdlfparadox.c @@ -108,7 +108,7 @@ int CmdParadoxDemod(const char *Cmd) { return 0; } - setDemodBuf(bits, size, idx); + setDemodBuff(bits, size, idx); setClockGrid(50, waveIdx + (idx * 50)); if (hi2 == 0 && hi == 0 && lo == 0) { diff --git a/client/cmdlfpresco.c b/client/cmdlfpresco.c index b76cdf5e3..cff86c88b 100644 --- a/client/cmdlfpresco.c +++ b/client/cmdlfpresco.c @@ -144,7 +144,7 @@ int CmdPrescoDemod(const char *Cmd) { PrintAndLogEx(DEBUG, "DEBUG: Error - Presco: ans: %d", ans); return 0; } - setDemodBuf(DemodBuffer, 128, ans); + setDemodBuff(DemodBuffer, 128, ans); setClockGrid(g_DemodClock, g_DemodStartIdx + (ans * g_DemodClock)); //got a good demod diff --git a/client/cmdlfpyramid.c b/client/cmdlfpyramid.c index 169c07194..e3f2a90b5 100644 --- a/client/cmdlfpyramid.c +++ b/client/cmdlfpyramid.c @@ -131,7 +131,7 @@ int CmdPyramidDemod(const char *Cmd) { PrintAndLogEx(DEBUG, "DEBUG: Error - Pyramid: error demoding fsk idx: %d", idx); return 0; } - setDemodBuf(bits, size, idx); + setDemodBuff(bits, size, idx); setClockGrid(50, waveIdx + (idx * 50)); // Index map diff --git a/client/cmdlfsecurakey.c b/client/cmdlfsecurakey.c index 527aba839..1f14f8083 100644 --- a/client/cmdlfsecurakey.c +++ b/client/cmdlfsecurakey.c @@ -47,7 +47,7 @@ int CmdSecurakeyDemod(const char *Cmd) { PrintAndLogEx(DEBUG, "DEBUG: Error - Securakey: ans: %d", ans); return 0; } - setDemodBuf(DemodBuffer, 96, ans); + setDemodBuff(DemodBuffer, 96, ans); setClockGrid(g_DemodClock, g_DemodStartIdx + (ans * g_DemodClock)); //got a good demod diff --git a/client/cmdlfviking.c b/client/cmdlfviking.c index 6c4a408b1..49b4ccf2f 100644 --- a/client/cmdlfviking.c +++ b/client/cmdlfviking.c @@ -90,7 +90,7 @@ int CmdVikingDemod(const char *Cmd) { uint8_t checksum = bytebits_to_byte(DemodBuffer + ans + 32 + 24, 8); PrintAndLogEx(SUCCESS, "Viking Tag Found: Card ID %08X, Checksum: %02X", cardid, checksum); PrintAndLogEx(SUCCESS, "Raw: %08X%08X", raw1, raw2); - setDemodBuf(DemodBuffer, 64, ans); + setDemodBuff(DemodBuffer, 64, ans); setClockGrid(g_DemodClock, g_DemodStartIdx + (ans * g_DemodClock)); return 1; } diff --git a/client/cmdlfvisa2000.c b/client/cmdlfvisa2000.c index 82bf491c2..3dcc7cf04 100644 --- a/client/cmdlfvisa2000.c +++ b/client/cmdlfvisa2000.c @@ -122,7 +122,7 @@ int CmdVisa2kDemod(const char *Cmd) { save_restoreGB(GRAPH_RESTORE); return 0; } - setDemodBuf(DemodBuffer, 96, ans); + setDemodBuff(DemodBuffer, 96, ans); setClockGrid(g_DemodClock, g_DemodStartIdx + (ans * g_DemodClock)); //got a good demod diff --git a/client/graph.c b/client/graph.c index 4decd40c8..1557efb7d 100644 --- a/client/graph.c +++ b/client/graph.c @@ -59,8 +59,8 @@ void save_restoreGB(uint8_t saveOpt) { return; } -void setGraphBuf(uint8_t *buf, size_t size) { - if (buf == NULL) return; +void setGraphBuf(uint8_t *buff, size_t size) { + if (buff == NULL) return; ClearGraph(false); @@ -68,21 +68,21 @@ void setGraphBuf(uint8_t *buf, size_t size) { size = MAX_GRAPH_TRACE_LEN; for (uint32_t i = 0; i < size; ++i) - GraphBuffer[i] = buf[i] - 128; + GraphBuffer[i] = buff[i] - 128; GraphTraceLen = size; RepaintGraphWindow(); return; } -size_t getFromGraphBuf(uint8_t *buf) { - if (buf == NULL) return 0; +size_t getFromGraphBuf(uint8_t *buff) { + if (buff == NULL) return 0; uint32_t i; for (i = 0; i < GraphTraceLen; ++i) { //trim if (GraphBuffer[i] > 127) GraphBuffer[i] = 127; if (GraphBuffer[i] < -127) GraphBuffer[i] = -127; - buf[i] = (uint8_t)(GraphBuffer[i] + 128); + buff[i] = (uint8_t)(GraphBuffer[i] + 128); } return i; } diff --git a/client/hardnested/hardnested_bf_core.h b/client/hardnested/hardnested_bf_core.h index 4f481cbc8..872fa2d08 100644 --- a/client/hardnested/hardnested_bf_core.h +++ b/client/hardnested/hardnested_bf_core.h @@ -64,7 +64,7 @@ typedef enum { void SetSIMDInstr(SIMDExecInstr instr); SIMDExecInstr GetSIMDInstrAuto(); -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_nonces_2nd_byte, noncelist_t *nonces); -void bitslice_test_nonces(uint32_t nonces_to_bruteforce, uint32_t *bf_test_nonces, uint8_t *bf_test_nonce_par); +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); +void bitslice_test_nonces(uint32_t nonces_to_bruteforce, uint32_t *bf_test_nonce, uint8_t *bf_test_nonce_par); #endif diff --git a/client/hardnested/hardnested_bitarray_core.c b/client/hardnested/hardnested_bitarray_core.c index 788d95597..e9e84aa40 100644 --- a/client/hardnested/hardnested_bitarray_core.c +++ b/client/hardnested/hardnested_bitarray_core.c @@ -593,8 +593,8 @@ uint32_t bitcount(uint32_t a) { return (*bitcount_function_p)(a); } -uint32_t count_states(uint32_t *bitarray) { - return (*count_states_function_p)(bitarray); +uint32_t count_states(uint32_t *A) { + return (*count_states_function_p)(A); } void bitarray_AND(uint32_t *A, uint32_t *B) { diff --git a/client/mifare/mifarehost.h b/client/mifare/mifarehost.h index 81e0e8f03..fd3935d41 100644 --- a/client/mifare/mifarehost.h +++ b/client/mifare/mifarehost.h @@ -70,7 +70,7 @@ typedef struct { extern char logHexFileName[FILE_PATH_SIZE]; int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key); -int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKeys, bool calibrate); +int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKey, bool calibrate); int mfCheckKeys(uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keycnt, uint8_t *keyBlock, uint64_t *key); int mfCheckKeys_fast(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk, uint8_t strategy, uint32_t size, uint8_t *keyBlock, sector_t *e_sector, bool use_flashmemory); diff --git a/common/crc.c b/common/crc.c index 2ad7609b1..c3bd90064 100644 --- a/common/crc.c +++ b/common/crc.c @@ -107,12 +107,12 @@ uint32_t CRC8Mad(uint8_t *buff, size_t size) { return crc_finish(&crc); } // width=4 poly=0xC, reversed poly=0x7 init=0x5 refin=true refout=true xorout=0x0000 check= name="CRC-4/LEGIC" -uint32_t CRC4Legic(uint8_t *cmd, size_t size) { +uint32_t CRC4Legic(uint8_t *buff, size_t size) { crc_t crc; crc_init_ref(&crc, 4, 0x19 >> 1, 0x5, 0, true, true); crc_update2(&crc, 1, 1); /* CMD_READ */ - crc_update2(&crc, cmd[0], 8); - crc_update2(&crc, cmd[1], 8); + crc_update2(&crc, buff[0], 8); + crc_update2(&crc, buff[1], 8); return reflect(crc_finish(&crc), 4); } // width=8 poly=0x63, reversed poly=0x8D init=0x55 refin=true refout=true xorout=0x0000 check=0xC6 name="CRC-8/LEGIC" diff --git a/common/crc16.c b/common/crc16.c index 69ada3b24..075b5d724 100644 --- a/common/crc16.c +++ b/common/crc16.c @@ -9,21 +9,21 @@ static uint16_t crc_table[256]; static bool crc_table_init = false; -static CrcType_t crc_type = CRC_NONE; +static CrcType_t current_crc_type = CRC_NONE; -void init_table(CrcType_t ct) { +void init_table(CrcType_t crctype) { // same crc algo, and initialised already - if (ct == crc_type && crc_table_init) + if (crctype == current_crc_type && crc_table_init) return; // not the same crc algo. reset table. - if (ct != crc_type) + if (crctype != current_crc_type) reset_table(); - crc_type = ct; + current_crc_type = crctype; - switch (ct) { + switch (crctype) { case CRC_14443_A: case CRC_14443_B: case CRC_15693: @@ -44,7 +44,7 @@ void init_table(CrcType_t ct) { break; default: crc_table_init = false; - crc_type = CRC_NONE; + current_crc_type = CRC_NONE; break; } } @@ -80,7 +80,7 @@ void generate_table(uint16_t polynomial, bool refin) { void reset_table(void) { memset(crc_table, 0, sizeof(crc_table)); crc_table_init = false; - crc_type = CRC_NONE; + current_crc_type = CRC_NONE; } // table lookup LUT solution diff --git a/common/crc16.h b/common/crc16.h index 9a202f514..e59ed1832 100644 --- a/common/crc16.h +++ b/common/crc16.h @@ -32,7 +32,7 @@ typedef enum { uint16_t update_crc16_ex(uint16_t crc, uint8_t c, uint16_t polynomial); uint16_t update_crc16(uint16_t crc, uint8_t c); -uint16_t crc16(uint8_t const *message, size_t length, uint16_t remainder, uint16_t polynomial, bool refin, bool refout); +uint16_t crc16(uint8_t const *d, size_t length, uint16_t remainder, uint16_t polynomial, bool refin, bool refout); uint16_t crc(CrcType_t ct, const uint8_t *d, size_t n); void compute_crc(CrcType_t ct, const uint8_t *d, size_t n, uint8_t *first, uint8_t *second);