From 812d9cc46a68add6641c06ffacf234981d677a9a Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sat, 12 Sep 2020 00:31:17 +0200 Subject: [PATCH] style --- armsrc/iso14443a.c | 46 ++++++++++++++++++++--------------------- armsrc/mifarecmd.c | 6 +++--- client/src/cmdhfmf.c | 8 +++---- client/src/cmdlffdx.c | 26 +++++++++++------------ client/src/cmdlfguard.c | 2 +- 5 files changed, 44 insertions(+), 44 deletions(-) diff --git a/armsrc/iso14443a.c b/armsrc/iso14443a.c index 0b904be33..d7de0b554 100644 --- a/armsrc/iso14443a.c +++ b/armsrc/iso14443a.c @@ -1077,7 +1077,7 @@ bool SimulateIso14443aInit(int tagType, int flags, uint8_t *data, tag_response_i sak = 0x00; } break; - + default: { if (DBGLEVEL >= DBG_ERROR) Dbprintf("Error: unknown tagtype (%d)", tagType); return false; @@ -1131,16 +1131,16 @@ bool SimulateIso14443aInit(int tagType, int flags, uint8_t *data, tag_response_i // Calculate BCC for the first 4 bytes of the UID. rUIDc1[4] = rUIDc1[0] ^ rUIDc1[1] ^ rUIDc1[2] ^ rUIDc1[3]; - + if (tagType == 10) { rSAKc1[0] = 0x04; rSAKc2[0] = 0x20; - } else { + } else { rSAKc1[0] = sak; rSAKc2[0] = sak & 0xFB; } - // crc + // crc AddCrc14A(rSAKc1, sizeof(rSAKc1) - 2); AddCrc14A(rSAKc2, sizeof(rSAKc2) - 2); @@ -1151,7 +1151,7 @@ bool SimulateIso14443aInit(int tagType, int flags, uint8_t *data, tag_response_i AddCrc14A(rRATS, sizeof(rRATS) - 2); AddCrc14A(rPPS, sizeof(rPPS) - 2); - + #define TAG_RESPONSE_COUNT 9 static tag_response_info_t responses_init[TAG_RESPONSE_COUNT] = { { .response = rATQA, .response_n = sizeof(rATQA) }, // Answer to request - respond with card type @@ -1257,7 +1257,7 @@ void SimulateIso14443aTag(uint8_t tagType, uint8_t flags, uint8_t *data) { iso14443a_setup(FPGA_HF_ISO14443A_TAGSIM_LISTEN); iso14a_set_timeout(201400); // 106 * 19ms default - + int len = 0; // To control where we are in the protocol @@ -1283,19 +1283,19 @@ void SimulateIso14443aTag(uint8_t tagType, uint8_t flags, uint8_t *data) { // compatible write block number uint8_t wrblock = 0; - + bool odd_reply = true; clear_trace(); set_tracing(true); LED_A_ON(); - + // main loop for (;;) { WDT_HIT(); tag_response_info_t *p_response = NULL; - + // Clean receive command buffer if (GetIso14443aCommandFromReader(receivedCmd, receivedCmdPar, &len) == false) { Dbprintf("Emulator stopped. Trace length: %d ", BigBuf_get_traceLen()); @@ -1580,17 +1580,17 @@ void SimulateIso14443aTag(uint8_t tagType, uint8_t flags, uint8_t *data) { AddCrc14A(cmd, sizeof(cmd) - 2); EmSendCmd(cmd, sizeof(cmd)); p_response = NULL; - + } else { // clear old dynamic responses dynamic_response_info.response_n = 0; dynamic_response_info.modulation_n = 0; - + // ST25TA512B IKEA Rothult if (tagType == 10) { // we replay 90 00 for all commands but the read bin and we deny the verify cmd. - + if (memcmp("\x02\xa2\xb0\x00\x00\x1d\x51\x69", receivedCmd, 8) == 0) { dynamic_response_info.response[0] = receivedCmd[0]; memcpy(dynamic_response_info.response + 1, "\x00\x1b\xd1\x01\x17\x54\x02\x7a\x68\xa2\x34\xcb\xd0\xe2\x03\xc7\x3e\x62\x0b\xe8\xc6\x3c\x85\x2c\xc5\x31\x31\x31\x32\x90\x00", 31); @@ -2021,11 +2021,11 @@ int EmSendCmd14443aRaw(uint8_t *resp, uint16_t respLen) { while (!(AT91C_BASE_SSC->SSC_SR & AT91C_SSC_RXRDY)); b = AT91C_BASE_SSC->SSC_RHR; (void) b; -/* - while (!(AT91C_BASE_SSC->SSC_SR & AT91C_SSC_TXRDY)); - b = AT91C_BASE_SSC->SSC_THR; - (void) b; -*/ + /* + while (!(AT91C_BASE_SSC->SSC_SR & AT91C_SSC_TXRDY)); + b = AT91C_BASE_SSC->SSC_THR; + (void) b; + */ // wait for the FPGA to signal fdt_indicator == 1 (the FPGA is ready to queue new data in its delay line) for (uint8_t j = 0; j < 5; j++) { // allow timeout - better late than never @@ -2045,12 +2045,12 @@ int EmSendCmd14443aRaw(uint8_t *resp, uint16_t respLen) { FpgaSendQueueDelay = (uint8_t)AT91C_BASE_SSC->SSC_RHR; } -/* - if (AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) { - b = (uint16_t)(AT91C_BASE_SSC->SSC_RHR); - (void)b; - } - */ + /* + if (AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) { + b = (uint16_t)(AT91C_BASE_SSC->SSC_RHR); + (void)b; + } + */ } // Ensure that the FPGA Delay Queue is empty before we switch to TAGSIM_LISTEN again: diff --git a/armsrc/mifarecmd.c b/armsrc/mifarecmd.c index 9ee47f19f..53e33ff38 100644 --- a/armsrc/mifarecmd.c +++ b/armsrc/mifarecmd.c @@ -2287,7 +2287,7 @@ void MifareCIdent(void) { res = ReaderReceive(buf, par); if (res == 22) { isGen = MAGIC_SUPER; - goto OUT; + goto OUT; } isGen = MAGIC_GEN_2; @@ -2322,7 +2322,7 @@ void MifareCIdent(void) { isGen = MAGIC_GEN_2; goto OUT; } - + // magic ntag test FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); SpinDelay(40); @@ -2369,7 +2369,7 @@ void MifareHasStaticNonce(void) { struct Crypto1State mpcs = {0, 0}; struct Crypto1State *pcs; pcs = &mpcs; - + iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN); uint8_t counter = 0; diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index 7e635b503..c62629b6f 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -995,7 +995,7 @@ static int CmdHF14AMfDump(const char *Cmd) { PrintAndLogEx(WARNING, "Could not find file " _YELLOW_("%s"), keyFilename); return PM3_EFILE; } - + PrintAndLogEx(INFO, "Using `" _YELLOW_("%s") "`", keyFilename); // Read keys A from file @@ -3169,7 +3169,7 @@ static int CmdHF14AMfChk(const char *Cmd) { PrintAndLogEx(NORMAL, "." NOLF); fflush(stdout); - + if (kbd_enter_pressed()) { PrintAndLogEx(INFO, "\naborted via keyboard!\n"); goto out; @@ -3748,7 +3748,7 @@ int CmdHF14AMfELoad(const char *Cmd) { } PrintAndLogEx(NORMAL, "." NOLF); fflush(stdout); - + blockNum++; counter += blockWidth; datalen -= blockWidth; @@ -4525,7 +4525,7 @@ static int CmdHF14AMfCView(const char *Cmd) { free(dump); return PM3_ESOFT; } - + PrintAndLogEx(NORMAL, "." NOLF); fflush(stdout); } diff --git a/client/src/cmdlffdx.c b/client/src/cmdlffdx.c index 2bb3b274c..af4f316ae 100644 --- a/client/src/cmdlffdx.c +++ b/client/src/cmdlffdx.c @@ -232,7 +232,7 @@ int demodFDX(void) { setDemodBuff(DemodBuffer, 128, preambleIndex); setClockGrid(g_DemodClock, g_DemodStartIdx + (preambleIndex * g_DemodClock)); - + // remove marker bits (1's every 9th digit after preamble) (pType = 2) size = removeParity(DemodBuffer, 11, 9, 2, 117); if (size != 104) { @@ -246,21 +246,21 @@ int demodFDX(void) { offset = 38; uint16_t countryCode = bytebits_to_byteLSBF(DemodBuffer + offset, 10); - + offset += 10; uint8_t dataBlockBit = DemodBuffer[offset]; - + offset++; uint32_t reservedCode = bytebits_to_byteLSBF(DemodBuffer + offset, 14); - + offset += 14; uint8_t animalBit = DemodBuffer[offset]; - + offset++; uint16_t crc = bytebits_to_byteLSBF(DemodBuffer + offset, 16); - + offset += 16; - uint32_t extended = bytebits_to_byteLSBF(DemodBuffer + offset, 24); + uint32_t extended = bytebits_to_byteLSBF(DemodBuffer + offset, 24); uint64_t rawid = (uint64_t)(bytebits_to_byte(DemodBuffer, 32)) << 32 | bytebits_to_byte(DemodBuffer + 32, 32); uint8_t raw[8]; @@ -389,13 +389,13 @@ static int CmdFdxClone(const char *Cmd) { } } if (errors || strlen(Cmd) == 0) return usage_lf_fdx_clone(); - + verify_values(&national_code, &country_code, &extended, &is_animal); PrintAndLogEx(INFO, " Country code %"PRIu32, country_code); PrintAndLogEx(INFO, " National code %"PRIu64, national_code); - PrintAndLogEx(INFO, " Set animal bit %c", (is_animal) ? 'Y':'N'); - PrintAndLogEx(INFO, "Set data block bit %c", (has_extended) ? 'Y':'N'); + PrintAndLogEx(INFO, " Set animal bit %c", (is_animal) ? 'Y' : 'N'); + PrintAndLogEx(INFO, "Set data block bit %c", (has_extended) ? 'Y' : 'N'); PrintAndLogEx(INFO, " Extended data 0x%"PRIX32, extended); PrintAndLogEx(INFO, " RFU 0"); @@ -469,13 +469,13 @@ static int CmdFdxSim(const char *Cmd) { } } if (errors) return usage_lf_fdx_sim(); - + verify_values(&national_code, &country_code, &extended, &is_animal); PrintAndLogEx(INFO, " Country code %"PRIu32, country_code); PrintAndLogEx(INFO, " National code %"PRIu64, national_code); - PrintAndLogEx(INFO, " Set animal bit %c", (is_animal) ? 'Y':'N'); - PrintAndLogEx(INFO, "Set data block bit %c", (has_extended) ? 'Y':'N'); + PrintAndLogEx(INFO, " Set animal bit %c", (is_animal) ? 'Y' : 'N'); + PrintAndLogEx(INFO, "Set data block bit %c", (has_extended) ? 'Y' : 'N'); PrintAndLogEx(INFO, " Extended data 0x%"PRIX32, extended); PrintAndLogEx(INFO, " RFU 0"); diff --git a/client/src/cmdlfguard.c b/client/src/cmdlfguard.c index 6bb566c0d..83a34d5fe 100644 --- a/client/src/cmdlfguard.c +++ b/client/src/cmdlfguard.c @@ -356,7 +356,7 @@ int getGuardBits(uint8_t fmtlen, uint32_t fc, uint32_t cn, uint8_t *guardBits) { rawbytes[i + 4] = bytebits_to_byte(pre + (i * 8), 8); PrintAndLogEx(DEBUG, " WIE | %s", sprint_hex(rawbytes, sizeof(rawbytes))); - + // XOR (only works on wiegand stuff) for (i = 1; i < sizeof(rawbytes); ++i) rawbytes[i] ^= xorKey ;