From 107b474b8a56380bd4fdde9ba8aeea718e6aa011 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 10 Mar 2020 17:05:45 +0100 Subject: [PATCH] whitespace --- client/cmdhflto.c | 45 ++++++++++++++++++++++---------------------- client/cmdhfmfhard.c | 4 ++-- client/cmdlfem4x.c | 6 +++--- client/cmdlfhid.c | 14 ++++++++------ 4 files changed, 36 insertions(+), 33 deletions(-) diff --git a/client/cmdhflto.c b/client/cmdhflto.c index 7057fab36..dfbca68c1 100644 --- a/client/cmdhflto.c +++ b/client/cmdhflto.c @@ -218,15 +218,15 @@ static int lto_rdbl(uint8_t blk, uint8_t *block_responce, uint8_t *block_cnt_res uint16_t resp_len = 18; uint8_t rdbl_cmd[] = {0x30, blk}; - uint8_t rdbl_cnt_cmd[] ={0x80}; + uint8_t rdbl_cnt_cmd[] = {0x80}; int status = lto_send_cmd_raw(rdbl_cmd, sizeof(rdbl_cmd), block_responce, &resp_len, true, false, verbose); - if (status == PM3_ETIMEOUT || status == PM3_ESOFT ) { + if (status == PM3_ETIMEOUT || status == PM3_ESOFT) { return PM3_EWRONGANSVER; // READ BLOCK failed } status = lto_send_cmd_raw(rdbl_cnt_cmd, sizeof(rdbl_cnt_cmd), block_cnt_responce, &resp_len, false, false, verbose); - if (status == PM3_ETIMEOUT || status == PM3_ESOFT ) { + if (status == PM3_ETIMEOUT || status == PM3_ESOFT) { return PM3_EWRONGANSVER; // READ BLOCK CONTINUE failed } @@ -252,7 +252,7 @@ int rdblLTO(uint8_t st_blk, uint8_t end_blk, bool verbose) { uint8_t block_data_d16_d31[18]; uint8_t block_data[32]; - for(uint8_t i = st_blk; i < end_blk + 1; i++) { + for (uint8_t i = st_blk; i < end_blk + 1; i++) { ret_val = lto_rdbl(i, block_data_d00_d15, block_data_d16_d31, verbose); @@ -286,8 +286,8 @@ static int CmdHfLTOReadBlock(const char *Cmd) { case 'h': return usage_lto_rdbl(); case 's': - st_blk = param_get8(Cmd, cmdp+1); - if ( end_blk < st_blk ) { + st_blk = param_get8(Cmd, cmdp + 1); + if (end_blk < st_blk) { errors = true; break; } @@ -295,10 +295,11 @@ static int CmdHfLTOReadBlock(const char *Cmd) { break; case 'e': - end_blk = param_get8(Cmd, cmdp+1); - if ( end_blk < st_blk ) { + end_blk = param_get8(Cmd, cmdp + 1); + if (end_blk < st_blk) { errors = true; - break; } + break; + } cmdp += 2; break; @@ -328,7 +329,7 @@ static int lto_wrbl(uint8_t blk, uint8_t *data, bool verbose) { for (int i = 0; i < 16; i++) { wrbl_d00_d15[i] = data[i]; - wrbl_d16_d31[i] = data[i+16]; + wrbl_d16_d31[i] = data[i + 16]; } int status = lto_send_cmd_raw(wrbl_cmd, sizeof(wrbl_cmd), resp, &resp_len, true, false, verbose); @@ -390,15 +391,15 @@ static int CmdHfLTOWriteBlock(const char *Cmd) { case 'h': return usage_lto_wrbl(); case 'b': - blk = param_get8(Cmd, cmdp+1); + blk = param_get8(Cmd, cmdp + 1); b_opt_selected = true; cmdp += 2; break; case 'd': - if (param_gethex(Cmd, cmdp+1, blkData, 64)) { + if (param_gethex(Cmd, cmdp + 1, blkData, 64)) { PrintAndLogEx(WARNING, "block data must include 64 HEX symbols"); errors = true; - break; + break; } d_opt_selected = true; cmdp += 2; @@ -409,7 +410,7 @@ static int CmdHfLTOWriteBlock(const char *Cmd) { break; } } - + //Validations if (errors) { usage_lto_wrbl(); @@ -440,7 +441,7 @@ int dumpLTO(uint8_t *dump, bool verbose) { uint8_t block_data_d00_d15[18]; uint8_t block_data_d16_d31[18]; - for(uint8_t i = 0; i < 255; i++) { + for (uint8_t i = 0; i < 255; i++) { ret_val = lto_rdbl(i, block_data_d00_d15, block_data_d16_d31, verbose); @@ -504,10 +505,10 @@ static int CmdHfLTODump(const char *Cmd) { int ret_val = dumpLTO(dump, true); if (ret_val != PM3_SUCCESS) { free(dump); - return ret_val; + return ret_val; } - // save to file + // save to file if (filename[0] == '\0') { memcpy(serial_number, sprint_hex_inrow(dump, sizeof(serial_number)), sizeof(serial_number)); char tmp_name[17] = "hf_lto_"; @@ -538,10 +539,10 @@ int restoreLTO(uint8_t *dump_data, bool verbose) { return ret_val; } - uint8_t blkData[32] = {0}; + uint8_t blkData[32] = {0}; //Block address 0 and 1 are read-only - for(uint8_t blk = 2; blk < 255; blk++) { + for (uint8_t blk = 2; blk < 255; blk++) { for (int i = 0; i < 32; i++) { blkData[i] = dump_data[i + blk * 32]; @@ -550,7 +551,7 @@ int restoreLTO(uint8_t *dump_data, bool verbose) { ret_val = lto_wrbl(blk, blkData, verbose); if (ret_val == PM3_SUCCESS) { - PrintAndLogEx(SUCCESS, "BLK %03d: " _YELLOW_("write success"), blk); + PrintAndLogEx(SUCCESS, "BLK %03d: " _YELLOW_("write success"), blk); } else { lto_switch_off_field(); return ret_val; @@ -566,7 +567,7 @@ static int CmdHfLTRestore(const char *Cmd) { uint8_t cmdp = 0; bool errors = false; int is_data_loaded = PM3_ESOFT; - + char filename[FILE_PATH_SIZE] = {0}; char extension[FILE_PATH_SIZE] = {0}; @@ -623,7 +624,7 @@ static int CmdHfLTRestore(const char *Cmd) { } else { return PM3_EFILE; } - + } static command_t CommandTable[] = { diff --git a/client/cmdhfmfhard.c b/client/cmdhfmfhard.c index beb85df5b..9f6c458ae 100644 --- a/client/cmdhfmfhard.c +++ b/client/cmdhfmfhard.c @@ -1505,7 +1505,7 @@ static int acquire_nonces(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_ SendCommandNG(CMD_FPGA_MAJOR_MODE_OFF, NULL, 0); return 1; } - + // error during nested_hard if (resp.oldarg[0]) { if (nonce_file_write) { @@ -2034,7 +2034,7 @@ static void generate_candidates(uint8_t sum_a0_idx, uint8_t sum_a8_idx) { // create mutexes for accessing the statelist cache and our "book of work" pthread_mutex_init(&statelist_cache_mutex, NULL); pthread_mutex_init(&book_of_work_mutex, NULL); - + init_statelist_cache(); init_book_of_work(); diff --git a/client/cmdlfem4x.c b/client/cmdlfem4x.c index 9b7fe51de..02a86c2da 100644 --- a/client/cmdlfem4x.c +++ b/client/cmdlfem4x.c @@ -1039,9 +1039,9 @@ static int CmdEM4x50Write(const char *Cmd) { uint8_t ctmp = tolower(param_getchar(Cmd, 0)); if (ctmp == 'h') return usage_lf_em4x50_write(); PrintAndLogEx(NORMAL, "no implemented yet"); -// +// // PrintAndLogEx(SUCCESS, "Done"); -// PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf em 4x50_read`") "to verify"); +// PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf em 4x50_read`") "to verify"); return PM3_SUCCESS; } @@ -1440,7 +1440,7 @@ static int CmdEM4x05Write(const char *Cmd) { int status = demodEM4x05resp(&dummy); if (status == PM3_SUCCESS) PrintAndLogEx(SUCCESS, "Success writing to tag"); - + PrintAndLogEx(SUCCESS, "Done"); PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf em 4x05_read`") "to verify"); return status; diff --git a/client/cmdlfhid.c b/client/cmdlfhid.c index dbe027dc3..eb388faa6 100644 --- a/client/cmdlfhid.c +++ b/client/cmdlfhid.c @@ -346,7 +346,7 @@ static int CmdHIDClone(const char *Cmd) { clearCommandBuffer(); SendCommandMIX(CMD_LF_HID_CLONE, hi2, hi, lo, longid, sizeof(longid)); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf hid read`") "to verify"); + PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf hid read`") "to verify"); return PM3_SUCCESS; } @@ -450,7 +450,7 @@ static int CmdHIDBrute(const char *Cmd) { PrintAndLogEx(INFO, "ISSUE#........... %u", cn_hi.IssueLevel); PrintAndLogEx(INFO, "Facility#........ %u", cn_hi.FacilityCode); PrintAndLogEx(INFO, "Card#............ %" PRIu64, cn_hi.CardNumber); - switch( direction) { + switch (direction) { case 0: PrintAndLogEx(INFO, "Brute-forcing direction: " _YELLOW_("BOTH")); break; @@ -460,7 +460,8 @@ static int CmdHIDBrute(const char *Cmd) { case 2: PrintAndLogEx(INFO, "Brute-forcing direction: " _YELLOW_("DOWN")); break; - default: break; + default: + break; } } PrintAndLogEx(INFO, "Brute-forcing HID reader"); @@ -495,7 +496,7 @@ static int CmdHIDBrute(const char *Cmd) { fin_hi = true; } } - + // do one down if (direction != 1) { if (cn_low.CardNumber > 0) { @@ -507,7 +508,7 @@ static int CmdHIDBrute(const char *Cmd) { } switch (direction) { - case 0: + case 0: if (fin_hi && fin_low) { exitloop = true; } @@ -518,7 +519,8 @@ static int CmdHIDBrute(const char *Cmd) { case 2: exitloop = fin_low; break; - default: break; + default: + break; } } while (exitloop == false);