make style

This commit is contained in:
Anže Jenšterle 2021-02-09 16:56:55 +01:00
parent e22cb088c1
commit cd36770c5e
No known key found for this signature in database
GPG key ID: 56821505069EBF5F
22 changed files with 99 additions and 99 deletions

View file

@ -52,8 +52,8 @@ static void fill_buff(uint8_t bit) {
static void construct_EM410x_emul(uint64_t id) { static void construct_EM410x_emul(uint64_t id) {
int i, j; int i, j;
int binary[4] = {0,0,0,0}; int binary[4] = {0, 0, 0, 0};
int parity[4] = {0,0,0,0}; int parity[4] = {0, 0, 0, 0};
buflen = 0; buflen = 0;
for (i = 0; i < 9; i++) for (i = 0; i < 9; i++)

View file

@ -100,8 +100,8 @@ static void fill_buff(uint8_t bit) {
static void construct_EM410x_emul(uint64_t id) { static void construct_EM410x_emul(uint64_t id) {
int i, j; int i, j;
int binary[4] = {0,0,0,0}; int binary[4] = {0, 0, 0, 0};
int parity[4] = {0,0,0,0}; int parity[4] = {0, 0, 0, 0};
buflen = 0; buflen = 0;
for (i = 0; i < 9; i++) for (i = 0; i < 9; i++)

View file

@ -67,8 +67,8 @@ static void fill_buff(uint8_t bit) {
static void construct_EM410x_emul(uint64_t id) { static void construct_EM410x_emul(uint64_t id) {
int i, j; int i, j;
int binary[4] = {0,0,0,0}; int binary[4] = {0, 0, 0, 0};
int parity[4] = {0,0,0,0}; int parity[4] = {0, 0, 0, 0};
buflen = 0; buflen = 0;
for (i = 0; i < 9; i++) for (i = 0; i < 9; i++)

View file

@ -1885,7 +1885,7 @@ void iClass_WriteBlock(uint8_t *msg) {
res = false; res = false;
switch_off(); switch_off();
if (payload->req.send_reply) if (payload->req.send_reply)
reply_ng(CMD_HF_ICLASS_WRITEBL, PM3_ETEAROFF, (uint8_t*)&res, sizeof(uint8_t)); reply_ng(CMD_HF_ICLASS_WRITEBL, PM3_ETEAROFF, (uint8_t *)&res, sizeof(uint8_t));
return; return;
} else { } else {
@ -1927,7 +1927,7 @@ out:
switch_off(); switch_off();
if (payload->req.send_reply) if (payload->req.send_reply)
reply_ng(CMD_HF_ICLASS_WRITEBL, PM3_SUCCESS, (uint8_t*)&res, sizeof(uint8_t)); reply_ng(CMD_HF_ICLASS_WRITEBL, PM3_SUCCESS, (uint8_t *)&res, sizeof(uint8_t));
} }
void iClass_Restore(iclass_restore_req_t *msg) { void iClass_Restore(iclass_restore_req_t *msg) {

View file

@ -579,7 +579,7 @@ static SIMDExecInstr GetSIMDInstr(void) {
instr = SIMD_MMX; instr = SIMD_MMX;
else else
#endif #endif
instr = SIMD_NONE; instr = SIMD_NONE;
return instr; return instr;
} }

View file

@ -202,7 +202,7 @@ static bool wait_cmd_14b(bool verbose, bool is_select) {
(crc) ? _GREEN_("ok") : _RED_("fail") (crc) ? _GREEN_("ok") : _RED_("fail")
); );
} else if (len == 0) { } else if (len == 0) {
PrintAndLogEx(INFO, "no response from tag"); PrintAndLogEx(INFO, "no response from tag");
} else { } else {
PrintAndLogEx(SUCCESS, "%s", sprint_hex(data, len)); PrintAndLogEx(SUCCESS, "%s", sprint_hex(data, len));
} }

View file

@ -267,10 +267,10 @@ static void lookupChipID(uint32_t iChipID, uint32_t mem_used) {
} }
PrintAndLogEx(NORMAL, " --= Nonvolatile program memory: " _YELLOW_("%uK") " bytes %s ( " _YELLOW_("%2.0f%%") " used )" PrintAndLogEx(NORMAL, " --= Nonvolatile program memory: " _YELLOW_("%uK") " bytes %s ( " _YELLOW_("%2.0f%%") " used )"
, mem_avail , mem_avail
, asBuff , asBuff
, mem_avail == 0 ? 0.0f : (float)mem_used / (mem_avail * 1024) * 100 , mem_avail == 0 ? 0.0f : (float)mem_used / (mem_avail * 1024) * 100
); );
switch ((iChipID & 0xF000) >> 12) { switch ((iChipID & 0xF000) >> 12) {
case 0: case 0:

View file

@ -239,11 +239,11 @@ int CmdLFCommandRead(const char *Cmd) {
int cmd_len = 128; int cmd_len = 128;
char cmd[128] = {0}; char cmd[128] = {0};
CLIGetStrWithReturn(ctx, 2, (uint8_t*)cmd, &cmd_len); CLIGetStrWithReturn(ctx, 2, (uint8_t *)cmd, &cmd_len);
int extra_arg_len = 250; int extra_arg_len = 250;
char extra_arg[250] = {0}; char extra_arg[250] = {0};
CLIGetStrWithReturn(ctx, 3, (uint8_t*)extra_arg, &extra_arg_len); CLIGetStrWithReturn(ctx, 3, (uint8_t *)extra_arg, &extra_arg_len);
uint16_t period_1 = arg_get_u32_def(ctx, 4, 0); uint16_t period_1 = arg_get_u32_def(ctx, 4, 0);
uint16_t period_0 = arg_get_u32_def(ctx, 5, 0); uint16_t period_0 = arg_get_u32_def(ctx, 5, 0);
@ -276,7 +276,7 @@ int CmdLFCommandRead(const char *Cmd) {
// extra symbol definition // extra symbol definition
uint8_t index_extra = 0; uint8_t index_extra = 0;
int i = 0; int i = 0;
for (; i < extra_arg_len; ) { for (; i < extra_arg_len;) {
if (index_extra < LF_CMDREAD_MAX_EXTRA_SYMBOLS - 1) { if (index_extra < LF_CMDREAD_MAX_EXTRA_SYMBOLS - 1) {
payload.symbol_extra[index_extra] = extra_arg[i]; payload.symbol_extra[index_extra] = extra_arg[i];
@ -516,7 +516,7 @@ int CmdLFConfig(const char *Cmd) {
} }
if (use_125 + use_134 > 1) { if (use_125 + use_134 > 1) {
PrintAndLogEx(ERR,"use only one of 125 or 134 params"); PrintAndLogEx(ERR, "use only one of 125 or 134 params");
return PM3_EINVARG; return PM3_EINVARG;
} }
@ -555,14 +555,14 @@ int CmdLFConfig(const char *Cmd) {
config.bits_per_sample = 8; config.bits_per_sample = 8;
} }
if ( dec > -1 ) { if (dec > -1) {
// decimation is limited to 8 // decimation is limited to 8
config.decimation = (dec & 0x0F); config.decimation = (dec & 0x0F);
if (config.decimation > 8) if (config.decimation > 8)
config.decimation = 8; config.decimation = 8;
} }
if ( div > -1 ) { if (div > -1) {
config.divisor = div; config.divisor = div;
if (config.divisor < 19) { if (config.divisor < 19) {
PrintAndLogEx(ERR, "divisor must be between 19 and 255"); PrintAndLogEx(ERR, "divisor must be between 19 and 255");
@ -570,7 +570,7 @@ int CmdLFConfig(const char *Cmd) {
} }
} }
if (freq > -1 ) { if (freq > -1) {
config.divisor = LF_FREQ2DIV(freq); config.divisor = LF_FREQ2DIV(freq);
if (config.divisor < 19) { if (config.divisor < 19) {
PrintAndLogEx(ERR, "freq must be between 47 and 600"); PrintAndLogEx(ERR, "freq must be between 47 and 600");
@ -862,7 +862,7 @@ int CmdLFfskSim(const char *Cmd) {
int raw_len = 64; int raw_len = 64;
char raw[64] = {0}; char raw[64] = {0};
CLIGetStrWithReturn(ctx, 5, (uint8_t*)raw, &raw_len); CLIGetStrWithReturn(ctx, 5, (uint8_t *)raw, &raw_len);
bool verbose = arg_get_lit(ctx, 6); bool verbose = arg_get_lit(ctx, 6);
CLIParserFree(ctx); CLIParserFree(ctx);
@ -972,7 +972,7 @@ int CmdLFaskSim(const char *Cmd) {
int raw_len = 64; int raw_len = 64;
char raw[64] = {0}; char raw[64] = {0};
CLIGetStrWithReturn(ctx, 7, (uint8_t*)raw, &raw_len); CLIGetStrWithReturn(ctx, 7, (uint8_t *)raw, &raw_len);
bool verbose = arg_get_lit(ctx, 8); bool verbose = arg_get_lit(ctx, 8);
CLIParserFree(ctx); CLIParserFree(ctx);
@ -1082,7 +1082,7 @@ int CmdLFpskSim(const char *Cmd) {
uint8_t carrier = arg_get_u32_def(ctx, 6, 2); uint8_t carrier = arg_get_u32_def(ctx, 6, 2);
int raw_len = 64; int raw_len = 64;
char raw[64] = {0}; char raw[64] = {0};
CLIGetStrWithReturn(ctx, 7, (uint8_t*)raw, &raw_len); CLIGetStrWithReturn(ctx, 7, (uint8_t *)raw, &raw_len);
bool verbose = arg_get_lit(ctx, 8); bool verbose = arg_get_lit(ctx, 8);
CLIParserFree(ctx); CLIParserFree(ctx);
@ -1120,7 +1120,7 @@ int CmdLFpskSim(const char *Cmd) {
int res = 0; int res = 0;
if (clk == 0) { if (clk == 0) {
res = GetPskClock("", verbose); res = GetPskClock("", verbose);
if ( res < 1) { if (res < 1) {
clk = 32; clk = 32;
} else { } else {
clk = (uint8_t)res; clk = (uint8_t)res;
@ -1128,12 +1128,12 @@ int CmdLFpskSim(const char *Cmd) {
} }
if (carrier == 0) { if (carrier == 0) {
res = GetPskCarrier(verbose); res = GetPskCarrier(verbose);
if (res < 1 ) { if (res < 1) {
carrier = 2; carrier = 2;
} else { } else {
carrier = (uint8_t)res; carrier = (uint8_t)res;
} }
} }
PrintAndLogEx(DEBUG, "Detected rf/%u, fc/%u, n %zu ", clk, carrier, DemodBufferLen); PrintAndLogEx(DEBUG, "Detected rf/%u, fc/%u, n %zu ", clk, carrier, DemodBufferLen);

View file

@ -1719,7 +1719,7 @@ static int CmdT55xxDangerousRaw(const char *Cmd) {
return PM3_EINVARG; return PM3_EINVARG;
} }
int bs_len = binstring2binarray(ng.data, (char*)bin, bin_len); int bs_len = binstring2binarray(ng.data, (char *)bin, bin_len);
if (bs_len == 0) { if (bs_len == 0) {
return PM3_EINVARG; return PM3_EINVARG;
} }
@ -2963,8 +2963,8 @@ static int CmdT55xxChkPwds(const char *Cmd) {
start index to call arg_add_t55xx_downloadlink() is 4 (1 + 3) given the above sample start index to call arg_add_t55xx_downloadlink() is 4 (1 + 3) given the above sample
*/ */
// 1 (help) + 3 (three user specified params) + (6 T55XX_DLMODE_ALL) // 1 (help) + 3 (three user specified params) + (6 T55XX_DLMODE_ALL)
void *argtable[4 + 6] = { void *argtable[4 + 6] = {
arg_param_begin, arg_param_begin,
arg_lit0("m", "fm", "use dictionary from flash memory (RDV4)"), arg_lit0("m", "fm", "use dictionary from flash memory (RDV4)"),
arg_str0("f", "file", "<filename>", "file name"), arg_str0("f", "file", "<filename>", "file name"),
@ -2980,7 +2980,7 @@ static int CmdT55xxChkPwds(const char *Cmd) {
char filename[FILE_PATH_SIZE] = {0}; char filename[FILE_PATH_SIZE] = {0};
CLIParamStrToBuf(arg_get_str(ctx, 2), (uint8_t *)filename, sizeof(filename), &fnlen); CLIParamStrToBuf(arg_get_str(ctx, 2), (uint8_t *)filename, sizeof(filename), &fnlen);
// White cloner password based on EM4100 ID // White cloner password based on EM4100 ID
bool use_calc_password = false; bool use_calc_password = false;
uint32_t card_password = 0x00; uint32_t card_password = 0x00;
uint64_t cardid = 0; uint64_t cardid = 0;
@ -3180,7 +3180,7 @@ static int CmdT55xxBruteForce(const char *Cmd) {
"lf t55xx bruteforce --r2 -s aaaaaa77 -e aaaaaa99\n" "lf t55xx bruteforce --r2 -s aaaaaa77 -e aaaaaa99\n"
); );
// 1 (help) + 2 (two user specified params) + (6 T55XX_DLMODE_ALL) // 1 (help) + 2 (two user specified params) + (6 T55XX_DLMODE_ALL)
void *argtable[3 + 6] = { void *argtable[3 + 6] = {
arg_param_begin, arg_param_begin,
arg_str1("s", "start", "<hex>", "search start password (4 hex bytes)"), arg_str1("s", "start", "<hex>", "search start password (4 hex bytes)"),
@ -3307,7 +3307,7 @@ static int CmdT55xxRecoverPW(const char *Cmd) {
"lf t55xx recoverpw -p 11223344 --r3\n" "lf t55xx recoverpw -p 11223344 --r3\n"
); );
// 1 (help) + 1 (one user specified params) + (6 T55XX_DLMODE_ALL) // 1 (help) + 1 (one user specified params) + (6 T55XX_DLMODE_ALL)
void *argtable[2 + 6] = { void *argtable[2 + 6] = {
arg_param_begin, arg_param_begin,
arg_str0("p", "pwd", "<hex>", "password (4 hex bytes)"), arg_str0("p", "pwd", "<hex>", "password (4 hex bytes)"),
@ -3547,7 +3547,7 @@ static int CmdT55xxDetectPage1(const char *Cmd) {
"lf t55xx p1detect -p 11223344 --r3\n" "lf t55xx p1detect -p 11223344 --r3\n"
); );
// 1 (help) + 2 (two user specified params) + (5 T55XX_DLMODE_SINGLE) // 1 (help) + 2 (two user specified params) + (5 T55XX_DLMODE_SINGLE)
void *argtable[3 + 5] = { void *argtable[3 + 5] = {
arg_param_begin, arg_param_begin,
arg_lit0("1", NULL, "extract using data from graphbuffer"), arg_lit0("1", NULL, "extract using data from graphbuffer"),
@ -3645,7 +3645,7 @@ static int CmdT55xxSetDeviceConfig(const char *Cmd) {
"lf t55xx deviceconfig -a 55 -b 14 -c 21 -d 30 -> default EM4305" "lf t55xx deviceconfig -a 55 -b 14 -c 21 -d 30 -> default EM4305"
); );
// 1 (help) + 9 (nine user specified params) + (5 T55XX_DLMODE_SINGLE) // 1 (help) + 9 (nine user specified params) + (5 T55XX_DLMODE_SINGLE)
void *argtable[10 + 5] = { void *argtable[10 + 5] = {
arg_param_begin, arg_param_begin,
arg_int0("a", NULL, "<8..255>", "Set start gap"), arg_int0("a", NULL, "<8..255>", "Set start gap"),

View file

@ -811,7 +811,7 @@ void binarraytobinstring(char *target, char *source, int length) {
*target = '\0'; *target = '\0';
} }
int binstring2binarray(uint8_t* target, char *source, int length) { int binstring2binarray(uint8_t *target, char *source, int length) {
int count = 0; int count = 0;
char *start = source; char *start = source;
while (length--) { while (length--) {

View file

@ -83,7 +83,7 @@ int hextobinarray(char *target, char *source);
int hextobinstring(char *target, char *source); int hextobinstring(char *target, char *source);
int binarraytohex(char *target, const size_t targetlen, char *source, size_t srclen); int binarraytohex(char *target, const size_t targetlen, char *source, size_t srclen);
void binarraytobinstring(char *target, char *source, int length); void binarraytobinstring(char *target, char *source, int length);
int binstring2binarray(uint8_t* target, char *source, int length); int binstring2binarray(uint8_t *target, char *source, int length);
uint8_t GetParity(uint8_t *bits, uint8_t type, int length); uint8_t GetParity(uint8_t *bits, uint8_t type, int length);
void wiegand_add_parity(uint8_t *target, uint8_t *source, uint8_t length); void wiegand_add_parity(uint8_t *target, uint8_t *source, uint8_t length);

View file

@ -586,22 +586,22 @@ static bool Pack_HGeneric37(wiegand_card_t *card, wiegand_message_t *packed, boo
// even1 // even1
set_bit_by_position(packed, set_bit_by_position(packed,
evenparity32( evenparity32(
get_nonlinear_field(packed, 8, (uint8_t[]) {4, 8, 12, 16, 20, 24, 28, 32})) get_nonlinear_field(packed, 8, (uint8_t[]) {4, 8, 12, 16, 20, 24, 28, 32}))
, 0 , 0
); );
// odd1 // odd1
set_bit_by_position(packed, set_bit_by_position(packed,
oddparity32( oddparity32(
get_nonlinear_field(packed, 8, (uint8_t[]) {6, 10, 14, 18, 22, 26, 30, 34})) get_nonlinear_field(packed, 8, (uint8_t[]) {6, 10, 14, 18, 22, 26, 30, 34}))
, 2 , 2
); );
// even2 // even2
set_bit_by_position(packed, set_bit_by_position(packed,
evenparity32( evenparity32(
get_nonlinear_field(packed, 8, (uint8_t[]) {7, 11, 15, 19, 23, 27, 31, 35})) get_nonlinear_field(packed, 8, (uint8_t[]) {7, 11, 15, 19, 23, 27, 31, 35}))
, 3 , 3
); );
if (preamble) if (preamble)
return add_HID_header(packed); return add_HID_header(packed);
return true; return true;

View file

@ -121,10 +121,10 @@ bool set_nonlinear_field(wiegand_message_t *data, uint64_t value, uint8_t numBit
} }
static uint8_t get_length_from_header(wiegand_message_t *data) { static uint8_t get_length_from_header(wiegand_message_t *data) {
/** /**
* detect if message has "preamble" / "sentinel bit" * detect if message has "preamble" / "sentinel bit"
* *
*/ */
uint8_t len = 0; uint8_t len = 0;

View file

@ -485,13 +485,13 @@ int mfc_algo_touch_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t *
if (key == NULL) return PM3_EINVARG; if (key == NULL) return PM3_EINVARG;
*key = ( *key = (
(uint64_t)(uid[1] ^ uid[2] ^ uid[3]) << 40 | (uint64_t)(uid[1] ^ uid[2] ^ uid[3]) << 40 |
(uint64_t)uid[1] << 32 | (uint64_t)uid[1] << 32 |
(uint64_t)uid[2] << 24 | (uint64_t)uid[2] << 24 |
(uint64_t)(((uid[0] + uid[1] + uid[2] + uid[3]) % 0x100) ^ uid[3]) << 16 | (uint64_t)(((uid[0] + uid[1] + uid[2] + uid[3]) % 0x100) ^ uid[3]) << 16 |
(uint64_t)0 << 8 | (uint64_t)0 << 8 |
(uint64_t)0 (uint64_t)0
); );
return PM3_SUCCESS; return PM3_SUCCESS;
} }

View file

@ -23,7 +23,7 @@ char *iso15693_sprintUID(char *dest, uint8_t *uid) {
sprintf(dest, "%02X %02X %02X %02X %02X %02X %02X %02X", sprintf(dest, "%02X %02X %02X %02X %02X %02X %02X %02X",
uid[7], uid[6], uid[5], uid[4], uid[7], uid[6], uid[5], uid[4],
uid[3], uid[2], uid[1], uid[0] uid[3], uid[2], uid[1], uid[0]
); );
} }
return dest; return dest;
} }

View file

@ -534,13 +534,13 @@ Check column "offline" for their availability.
|------- |------- |----------- |------- |------- |-----------
|`lf help `|Y |`This help` |`lf help `|Y |`This help`
|`lf config `|N |`Get/Set config for LF sampling, bit/sample, decimation, frequency` |`lf config `|N |`Get/Set config for LF sampling, bit/sample, decimation, frequency`
|`lf cmdread `|N |`Modulate LF reader field to send command before read (all periods in microseconds)` |`lf cmdread `|N |`Modulate LF reader field to send command before read`
|`lf read `|N |`Read LF tag` |`lf read `|N |`Read LF tag`
|`lf search `|Y |`Read and Search for valid known tag (in offline mode it you can load first then search)` |`lf search `|Y |`Read and Search for valid known tag`
|`lf sim `|N |`Simulate LF tag from buffer with optional GAP (in microseconds)` |`lf sim `|N |`Simulate LF tag from buffer`
|`lf simask `|N |`Simulate LF ASK tag from demodbuffer or input` |`lf simask `|N |`Simulate ASK tag`
|`lf simfsk `|N |`Simulate LF FSK tag from demodbuffer or input` |`lf simfsk `|N |`Simulate FSK tag`
|`lf simpsk `|N |`Simulate LF PSK tag from demodbuffer or input` |`lf simpsk `|N |`Simulate PSK tag`
|`lf simbidir `|N |`Simulate LF tag (with bidirectional data transmission between reader and tag)` |`lf simbidir `|N |`Simulate LF tag (with bidirectional data transmission between reader and tag)`
|`lf sniff `|N |`Sniff LF traffic between reader and tag` |`lf sniff `|N |`Sniff LF traffic between reader and tag`
|`lf tune `|N |`Continuously measure LF antenna tuning` |`lf tune `|N |`Continuously measure LF antenna tuning`

View file

@ -254,7 +254,7 @@ int discoverDevices(unsigned int profile_selected, uint32_t device_types_selecte
if (verbose) printf("%14s: %s\n", "Device Type", (device_type & CL_DEVICE_TYPE_GPU) ? "GPU" : (device_type & CL_DEVICE_TYPE_CPU) ? "CPU" : "Other"); if (verbose) printf("%14s: %s\n", "Device Type", (device_type & CL_DEVICE_TYPE_GPU) ? "GPU" : (device_type & CL_DEVICE_TYPE_CPU) ? "CPU" : "Other");
if ((*cd_ctx)[platform_idx].selected == false) (*cd_ctx)[platform_idx].device[device_idx].selected = false; if ((*cd_ctx)[platform_idx].selected == false)(*cd_ctx)[platform_idx].device[device_idx].selected = false;
else (*cd_ctx)[platform_idx].device[device_idx].selected = plat_dev_enabled(global_device_id, dev_sel, dev_cnt, (unsigned int) device_type, device_types_selected); else (*cd_ctx)[platform_idx].device[device_idx].selected = plat_dev_enabled(global_device_id, dev_sel, dev_cnt, (unsigned int) device_type, device_types_selected);
global_device_id++; global_device_id++;
if ((*cd_ctx)[platform_idx].device[device_idx].selected)(*selected_devices_cnt)++; if ((*cd_ctx)[platform_idx].device[device_idx].selected)(*selected_devices_cnt)++;