mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
make style
This commit is contained in:
parent
ed47ca7186
commit
b0dbbd3683
15 changed files with 55 additions and 56 deletions
|
@ -347,9 +347,9 @@ void SendVersion(void) {
|
|||
strncat(VersionString, temp, sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
|
||||
#if defined(__clang__)
|
||||
strncat(VersionString, " compiled with Clang/LLVM "__VERSION__"\n", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
strncat(VersionString, " compiled with Clang/LLVM "__VERSION__"\n", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
#elif defined(__GNUC__) || defined(__GNUG__)
|
||||
strncat(VersionString, " compiled with GCC "__VERSION__"\n", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
strncat(VersionString, " compiled with GCC "__VERSION__"\n", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
#endif
|
||||
|
||||
strncat(VersionString, "\n [ FPGA ]\n ", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
|
|
|
@ -434,7 +434,7 @@ static bool hitag2_password(uint8_t *rx, const size_t rxlen, uint8_t *tx, size_t
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -136,11 +136,11 @@ uint32_t DoAcquisition(uint8_t decimation, uint32_t bits_per_sample, bool averag
|
|||
uint32_t sample_total_numbers = 0;
|
||||
uint32_t sample_total_saved = 0;
|
||||
uint32_t cancel_counter = 0;
|
||||
|
||||
|
||||
uint16_t checker = 0;
|
||||
|
||||
|
||||
while (true) {
|
||||
if ( checker == 1000 ) {
|
||||
if (checker == 1000) {
|
||||
if (BUTTON_PRESS() || data_available())
|
||||
break;
|
||||
else
|
||||
|
@ -148,7 +148,7 @@ uint32_t DoAcquisition(uint8_t decimation, uint32_t bits_per_sample, bool averag
|
|||
} else {
|
||||
++checker;
|
||||
}
|
||||
|
||||
|
||||
WDT_HIT();
|
||||
|
||||
if (AT91C_BASE_SSC->SSC_SR & AT91C_SSC_RXRDY) {
|
||||
|
@ -293,11 +293,11 @@ void doT55x7Acquisition(size_t sample_size) {
|
|||
bool startFound = false;
|
||||
bool highFound = false;
|
||||
bool lowFound = false;
|
||||
|
||||
|
||||
uint16_t checker = 0;
|
||||
|
||||
while ( skipCnt < 1000 && (i < bufsize)) {
|
||||
if ( checker == 1000 ) {
|
||||
|
||||
while (skipCnt < 1000 && (i < bufsize)) {
|
||||
if (checker == 1000) {
|
||||
if (BUTTON_PRESS() || data_available())
|
||||
break;
|
||||
else
|
||||
|
@ -371,9 +371,9 @@ void doCotagAcquisition(size_t sample_size) {
|
|||
uint16_t noise_counter = 0;
|
||||
|
||||
uint16_t checker = 0;
|
||||
|
||||
|
||||
while ((i < bufsize) && (noise_counter < (COTAG_T1 << 1))) {
|
||||
if ( checker == 1000 ) {
|
||||
if (checker == 1000) {
|
||||
if (BUTTON_PRESS() || data_available())
|
||||
break;
|
||||
else
|
||||
|
@ -431,9 +431,9 @@ uint32_t doCotagAcquisitionManchester() {
|
|||
uint8_t curr = 0, prev = 0;
|
||||
uint16_t noise_counter = 0;
|
||||
uint16_t checker = 0;
|
||||
|
||||
|
||||
while ((sample_counter < bufsize) && (noise_counter < (COTAG_T1 << 1))) {
|
||||
if ( checker == 1000 ) {
|
||||
if (checker == 1000) {
|
||||
if (BUTTON_PRESS() || data_available())
|
||||
break;
|
||||
else
|
||||
|
|
|
@ -606,8 +606,8 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t *datain) {
|
|||
if (receivedCmd_len == 9 && receivedCmd[1] == 0x70) {
|
||||
if (memcmp(&receivedCmd[2], responses[uid_index].response, 4) == 0) {
|
||||
bool cl_finished = (uid_len == 4 && uid_index == UIDBCC1) ||
|
||||
(uid_len == 7 && uid_index == UIDBCC2) ||
|
||||
(uid_len == 10 && uid_index == UIDBCC3);
|
||||
(uid_len == 7 && uid_index == UIDBCC2) ||
|
||||
(uid_len == 10 && uid_index == UIDBCC3);
|
||||
EmSendPrecompiledCmd(&responses[cl_finished ? SAK : SAKuid]);
|
||||
if (DBGLEVEL >= DBG_EXTENDED) Dbprintf("SELECT CLx %02x%02x%02x%02x received", receivedCmd[2], receivedCmd[3], receivedCmd[4], receivedCmd[5]);
|
||||
if (cl_finished) {
|
||||
|
|
|
@ -122,7 +122,7 @@ void UsbPacketReceived(uint8_t *packet, int len) {
|
|||
switch (c->cmd) {
|
||||
case CMD_DEVICE_INFO: {
|
||||
dont_ack = 1;
|
||||
arg0 = DEVICE_INFO_FLAG_BOOTROM_PRESENT |
|
||||
arg0 = DEVICE_INFO_FLAG_BOOTROM_PRESENT |
|
||||
DEVICE_INFO_FLAG_CURRENT_MODE_BOOTROM |
|
||||
DEVICE_INFO_FLAG_UNDERSTANDS_START_FLASH |
|
||||
DEVICE_INFO_FLAG_UNDERSTANDS_CHIP_INFO;
|
||||
|
|
|
@ -1348,7 +1348,7 @@ static int CmdHF15CSetUID(const char *Cmd) {
|
|||
data[3][5] = uid[1];
|
||||
data[3][6] = uid[0];
|
||||
|
||||
for (int i=0; i<4; i++) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
AddCrc15(data[i], 7);
|
||||
|
||||
clearCommandBuffer();
|
||||
|
|
|
@ -957,7 +957,7 @@ static bool CheckChipType(bool getDeviceData) {
|
|||
retval = true;
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
//check for t55xx chip...
|
||||
if (tryDetectP1(true)) {
|
||||
PrintAndLogEx(SUCCESS, "\nChipset detection : " _GREEN_("T55xx") "found");
|
||||
|
@ -1084,8 +1084,8 @@ int CmdLFfind(const char *Cmd) {
|
|||
}
|
||||
out:
|
||||
// identify chipset
|
||||
if ( CheckChipType(isOnline) == false ) {
|
||||
PrintAndLogEx(DEBUG, "Automatic chip type detection " _RED_("failed") );
|
||||
if (CheckChipType(isOnline) == false) {
|
||||
PrintAndLogEx(DEBUG, "Automatic chip type detection " _RED_("failed"));
|
||||
}
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -1373,10 +1373,10 @@ static void printEM4x05config(uint32_t wordData) {
|
|||
PrintAndLogEx(NORMAL, " PSK CF: %u | %s", PSKcf, cf);
|
||||
PrintAndLogEx(NORMAL, " Delay: %u | %s", delay, cdelay);
|
||||
PrintAndLogEx(NORMAL, " LastWordR: %02u | Address of last word for default read - meaning %u blocks are output", LWR, numblks);
|
||||
PrintAndLogEx(NORMAL, " ReadLogin: %u | Read login is %s", readLogin, readLogin ? _YELLOW_("required") : _GREEN_("not required") );
|
||||
PrintAndLogEx(NORMAL, " ReadHKL: %u | Read housekeeping words login is %s", readHKL, readHKL ? _YELLOW_("required") : _GREEN_("not required") );
|
||||
PrintAndLogEx(NORMAL, "WriteLogin: %u | Write login is %s", writeLogin, writeLogin ? _YELLOW_("required") : _GREEN_("not required") );
|
||||
PrintAndLogEx(NORMAL, " WriteHKL: %u | Write housekeeping words login is %s", writeHKL, writeHKL ? _YELLOW_("required") : _GREEN_("not Required") );
|
||||
PrintAndLogEx(NORMAL, " ReadLogin: %u | Read login is %s", readLogin, readLogin ? _YELLOW_("required") : _GREEN_("not required"));
|
||||
PrintAndLogEx(NORMAL, " ReadHKL: %u | Read housekeeping words login is %s", readHKL, readHKL ? _YELLOW_("required") : _GREEN_("not required"));
|
||||
PrintAndLogEx(NORMAL, "WriteLogin: %u | Write login is %s", writeLogin, writeLogin ? _YELLOW_("required") : _GREEN_("not required"));
|
||||
PrintAndLogEx(NORMAL, " WriteHKL: %u | Write housekeeping words login is %s", writeHKL, writeHKL ? _YELLOW_("required") : _GREEN_("not Required"));
|
||||
PrintAndLogEx(NORMAL, " R.A.W.: %u | Read after write is %s", raw, raw ? "on" : "off");
|
||||
PrintAndLogEx(NORMAL, " Disable: %u | Disable command is %s", disable, disable ? "accepted" : "not accepted");
|
||||
PrintAndLogEx(NORMAL, " R.T.F.: %u | Reader talk first is %s", rtf, rtf ? _YELLOW_("enabled") : "disabled");
|
||||
|
@ -1396,7 +1396,7 @@ static void printEM4x05info(uint32_t block0, uint32_t serial) {
|
|||
snprintf(ctstr + strlen(ctstr), sizeof(ctstr) - strlen(ctstr), _YELLOW_("%s"), "EM4305");
|
||||
break;
|
||||
case 8:
|
||||
snprintf(ctstr + strlen(ctstr), sizeof(ctstr) - strlen(ctstr), _YELLOW_("%s"), "EM4205");
|
||||
snprintf(ctstr + strlen(ctstr), sizeof(ctstr) - strlen(ctstr), _YELLOW_("%s"), "EM4205");
|
||||
break;
|
||||
case 4:
|
||||
snprintf(ctstr + strlen(ctstr), sizeof(ctstr) - strlen(ctstr), _YELLOW_("%s"), "Unknown");
|
||||
|
|
|
@ -2153,7 +2153,7 @@ bool tryDetectP1(bool getData) {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// try ask clock detect. it could be another type even if successful.
|
||||
clk = GetAskClock("", false);
|
||||
if (clk > 0) {
|
||||
|
@ -2162,14 +2162,14 @@ bool tryDetectP1(bool getData) {
|
|||
(DemodBufferLen == 32 || DemodBufferLen == 64)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
st = true;
|
||||
if ((ASKDemod_ext("0 1 1", false, false, 1, &st) == PM3_SUCCESS) &&
|
||||
preambleSearchEx(DemodBuffer, preamble, sizeof(preamble), &DemodBufferLen, &startIdx, false) &&
|
||||
(DemodBufferLen == 32 || DemodBufferLen == 64)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if ((ASKbiphaseDemod("0 0 0 2", false) == PM3_SUCCESS) &&
|
||||
preambleSearchEx(DemodBuffer, preamble, sizeof(preamble), &DemodBufferLen, &startIdx, false) &&
|
||||
(DemodBufferLen == 32 || DemodBufferLen == 64)) {
|
||||
|
@ -2182,7 +2182,7 @@ bool tryDetectP1(bool getData) {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// try NRZ clock detect. it could be another type even if successful.
|
||||
clk = GetNrzClock("", false); //has the most false positives :(
|
||||
if (clk > 0) {
|
||||
|
|
|
@ -314,7 +314,7 @@ static int CmdUsartBtFactory(const char *Cmd) {
|
|||
PrintAndLogEx(WARNING, "Is the add-on blue light blinking? (Say 'n' if you want to abort) [y/n]");
|
||||
|
||||
char input[3];
|
||||
if ((fgets(input,sizeof(input),stdin) == NULL) || (strncmp(input, "y\n", sizeof(input)) != 0)) {
|
||||
if ((fgets(input, sizeof(input), stdin) == NULL) || (strncmp(input, "y\n", sizeof(input)) != 0)) {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(FAILED, "Aborting.");
|
||||
return PM3_EOPABORTED;
|
||||
|
|
|
@ -136,7 +136,7 @@ static void SendCommandNG_internal(uint16_t cmd, uint8_t *data, size_t len, bool
|
|||
txBufferNG.pre.ng = ng;
|
||||
txBufferNG.pre.length = len;
|
||||
txBufferNG.pre.cmd = cmd;
|
||||
if ( len > 0 && data )
|
||||
if (len > 0 && data)
|
||||
memcpy(&txBufferNG.data, data, len);
|
||||
|
||||
if ((conn.send_via_fpc_usart && conn.send_with_crc_on_fpc) || ((!conn.send_via_fpc_usart) && conn.send_with_crc_on_usb)) {
|
||||
|
|
|
@ -6,18 +6,18 @@
|
|||
#define SLEEP_H__
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#define msleep(n) Sleep(n)
|
||||
#include <windows.h>
|
||||
#define msleep(n) Sleep(n)
|
||||
#else
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
static void nsleep(uint64_t n) {
|
||||
struct timespec timeout;
|
||||
timeout.tv_sec = n / 1000000000;
|
||||
timeout.tv_nsec = n % 1000000000;
|
||||
while (nanosleep(&timeout, &timeout) && errno == EINTR);
|
||||
}
|
||||
#define msleep(n) nsleep(1000000 * (uint64_t)n)
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
static void nsleep(uint64_t n) {
|
||||
struct timespec timeout;
|
||||
timeout.tv_sec = n / 1000000000;
|
||||
timeout.tv_nsec = n % 1000000000;
|
||||
while (nanosleep(&timeout, &timeout) && errno == EINTR);
|
||||
}
|
||||
#define msleep(n) nsleep(1000000 * (uint64_t)n)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -347,7 +347,7 @@ static int wait_for_ack(PacketResponseNG *ack) {
|
|||
}
|
||||
|
||||
// Go into flashing mode
|
||||
int flash_start_flashing(int enable_bl_writes, char *serial_port_name, uint32_t * chipinfo) {
|
||||
int flash_start_flashing(int enable_bl_writes, char *serial_port_name, uint32_t *chipinfo) {
|
||||
uint32_t state;
|
||||
|
||||
if (enter_bootloader(serial_port_name) < 0)
|
||||
|
|
|
@ -61,8 +61,7 @@ int kbd_enter_pressed(void) {
|
|||
#include <conio.h>
|
||||
int kbd_enter_pressed(void) {
|
||||
int ret = 0;
|
||||
while(kbhit())
|
||||
{
|
||||
while (kbhit()) {
|
||||
ret |= getch() == '\r';
|
||||
}
|
||||
return ret;
|
||||
|
@ -178,8 +177,8 @@ bool CheckStringIsHEXValue(const char *value) {
|
|||
void hex_to_buffer(const uint8_t *buf, const uint8_t *hex_data, const size_t hex_len, const size_t hex_max_len,
|
||||
const size_t min_str_len, const size_t spaces_between, bool uppercase) {
|
||||
|
||||
if (buf == NULL ) return;
|
||||
|
||||
if (buf == NULL) return;
|
||||
|
||||
char *tmp = (char *)buf;
|
||||
size_t i;
|
||||
memset(tmp, 0x00, hex_max_len);
|
||||
|
@ -205,16 +204,16 @@ void hex_to_buffer(const uint8_t *buf, const uint8_t *hex_data, const size_t hex
|
|||
|
||||
// printing and converting functions
|
||||
void print_hex(const uint8_t *data, const size_t len) {
|
||||
if (data == NULL || len == 0 ) return;
|
||||
|
||||
if (data == NULL || len == 0) return;
|
||||
|
||||
for (size_t i = 0; i < len; i++)
|
||||
printf("%02x ", data[i]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void print_hex_break(const uint8_t *data, const size_t len, uint8_t breaks) {
|
||||
if (data == NULL || len == 0 ) return;
|
||||
|
||||
if (data == NULL || len == 0) return;
|
||||
|
||||
int rownum = 0;
|
||||
printf("[%02d] | ", rownum);
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
|
|
|
@ -103,7 +103,7 @@ void computeSignalProperties(uint8_t *samples, uint32_t size) {
|
|||
// we can detect noise
|
||||
signalprop.isnoise = signalprop.amplitude < NOISE_AMPLITUDE_THRESHOLD;
|
||||
|
||||
if (g_debugMode)
|
||||
if (g_debugMode)
|
||||
printSignal();
|
||||
}
|
||||
|
||||
|
@ -1365,8 +1365,8 @@ static int millerRawDecode(uint8_t *bits, size_t *size, int invert) {
|
|||
int BiphaseRawDecode(uint8_t *bits, size_t *size, int *offset, int invert) {
|
||||
//sanity check
|
||||
if (*size < 51) return -1;
|
||||
|
||||
if ( *offset < 0 ) *offset = 0;
|
||||
|
||||
if (*offset < 0) *offset = 0;
|
||||
|
||||
uint16_t bitnum = 0;
|
||||
uint16_t errCnt = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue