From 7c33eeb7d5e448fe8b512c3da80a3ba941685a9c Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Wed, 15 Jan 2020 19:25:29 +0100 Subject: [PATCH] style --- armsrc/iso14443b.c | 2 +- armsrc/mifarecmd.c | 4 ++-- armsrc/mifaresim.c | 2 +- client/cmdhfmf.c | 6 +++--- client/cmdlfnexwatch.c | 4 ++-- client/mifare/mifarehost.c | 20 ++++++++++---------- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/armsrc/iso14443b.c b/armsrc/iso14443b.c index 342c68471..d68ddd044 100644 --- a/armsrc/iso14443b.c +++ b/armsrc/iso14443b.c @@ -1167,7 +1167,7 @@ uint8_t iso14443b_apdu(uint8_t const *message, size_t message_length, uint8_t *r GetTagSamplesFor14443bDemod(); //no FpgaDisableTracing(); - + if (Demod.len < 3) return 0; diff --git a/armsrc/mifarecmd.c b/armsrc/mifarecmd.c index 4d7138565..a0ce705be 100644 --- a/armsrc/mifarecmd.c +++ b/armsrc/mifarecmd.c @@ -1157,7 +1157,7 @@ void MifareStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t targetBlockNo, retry--; continue; }; - + // second authentication. Nested auth len = mifare_sendcmd_short(pcs, AUTH_NESTED, 0x60 + (targetKeyType & 0x01), targetBlockNo, receivedAnswer, par, NULL); if (len != 4) { @@ -1200,7 +1200,7 @@ void MifareStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t targetBlockNo, FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); LEDsoff(); - set_tracing(false); + set_tracing(false); } //----------------------------------------------------------------------------- // MIFARE check keys. key count up to 85. diff --git a/armsrc/mifaresim.c b/armsrc/mifaresim.c index 3f89cb029..80881c416 100644 --- a/armsrc/mifaresim.c +++ b/armsrc/mifaresim.c @@ -916,7 +916,7 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t *datain, uint1 if (DBGLEVEL >= DBG_EXTENDED) Dbprintf("[MFEMUL_WORK] RECV 0xA0 write block %d (%02x)", blockNo, blockNo); EmSend4bit(mf_crypto1_encrypt4bit(pcs, CARD_ACK)); FpgaDisableTracing(); - + cardWRBL = blockNo; cardSTATE = MFEMUL_WRITEBL2; if (DBGLEVEL >= DBG_EXTENDED) Dbprintf("[MFEMUL_WORK] cardSTATE = MFEMUL_WRITEBL2"); diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index d48a1fe1e..173184592 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -1578,7 +1578,7 @@ static int CmdHF14AMfNestedStatic(const char *Cmd) { for (trgKeyType = 0; trgKeyType < 2; ++trgKeyType) { for (uint8_t sectorNo = 0; sectorNo < SectorsCnt; ++sectorNo) { - for (int i = 0; i < 1; i++) { + for (int i = 0; i < 1; i++) { if (e_sector[sectorNo].foundKey[trgKeyType]) continue; @@ -3557,12 +3557,12 @@ void printKeyTableEx(uint8_t sectorscnt, sector_t *e_sector, uint8_t start_secto , strB, e_sector[i].foundKey[1] ); } else { - + // keep track if we use start_sector or i... uint8_t s = start_sector; if (start_sector == 0) s = i; - + PrintAndLogEx(NORMAL, "|%03d| %s | " _YELLOW_("%d")"| %s | " _YELLOW_("%d")"|" , s , strA, e_sector[i].foundKey[0] diff --git a/client/cmdlfnexwatch.c b/client/cmdlfnexwatch.c index 69f429ab6..68be0e0bc 100644 --- a/client/cmdlfnexwatch.c +++ b/client/cmdlfnexwatch.c @@ -192,13 +192,13 @@ static int CmdNexWatchSim(const char *Cmd) { } if (errors || cmdp == 0) return usage_lf_nexwatch_sim(); - + // hex to bits. for (size_t i = 0; i < ARRAYLEN(rawblocks); i++) { rawblocks[i] = bytes_to_num(rawhex + (i * sizeof(uint32_t)), sizeof(uint32_t)); num_to_bytebits(rawblocks[i], sizeof(uint32_t) * 8, bs + (i * sizeof(uint32_t) * 8)); } - + PrintAndLogEx(SUCCESS, "Simulating NexWatch - raw: %s", sprint_hex_inrow(rawhex, rawlen)); lf_psksim_t *payload = calloc(1, sizeof(lf_psksim_t) + sizeof(bs)); diff --git a/client/mifare/mifarehost.c b/client/mifare/mifarehost.c index 795d9eec7..5ba245070 100644 --- a/client/mifare/mifarehost.c +++ b/client/mifare/mifarehost.c @@ -563,14 +563,14 @@ int mfStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBl // create key candidates. while (p1 <= statelists[0].tail.sltail) { - struct Crypto1State savestate; - savestate = *p1; - while (Compare16Bits(p1, &savestate) == 0 && p1 <= statelists[0].tail.sltail) { - *p3 = *p1; - lfsr_rollback_word(p3, statelists[0].nt_enc ^ statelists[0].uid, 0); - p3++; - p1++; - } + struct Crypto1State savestate; + savestate = *p1; + while (Compare16Bits(p1, &savestate) == 0 && p1 <= statelists[0].tail.sltail) { + *p3 = *p1; + lfsr_rollback_word(p3, statelists[0].nt_enc ^ statelists[0].uid, 0); + p3++; + p1++; + } } *(uint64_t *)p3 = -1; @@ -581,14 +581,14 @@ int mfStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBl if (keycnt == 0) goto out; PrintAndLogEx(SUCCESS, "Found " _YELLOW_("%u") "candidate keys", keycnt); - + memset(resultKey, 0, 6); uint64_t key64 = -1; // The list may still contain several key candidates. Test each of them with mfCheckKeys uint32_t max_keys_slice = keycnt > KEYS_IN_BLOCK ? KEYS_IN_BLOCK : keycnt; uint8_t keyBlock[PM3_CMD_DATA_SIZE] = {0x00}; - + for (i = 0; i < keycnt; i += max_keys_slice) { PrintAndLogEx(INFO, "Testing %u / %u ", i, keycnt);