From 317ddf42bc0748187c40ca76887da3d201351143 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sun, 20 Nov 2022 16:47:49 +0100 Subject: [PATCH] style --- armsrc/mifarecmd.c | 12 ++++++------ client/luascripts/hf_ntag_dt.lua | 8 ++++---- client/src/cmdhflist.c | 4 ++-- client/src/cmdhfmf.c | 10 +++++----- client/src/cmdhfmfhard.c | 4 ++-- client/src/mifare/mifaredefault.h | 2 +- client/src/mifare/mifarehost.c | 2 +- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/armsrc/mifarecmd.c b/armsrc/mifarecmd.c index e9cc713bd..922cd674d 100644 --- a/armsrc/mifarecmd.c +++ b/armsrc/mifarecmd.c @@ -878,7 +878,7 @@ void MifareAcquireEncryptedNonces(uint32_t arg0, uint32_t arg1, uint32_t flags, LED_C_ON(); - uint8_t prev_enc_nt[] = {0,0,0,0}; + uint8_t prev_enc_nt[] = {0, 0, 0, 0}; uint8_t prev_counter = 0; for (uint16_t i = 0; i <= PM3_CMD_DATA_SIZE - 9;) { @@ -950,10 +950,10 @@ void MifareAcquireEncryptedNonces(uint32_t arg0, uint32_t arg1, uint32_t flags, if (prev_enc_nt[0] == receivedAnswer[0] && - prev_enc_nt[1] == receivedAnswer[1] && - prev_enc_nt[2] == receivedAnswer[2] && - prev_enc_nt[3] == receivedAnswer[3] - ) { + prev_enc_nt[1] == receivedAnswer[1] && + prev_enc_nt[2] == receivedAnswer[2] && + prev_enc_nt[3] == receivedAnswer[3] + ) { prev_counter++; } memcpy(prev_enc_nt, receivedAnswer, 4); @@ -2849,7 +2849,7 @@ OUT: if (done || retval != 0) FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); LEDsoff(); if (done || retval != 0) set_tracing(false); - BigBuf_free(); + BigBuf_free(); } void MifareSetMod(uint8_t *datain) { diff --git a/client/luascripts/hf_ntag_dt.lua b/client/luascripts/hf_ntag_dt.lua index 7af6753ef..5626a0b07 100644 --- a/client/luascripts/hf_ntag_dt.lua +++ b/client/luascripts/hf_ntag_dt.lua @@ -27,7 +27,7 @@ Default hf mfu info: [=] PACK [230/0xE6]: 00 00 - (cannot be read) [=] RFU [230/0xE6]: 00 00 - (cannot be read) ---------------------------------------------------------------------- - + Default blocks 0xE0 to 0xE6: ------------------------------------- [=] 224/0xE0 | 00 00 00 00 | 0 | .... @@ -48,7 +48,7 @@ Set a new password of SUDO using the default password of DNGR: Enable password protection from hex block 04 onwards (User memory): - script run hf_ntag_dt -x protect -p DNGR -a 04 + script run hf_ntag_dt -x protect -p DNGR -a 04 Enable password protection from hex block E3 onwards (Configuration Pages): @@ -58,7 +58,7 @@ Disable password protection: script run hf_ntag_dt -x protect -p DNGR -a FF -Enable the counter and enable read + write password protection on password protected pages +Enable the counter and enable read + write password protection on password protected pages (protected block start page specified using -x protect mode): script run hf_ntag_dt -x conf -p DNGR -c enable -m rw @@ -154,7 +154,7 @@ local function main(args) command = 'hf mfu wrbl -b 228 -d 80050000 -k '..passwd msg('Disabling counter and setting read/write password protection on protected pages : \n\n'..command) core.console(command) - end + end end elseif mode == 'protect' then command = 'hf mfu wrbl -k '..passwd..' -b 227 -d 040000'..auth0_block diff --git a/client/src/cmdhflist.c b/client/src/cmdhflist.c index fdfa34671..68a050158 100644 --- a/client/src/cmdhflist.c +++ b/client/src/cmdhflist.c @@ -1570,10 +1570,10 @@ void annotateMifare(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, // get UID if (MifareAuthState == masNone) { - if (isResponse && cmdsize == 5 ) { + if (isResponse && cmdsize == 5) { ClearAuthData(); AuthData.uid = bytes_to_num(&cmd[0], 4); - } + } if (cmdsize == 9 && cmd[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT && cmd[1] == 0x70) { ClearAuthData(); AuthData.uid = bytes_to_num(&cmd[2], 4); diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index 1847bc1a6..69a360c69 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -1842,7 +1842,7 @@ static int CmdHF14AMfNestedHard(const char *Cmd) { CLIParserInit(&ctx, "hf mf hardnested", "Nested attack for hardened MIFARE Classic cards.\n" "if card is EV1, command can detect and use known key see example below\n" - "\n" + " \n" "`--i` set type of SIMD instructions. Without this flag programs autodetect it.\n" " or \n" " hf mf hardnested -r --tk [known target key]\n" @@ -7033,8 +7033,8 @@ static int CmdHF14AGen4Load(const char *cmd) { if (blockno == start) flags |= MAGIC_INIT ; if (blockno == end) flags |= MAGIC_OFF ; - int res=mfG4SetBlock(pwd, blockno, data + (blockno * MFBLOCK_SIZE), flags); - if ( res != PM3_SUCCESS) { + int res = mfG4SetBlock(pwd, blockno, data + (blockno * MFBLOCK_SIZE), flags); + if (res != PM3_SUCCESS) { PrintAndLogEx(WARNING, "Can't set magic card block: %d. error=%d", blockno, res); PrintAndLogEx(HINT, "Verify your card size, and try again or try another tag position"); free(data); @@ -7195,10 +7195,10 @@ static int CmdHF14AGen4View(const char *Cmd) { uint8_t flags = 0 ; if (i == 0) flags |= MAGIC_INIT ; - if (i+1 == block_cnt) flags |= MAGIC_OFF ; + if (i + 1 == block_cnt) flags |= MAGIC_OFF ; int res = mfG4GetBlock(pwd, i, dump + (i * MFBLOCK_SIZE), flags); - if ( res != PM3_SUCCESS) { + if (res != PM3_SUCCESS) { PrintAndLogEx(WARNING, "Can't get magic card block: %u. error=%d", i, res); PrintAndLogEx(HINT, "Verify your card size, and try again or try another tag position"); free(dump); diff --git a/client/src/cmdhfmfhard.c b/client/src/cmdhfmfhard.c index 2d373e451..7d930a8a3 100644 --- a/client/src/cmdhfmfhard.c +++ b/client/src/cmdhfmfhard.c @@ -2251,7 +2251,7 @@ int mfnestedhard(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBloc update_reduction_rate(0.0, true); int res = simulate_acquire_nonces(); - if ( res != PM3_SUCCESS) { + if (res != PM3_SUCCESS) { return res; } @@ -2356,7 +2356,7 @@ int mfnestedhard(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBloc init_nonce_memory(); update_reduction_rate(0.0, true); - int res; + int res; if (nonce_file_read) { // use pre-acquired data from file nonces.bin res = read_nonce_file(filename); if (res != PM3_SUCCESS) { diff --git a/client/src/mifare/mifaredefault.h b/client/src/mifare/mifaredefault.h index e28bb7f09..7ce83e29f 100644 --- a/client/src/mifare/mifaredefault.h +++ b/client/src/mifare/mifaredefault.h @@ -76,7 +76,7 @@ static const uint8_t g_mifare_default_key[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0x static const uint8_t g_mifare_mad_key[] = {0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5}; static const uint8_t g_mifare_mad_key_b[] = {0x89, 0xEC, 0xA9, 0x7F, 0x8C, 0x2A}; - // 16 key B D01AFEEB890A +// 16 key B D01AFEEB890A static const uint8_t g_mifare_signature_key_a[] = {0x5C, 0x8F, 0xF9, 0x99, 0x0D, 0xA2}; static const uint8_t g_mifare_signature_key_b[] = {0x4b, 0x79, 0x1b, 0xea, 0x7b, 0xcc}; diff --git a/client/src/mifare/mifarehost.c b/client/src/mifare/mifarehost.c index f12f78eab..7a927d5ed 100644 --- a/client/src/mifare/mifarehost.c +++ b/client/src/mifare/mifarehost.c @@ -1425,7 +1425,7 @@ int detect_mf_magic(bool is_mfc) { bool detect_mfc_ev1_signature(void) { uint64_t key = 0; - int res = mfCheckKeys(69, MF_KEY_B, false, 1, (uint8_t*)g_mifare_signature_key_b, &key); + int res = mfCheckKeys(69, MF_KEY_B, false, 1, (uint8_t *)g_mifare_signature_key_b, &key); return (res == PM3_SUCCESS); }