mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 18:48:13 -07:00
cppcheck reduce variable scopes
This commit is contained in:
parent
d37547917e
commit
9f36ce1b9d
15 changed files with 102 additions and 140 deletions
|
@ -259,9 +259,8 @@ static int demodNexWatch(void) {
|
|||
// output
|
||||
Dbprintf(" NexWatch raw id : " _YELLOW_("0x%08"PRIx32), rawid);
|
||||
|
||||
uint8_t temp_checksum;
|
||||
for (; magic < 255; magic++) {
|
||||
temp_checksum = nexwatch_checksum(magic, cn, calc_parity);
|
||||
uint8_t temp_checksum = nexwatch_checksum(magic, cn, calc_parity);
|
||||
if (temp_checksum == chk) {
|
||||
Dbprintf(" Magic number : " _GREEN_("0x%X"), magic);
|
||||
break;
|
||||
|
|
|
@ -126,11 +126,10 @@ static void append(const char *filename, uint8_t *entry, size_t entry_len) {
|
|||
}
|
||||
|
||||
static void save_pwds(uint32_t *pwdlist, size_t no_pwd) {
|
||||
uint8_t entry[10] = {0};
|
||||
|
||||
if (no_pwd > 0) {
|
||||
Dbprintf("");
|
||||
for (int i = 0; i < no_pwd; i++) {
|
||||
uint8_t entry[10] = {0};
|
||||
sprintf((char *)entry, "%08"PRIx32"\n", pwdlist[i]);
|
||||
append(LF_EM4X50_LOGFILE_SIM, entry, strlen((char *)entry));
|
||||
Dbprintf("received password: %08"PRIx32"", pwdlist[i]);
|
||||
|
|
|
@ -296,8 +296,6 @@ bool hitag2crack_read_page(uint8_t *responsestr, uint8_t pagenum, uint8_t *nrar,
|
|||
uint8_t cmd[10];
|
||||
uint8_t e_cmd[10];
|
||||
uint8_t e_responsestr[9];
|
||||
uint8_t e_response[32];
|
||||
uint8_t response[32];
|
||||
|
||||
if (pagenum > 7) {
|
||||
UserMessage("hitag2crack_read_page:\r\n invalid pagenum\r\n");
|
||||
|
@ -326,6 +324,8 @@ bool hitag2crack_read_page(uint8_t *responsestr, uint8_t pagenum, uint8_t *nrar,
|
|||
if (hitag2crack_send_e_cmd(e_responsestr, nrar, e_cmd, 10)) {
|
||||
// check if it is valid
|
||||
if (strcmp(e_responsestr, ERROR_RESPONSE) != 0) {
|
||||
uint8_t e_response[32];
|
||||
uint8_t response[32];
|
||||
// convert to binarray
|
||||
hextobinarray(e_response, e_responsestr);
|
||||
// decrypt response
|
||||
|
@ -792,13 +792,12 @@ bool hitag2crack_extend_keystream(uint8_t *keybits, int *kslen, int ksoffset, ui
|
|||
|
||||
bool hitag2_reader(uint8_t *response, uint8_t *key, bool interactive) {
|
||||
uint8_t tmp[9];
|
||||
int i;
|
||||
|
||||
response[0] = '\0';
|
||||
// auth to tag
|
||||
if (hitag2_crypto_auth(tmp, key)) {
|
||||
// read tag, one page at a time
|
||||
for (i = 0; i <= 7; ++i) {
|
||||
for (int i = 0; i <= 7; ++i) {
|
||||
if (!read_tag(tmp, i, i)) {
|
||||
// if read fails, it could be because of auth,
|
||||
// so try to reauth
|
||||
|
|
|
@ -858,7 +858,6 @@ void SimulateHitagSTag(bool tag_mem_supplied, uint8_t *data) {
|
|||
|
||||
// int frame_count = 0;
|
||||
int response = 0, overflow = 0;
|
||||
int i, j;
|
||||
uint8_t rx[HITAG_FRAME_LEN];
|
||||
size_t rxlen = 0;
|
||||
bQuiet = false;
|
||||
|
@ -885,8 +884,8 @@ void SimulateHitagSTag(bool tag_mem_supplied, uint8_t *data) {
|
|||
|
||||
// read tag data into memory
|
||||
if (tag_mem_supplied) {
|
||||
for (i = 0; i < 16; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
for (int i = 0; i < 16; i++)
|
||||
for (int j = 0; j < 4; j++)
|
||||
tag.pages[i][j] = 0x0;
|
||||
|
||||
DbpString("Loading hitagS memory...");
|
||||
|
@ -912,7 +911,7 @@ void SimulateHitagSTag(bool tag_mem_supplied, uint8_t *data) {
|
|||
if ((tag.pages[1][0] & 0x2) == 0 && (tag.pages[1][0] & 0x1) == 0)
|
||||
tag.max_page = 0;
|
||||
if (g_dbglevel >= DBG_EXTENDED)
|
||||
for (i = 0; i < tag.max_page; i++)
|
||||
for (int i = 0; i < tag.max_page; i++)
|
||||
Dbprintf("Page[%2d]: %02X %02X %02X %02X", i,
|
||||
(tag.pages[i][3]) & 0xff,
|
||||
(tag.pages[i][2]) & 0xff,
|
||||
|
|
|
@ -1329,8 +1329,8 @@ void SimulateIso14443aTag(uint8_t tagType, uint8_t flags, uint8_t *data, uint8_t
|
|||
int retval = PM3_SUCCESS;
|
||||
|
||||
// Just to allow some checks
|
||||
int happened = 0;
|
||||
int happened2 = 0;
|
||||
// int happened = 0;
|
||||
// int happened2 = 0;
|
||||
int cmdsRecvd = 0;
|
||||
uint32_t numReads = 0; //Counts numer of times reader reads a block
|
||||
|
||||
|
@ -1781,8 +1781,8 @@ void SimulateIso14443aTag(uint8_t tagType, uint8_t flags, uint8_t *data, uint8_t
|
|||
BigBuf_free_keep_EM();
|
||||
|
||||
if (g_dbglevel >= DBG_EXTENDED) {
|
||||
Dbprintf("-[ Wake ups after halt [%d]", happened);
|
||||
Dbprintf("-[ Messages after halt [%d]", happened2);
|
||||
// Dbprintf("-[ Wake ups after halt [%d]", happened);
|
||||
// Dbprintf("-[ Messages after halt [%d]", happened2);
|
||||
Dbprintf("-[ Num of received cmd [%d]", cmdsRecvd);
|
||||
Dbprintf("-[ Num of moebius tries [%d]", moebius_count);
|
||||
}
|
||||
|
|
|
@ -1871,9 +1871,8 @@ void T55xxDangerousRawTest(uint8_t *data) {
|
|||
// Trigger T55x7 in mode.
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
WaitUS(T55xx_Timing.m[0].start_gap);
|
||||
uint8_t sendbits;
|
||||
for (uint8_t i = 0; i < len; i++) {
|
||||
sendbits = (bs[BITSTREAM_BYTE(i)] >> BITSTREAM_BIT(i));
|
||||
uint8_t sendbits = (bs[BITSTREAM_BYTE(i)] >> BITSTREAM_BIT(i));
|
||||
T55xxWriteBit(sendbits & 1, 0);
|
||||
}
|
||||
TurnReadLFOn(c->time);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue