From 4f11ef048f1118b39ace9ba5f63940b7bbcb4b5d Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Wed, 1 May 2019 01:38:52 +0200 Subject: [PATCH] style --- client/cmdhficlass.c | 6 +++--- client/cmdlf.c | 2 +- client/comms.c | 8 ++++---- client/flash.c | 20 ++++++++++---------- client/mifare/mifarehost.c | 6 +++--- client/scripting.c | 12 ++++++------ client/scripts/mfkeys.lua | 12 ++++++------ client/ui.c | 2 +- uart/uart.h | 2 +- uart/uart_posix.c | 2 +- uart/uart_win32.c | 4 ++-- 11 files changed, 38 insertions(+), 38 deletions(-) diff --git a/client/cmdhficlass.c b/client/cmdhficlass.c index 1b0eebff9..5f04f03f5 100644 --- a/client/cmdhficlass.c +++ b/client/cmdhficlass.c @@ -589,7 +589,7 @@ static int CmdHFiClassELoad(const char *Cmd) { // fast push mode conn.block_after_ACK = true; - + //Send to device uint32_t bytes_sent = 0; uint32_t bytes_remaining = bytes_read; @@ -607,7 +607,7 @@ static int CmdHFiClassELoad(const char *Cmd) { conn.block_after_ACK = false; SendCommandMIX(CMD_PING, 0, 0, 0, NULL, 0); WaitForResponseTimeout(CMD_ACK, NULL, 1000); - + PrintAndLogEx(SUCCESS, "sent %d bytes of data to device emulator memory", bytes_sent); return 0; } @@ -1949,7 +1949,7 @@ static int CmdHFiClassCheckKeys(const char *Cmd) { // fast push mode conn.block_after_ACK = true; - + // main keychunk loop for (uint32_t i = 0; i < keycnt; i += chunksize) { diff --git a/client/cmdlf.c b/client/cmdlf.c index 593c59d12..7725dc327 100644 --- a/client/cmdlf.c +++ b/client/cmdlf.c @@ -421,7 +421,7 @@ int CmdLFSim(const char *Cmd) { // fast push mode conn.block_after_ACK = true; - + //can send only 512 bits at a time (1 byte sent per bit...) for (uint16_t i = 0; i < GraphTraceLen; i += PM3_CMD_DATA_SIZE) { clearCommandBuffer(); diff --git a/client/comms.c b/client/comms.c index d1f42a8a4..8ee60bbe4 100644 --- a/client/comms.c +++ b/client/comms.c @@ -592,12 +592,12 @@ int TestProxmark(void) { if (conn.send_via_fpc) { PrintAndLogEx(INFO, "UART Serial baudrate: " _YELLOW_("%u") "\n", conn.uart_speed); } - + // reconfigure. - if ( conn.send_via_fpc == false ) { - uart_reconfigure_timeouts(sp, UART_USB_CLIENT_RX_TIMEOUT_MS ); + if (conn.send_via_fpc == false) { + uart_reconfigure_timeouts(sp, UART_USB_CLIENT_RX_TIMEOUT_MS); } - + return PM3_SUCCESS; } else { return PM3_ETIMEOUT; diff --git a/client/flash.c b/client/flash.c index 40c811c08..0d989eecd 100644 --- a/client/flash.c +++ b/client/flash.c @@ -63,14 +63,14 @@ static int build_segs_from_phdrs(flash_file_t *ctx, FILE *fd, Elf32_Phdr *phdrs, continue; } PrintAndLogEx(NORMAL, "%d: V 0x%08x P 0x%08x (0x%08x->0x%08x) [%c%c%c] @0x%x", - i, vaddr, paddr, filesz, memsz, - (flags & PF_R) ? 'R' : ' ', - (flags & PF_W) ? 'W' : ' ', - (flags & PF_X) ? 'X' : ' ', - offset); + i, vaddr, paddr, filesz, memsz, + (flags & PF_R) ? 'R' : ' ', + (flags & PF_W) ? 'W' : ' ', + (flags & PF_X) ? 'X' : ' ', + offset); if (filesz != memsz) { PrintAndLogEx(ERR, "Error: PHDR file size does not equal memory size\n" - "(DATA+BSS PHDRs do not make sense on ROM platforms!)"); + "(DATA+BSS PHDRs do not make sense on ROM platforms!)"); return -1; } if (paddr < last_end) { @@ -121,7 +121,7 @@ static int build_segs_from_phdrs(flash_file_t *ctx, FILE *fd, Elf32_Phdr *phdrs, memcpy(new_data, prev_seg->data, prev_seg->length); memcpy(new_data + this_offset, data, filesz); PrintAndLogEx(NORMAL, "Note: Extending previous segment from 0x%x to 0x%x bytes", - prev_seg->length, new_length); + prev_seg->length, new_length); if (hole) PrintAndLogEx(NORMAL, "Note: 0x%x-byte hole created", hole); free(data); @@ -335,9 +335,9 @@ static int wait_for_ack(PacketResponseNG *ack) { if (ack->cmd != CMD_ACK) { PrintAndLogEx(ERR, "Error: Unexpected reply 0x%04x %s (expected ACK)", - ack->cmd, - (ack->cmd == CMD_NACK) ? "NACK" : "" - ); + ack->cmd, + (ack->cmd == CMD_NACK) ? "NACK" : "" + ); return -1; } return 0; diff --git a/client/mifare/mifarehost.c b/client/mifare/mifarehost.c index 5c0d31771..5f21e6750 100644 --- a/client/mifare/mifarehost.c +++ b/client/mifare/mifarehost.c @@ -122,15 +122,15 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) { } int mfCheckKeys(uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keycnt, uint8_t *keyBlock, uint64_t *key) { *key = -1; - clearCommandBuffer(); + clearCommandBuffer(); uint8_t data[PM3_CMD_DATA_SIZE] = {0}; data[0] = keyType; data[1] = blockNo; data[2] = clear_trace; data[3] = keycnt; memcpy(data + 4, keyBlock, 6 * keycnt); - SendCommandNG(CMD_MIFARE_CHKKEYS, data, (4 + 6 * keycnt) ); - + SendCommandNG(CMD_MIFARE_CHKKEYS, data, (4 + 6 * keycnt)); + PacketResponseNG resp; if (!WaitForResponseTimeout(CMD_MIFARE_CHKKEYS, &resp, 2500)) return PM3_ETIMEOUT; if (resp.status != PM3_SUCCESS) return PM3_EUNDEF; diff --git a/client/scripting.c b/client/scripting.c index e855c0fe9..d2fd4fd90 100644 --- a/client/scripting.c +++ b/client/scripting.c @@ -30,25 +30,25 @@ static int l_clearCommandBuffer(lua_State *L) { /** * Enable / Disable fast push mode for lua scripts like mfkeys * The following params expected: - * + * *@brief l_fast_push_mode * @param L * @return */ -static int l_fast_push_mode(lua_State *L){ - +static int l_fast_push_mode(lua_State *L) { + luaL_checktype(L, 1, LUA_TBOOLEAN); - + bool enable = lua_toboolean(L, 1); conn.block_after_ACK = enable; - + // Disable fast mode and send a dummy command to make it effective if (enable == false) { SendCommandMIX(CMD_PING, 0, 0, 0, NULL, 0); WaitForResponseTimeout(CMD_ACK, NULL, 1000); } - + //Push the retval on the stack lua_pushboolean(L, enable); return 1; diff --git a/client/scripts/mfkeys.lua b/client/scripts/mfkeys.lua index c2702b4a6..9fb3d3f9d 100644 --- a/client/scripts/mfkeys.lua +++ b/client/scripts/mfkeys.lua @@ -209,7 +209,7 @@ local function perform_check(numsectors) core.fast_push_mode(true) local start_time = os.time() - + for sector = 0, #keys do -- Check if user aborted if core.ukbhit() then @@ -231,15 +231,15 @@ local function perform_check(numsectors) keys[sector] = {succA, succB, keyA, keyB} end - + local end_time = os.time() print('') print('[+] mfkeys - Checkkey execution time: '..os.difftime(end_time, start_time)..' sec') - + core.fast_push_mode(false) - + display_results(keys) - + -- save to dumpkeys.bin dumptofile(keys) end @@ -282,7 +282,7 @@ local function main(args) -- identify tag tag, err = lib14a.read(false, true) if not tag then return oops(err) end - + -- detect sectors and print taginfo numsectors = taginfo(tag) diff --git a/client/ui.c b/client/ui.c index 816ec2863..1dc5a1dca 100644 --- a/client/ui.c +++ b/client/ui.c @@ -75,7 +75,7 @@ void PrintAndLogEx(logLevel_t level, const char *fmt, ...) { char *tmp_ptr = NULL; // {NORMAL, SUCCESS, INFO, FAILED, WARNING, ERR, DEBUG} static const char *prefixes[7] = { "", "[+] ", "[=] ", "[-] ", "[!] ", "[!!] ", "[#] "}; - FILE* stream = stdout; + FILE *stream = stdout; switch (level) { case ERR: diff --git a/uart/uart.h b/uart/uart.h index 24c1063a3..fe51f0643 100644 --- a/uart/uart.h +++ b/uart/uart.h @@ -107,6 +107,6 @@ uint32_t uart_get_speed(const serial_port sp); /* Reconfigure timeouts */ -int uart_reconfigure_timeouts(serial_port sp, uint32_t value ); +int uart_reconfigure_timeouts(serial_port sp, uint32_t value); #endif // _UART_H_ diff --git a/uart/uart_posix.c b/uart/uart_posix.c index f1bb0b733..c80ad295b 100644 --- a/uart/uart_posix.c +++ b/uart/uart_posix.c @@ -73,7 +73,7 @@ struct timeval timeout = { .tv_usec = UART_FPC_CLIENT_RX_TIMEOUT_MS * 1000 }; -int uart_reconfigure_timeouts(serial_port sp, uint32_t value ) { +int uart_reconfigure_timeouts(serial_port sp, uint32_t value) { timeout.tv_usec = value * 1000; return PM3_SUCCESS; } diff --git a/uart/uart_win32.c b/uart/uart_win32.c index 6fc30ce47..9939eee1c 100644 --- a/uart/uart_win32.c +++ b/uart/uart_win32.c @@ -49,7 +49,7 @@ typedef struct { } serial_port_windows; int uart_reconfigure_timeouts(serial_port sp, uint32_t value) { - + serial_port_windows *spw; spw = (serial_port_windows *)sp; spw->ct.ReadIntervalTimeout = value; @@ -152,7 +152,7 @@ bool uart_set_speed(serial_port sp, const uint32_t uiPortSpeed) { PurgeComm(spw->hPort, PURGE_RXABORT | PURGE_RXCLEAR); if (result) conn.uart_speed = uiPortSpeed; - + return result; }