Skip to content

Commit f690b80

Browse files
committed
make style
1 parent 9ccd94f commit f690b80

File tree

3 files changed

+43
-43
lines changed

3 files changed

+43
-43
lines changed

client/src/cmdhfmf.c

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,9 @@ bool mfc_value(const uint8_t *d, int32_t *val) {
250250
uint32_t b = MemLeToUint4byte(d + 8);
251251

252252
int val_checks = (
253-
(a == b) && (a == ~a_inv) &&
254-
(d[12] == (~d[13] & 0xFF)) &&
255-
(d[14] == (~d[15] & 0xFF))
253+
(a == b) && (a == ~a_inv) &&
254+
(d[12] == (~d[13] & 0xFF)) &&
255+
(d[14] == (~d[15] & 0xFF))
256256
);
257257

258258
if (val) {
@@ -1602,7 +1602,7 @@ static int CmdHF14AMfRestore(const char *Cmd) {
16021602
PrintAndLogEx(INFO, " %3d | %s| ( " _RED_("fail") " ) key " _YELLOW_("%c"),
16031603
blockno,
16041604
sprint_hex(bldata, sizeof(bldata)),
1605-
(kt == MF_KEY_A) ? 'A' : 'B'
1605+
(kt == MF_KEY_A) ? 'A' : 'B'
16061606
);
16071607
} // end loop key types
16081608
} // end loop B
@@ -2963,7 +2963,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
29632963
PrintAndLogEx(INFO, "======================= " _YELLOW_("START READ B KEY ATTACK") " =======================");
29642964
PrintAndLogEx(INFO, "reading B key of sector %3d with key type %c",
29652965
current_sector_i,
2966-
(current_key_type_i == MF_KEY_B) ? 'B' : 'A');
2966+
(current_key_type_i == MF_KEY_B) ? 'B' : 'A');
29672967
}
29682968
uint8_t sectrail = (mfFirstBlockOfSector(current_sector_i) + mfNumBlocksPerSector(current_sector_i) - 1);
29692969

@@ -2995,7 +2995,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
29952995
if (verbose) {
29962996
PrintAndLogEx(WARNING, "unknown B key: sector: %3d key type: %c",
29972997
current_sector_i,
2998-
(current_key_type_i == MF_KEY_B) ? 'B' : 'A'
2998+
(current_key_type_i == MF_KEY_B) ? 'B' : 'A'
29992999
);
30003000
PrintAndLogEx(INFO, " -- reading the B key was not possible, maybe due to access rights?");
30013001

@@ -3018,7 +3018,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
30183018
PrintAndLogEx(INFO, "======================= " _YELLOW_("START NESTED ATTACK") " =======================");
30193019
PrintAndLogEx(INFO, "sector no %3d, target key type %c",
30203020
current_sector_i,
3021-
(current_key_type_i == MF_KEY_B) ? 'B' : 'A');
3021+
(current_key_type_i == MF_KEY_B) ? 'B' : 'A');
30223022
}
30233023
tryNested:
30243024
isOK = mf_nested(mfFirstBlockOfSector(sectorno), keytype, key, mfFirstBlockOfSector(current_sector_i), current_key_type_i, tmp_key, calibrate);
@@ -3144,7 +3144,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
31443144
PrintAndLogEx(INFO, "======================= " _YELLOW_("START STATIC NESTED ATTACK") " =======================");
31453145
PrintAndLogEx(INFO, "sector no %3d, target key type %c",
31463146
current_sector_i,
3147-
(current_key_type_i == MF_KEY_B) ? 'B' : 'A');
3147+
(current_key_type_i == MF_KEY_B) ? 'B' : 'A');
31483148
}
31493149

31503150
isOK = mf_static_nested(mfFirstBlockOfSector(sectorno), keytype, key, mfFirstBlockOfSector(current_sector_i), current_key_type_i, tmp_key);
@@ -4424,7 +4424,7 @@ void printKeyTableEx(size_t sectorscnt, sector_t *e_sector, uint8_t start_sector
44244424
_YELLOW_("H") ":Hardnested / "
44254425
_YELLOW_("C") ":statiCnested / "
44264426
_YELLOW_("A") ":keyA "
4427-
" )"
4427+
" )"
44284428
);
44294429
if (sectorscnt == 18) {
44304430
PrintAndLogEx(INFO, "( " _MAGENTA_("*") " ) These sectors used for signature. Lays outside of user memory");
@@ -5032,7 +5032,7 @@ static int CmdHF14AMfECFill(const char *Cmd) {
50325032
t1 = msclock() - t1;
50335033

50345034
if (resp.status == PM3_SUCCESS)
5035-
PrintAndLogEx(SUCCESS, "Fill ( " _GREEN_("ok") " ) in " _YELLOW_("%" PRIu64 ) " ms", t1);
5035+
PrintAndLogEx(SUCCESS, "Fill ( " _GREEN_("ok") " ) in " _YELLOW_("%" PRIu64) " ms", t1);
50365036
else
50375037
PrintAndLogEx(FAILED, "Fill ( " _RED_("fail") " )");
50385038

@@ -5212,7 +5212,7 @@ static int CmdHF14AMfCSetUID(const char *Cmd) {
52125212
PrintAndLogEx(SUCCESS, "Old UID... %s", sprint_hex(old_uid, uidlen));
52135213
PrintAndLogEx(SUCCESS, "New UID... %s ( %s )",
52145214
sprint_hex(verify_uid, uidlen),
5215-
(res == 0) ? _GREEN_("verified") : _RED_("fail")
5215+
(res == 0) ? _GREEN_("verified") : _RED_("fail")
52165216
);
52175217
return PM3_SUCCESS;
52185218
}
@@ -6601,10 +6601,10 @@ int CmdHFMFNDEFFormat(const char *Cmd) {
66016601
"If not, it will try finding a key file based on your UID. ie, if you ran autopwn before",
66026602
"hf mf ndefformat\n"
66036603
// "hf mf ndefformat --mini --> MIFARE Mini\n"
6604-
"hf mf ndefformat --1k --> MIFARE Classic 1k\n"
6604+
"hf mf ndefformat --1k --> MIFARE Classic 1k\n"
66056605
// "hf mf ndefformat --2k --> MIFARE 2k\n"
66066606
// "hf mf ndefformat --4k --> MIFARE 4k\n"
6607-
"hf mf ndefformat --keys hf-mf-01020304-key.bin --> MIFARE 1k with keys from specified file\n"
6607+
"hf mf ndefformat --keys hf-mf-01020304-key.bin --> MIFARE 1k with keys from specified file\n"
66086608
);
66096609

66106610
void *argtable[] = {
@@ -7015,7 +7015,7 @@ int CmdHFMFNDEFWrite(const char *Cmd) {
70157015
if (mf_write_block(block_no, MF_KEY_B, g_mifare_default_key, block) != PM3_SUCCESS) {
70167016

70177017
// try A key,
7018-
7018+
70197019
if (mf_write_block(block_no, MF_KEY_A, g_mifare_ndef_key, block) != PM3_SUCCESS) {
70207020
return PM3_EFAILED;
70217021
}
@@ -9256,7 +9256,7 @@ static int CmdHF14AMfValue(const char *Cmd) {
92569256
// don't want to write value data and break something
92579257
if ((blockno == 0) ||
92589258
(mfIsSectorTrailer(blockno)) ||
9259-
(trnval == 0) ||
9259+
(trnval == 0) ||
92609260
(trnval != -1 && mfIsSectorTrailer(trnval))) {
92619261
PrintAndLogEx(WARNING, "invalid block number, should be a data block");
92629262
return PM3_EINVARG;
@@ -9693,45 +9693,45 @@ static int CmdHF14AMfInfo(const char *Cmd) {
96939693
// backdoor might be present, or just a clone reusing Fudan MF data...
96949694
PrintAndLogEx(SUCCESS, "Fudan based card");
96959695
} else if (fKeyType == MF_KEY_BD && memcmp(fkey, k08s, sizeof(fkey)) == 0
9696-
&& card.sak == 0x08 && memcmp(blockdata + 5, "\x08\x04\x00", 3) == 0
9697-
&& (blockdata[8] == 0x03 || blockdata[8] == 0x04) && blockdata[15] == 0x90) {
9696+
&& card.sak == 0x08 && memcmp(blockdata + 5, "\x08\x04\x00", 3) == 0
9697+
&& (blockdata[8] == 0x03 || blockdata[8] == 0x04) && blockdata[15] == 0x90) {
96989698
PrintAndLogEx(SUCCESS, "Fudan FM11RF08S");
96999699
} else if (fKeyType == MF_KEY_BD && memcmp(fkey, k08s, sizeof(fkey)) == 0
9700-
&& card.sak == 0x08 && memcmp(blockdata + 5, "\x00\x03\x00\x10", 4) == 0
9701-
&& blockdata[15] == 0x90) {
9700+
&& card.sak == 0x08 && memcmp(blockdata + 5, "\x00\x03\x00\x10", 4) == 0
9701+
&& blockdata[15] == 0x90) {
97029702
PrintAndLogEx(SUCCESS, "Fudan FM11RF08S-7B");
97039703
} else if (fKeyType == MF_KEY_BD && memcmp(fkey, k08, sizeof(fkey)) == 0
9704-
&& card.sak == 0x08 && memcmp(blockdata + 5, "\x08\x04\x00", 3) == 0
9705-
&& blockdata[15] == 0x98) {
9704+
&& card.sak == 0x08 && memcmp(blockdata + 5, "\x08\x04\x00", 3) == 0
9705+
&& blockdata[15] == 0x98) {
97069706
PrintAndLogEx(SUCCESS, "Fudan FM11RF08S **98");
97079707
} else if (fKeyType == MF_KEY_BD && memcmp(fkey, k08, sizeof(fkey)) == 0
9708-
&& card.sak == 0x08 && memcmp(blockdata + 5, "\x08\x04\x00", 3) == 0
9709-
&& (blockdata[8] >= 0x01 && blockdata[8] <= 0x03) && blockdata[15] == 0x1D) {
9708+
&& card.sak == 0x08 && memcmp(blockdata + 5, "\x08\x04\x00", 3) == 0
9709+
&& (blockdata[8] >= 0x01 && blockdata[8] <= 0x03) && blockdata[15] == 0x1D) {
97109710
PrintAndLogEx(SUCCESS, "Fudan FM11RF08");
97119711
} else if (fKeyType == MF_KEY_BD && memcmp(fkey, k32, sizeof(fkey)) == 0
9712-
&& card.sak == 0x18 && memcmp(blockdata + 5, "\x18\x02\x00\x46\x44\x53\x37\x30\x56\x30\x31", 11) == 0) {
9712+
&& card.sak == 0x18 && memcmp(blockdata + 5, "\x18\x02\x00\x46\x44\x53\x37\x30\x56\x30\x31", 11) == 0) {
97139713
PrintAndLogEx(SUCCESS, "Fudan FM11RF32");
97149714
} else if (fKeyType == MF_KEY_BD && memcmp(fkey, k08, sizeof(fkey)) == 0
9715-
&& card.sak == 0x20 && memcmp(blockdata + 8, "\x62\x63\x64\x65\x66\x67\x68\x69", 8) == 0) {
9715+
&& card.sak == 0x20 && memcmp(blockdata + 8, "\x62\x63\x64\x65\x66\x67\x68\x69", 8) == 0) {
97169716
PrintAndLogEx(SUCCESS, "Fudan FM11RF32 (SAK=20)");
97179717
} else if (fKeyType == MF_KEY_BD && memcmp(fkey, k08, sizeof(fkey)) == 0
9718-
&& card.sak == 0x28 && memcmp(blockdata + 5, "\x28\x04\x00\x90\x10\x15\x01\x00\x00\x00\x00", 11) == 0) {
9718+
&& card.sak == 0x28 && memcmp(blockdata + 5, "\x28\x04\x00\x90\x10\x15\x01\x00\x00\x00\x00", 11) == 0) {
97199719
// Note: it also has ATS =
97209720
// 10 78 80 90 02 20 90 00 00 00 00 00 + UID + CRC
97219721
PrintAndLogEx(SUCCESS, "Fudan FM1208-10");
97229722
} else if (fKeyType == MF_KEY_BD && memcmp(fkey, k08, sizeof(fkey)) == 0
9723-
&& card.sak == 0x28 && memcmp(blockdata + 5, "\x28\x04\x00\x90\x53\xB7\x0C\x00\x00\x00\x00", 11) == 0) {
9723+
&& card.sak == 0x28 && memcmp(blockdata + 5, "\x28\x04\x00\x90\x53\xB7\x0C\x00\x00\x00\x00", 11) == 0) {
97249724
// Note: it also has ATS =
97259725
// 10 78 80 B0 02 20 90 00 00 00 00 00 + UID + CRC
97269726
PrintAndLogEx(SUCCESS, "Fudan FM1216-137");
97279727
} else if (fKeyType == MF_KEY_BD && memcmp(fkey, k08, sizeof(fkey)) == 0
9728-
&& card.sak == 0x88 && memcmp(blockdata + 5, "\x88\x04\x00\x43", 4) == 0) {
9728+
&& card.sak == 0x88 && memcmp(blockdata + 5, "\x88\x04\x00\x43", 4) == 0) {
97299729
PrintAndLogEx(SUCCESS, "Infineon SLE66R35");
97309730
} else if (fKeyType == MF_KEY_BD && memcmp(fkey, k08, sizeof(fkey)) == 0
9731-
&& card.sak == 0x08 && memcmp(blockdata + 5, "\x88\x04\x00\x44", 4) == 0) {
9731+
&& card.sak == 0x08 && memcmp(blockdata + 5, "\x88\x04\x00\x44", 4) == 0) {
97329732
PrintAndLogEx(SUCCESS, "NXP MF1ICS5003");
97339733
} else if (fKeyType == MF_KEY_BD && memcmp(fkey, k08, sizeof(fkey)) == 0
9734-
&& card.sak == 0x08 && memcmp(blockdata + 5, "\x88\x04\x00\x45", 4) == 0) {
9734+
&& card.sak == 0x08 && memcmp(blockdata + 5, "\x88\x04\x00\x45", 4) == 0) {
97359735
PrintAndLogEx(SUCCESS, "NXP MF1ICS5004");
97369736
} else if (fKeyType == MF_KEY_BD) {
97379737
PrintAndLogEx(SUCCESS, _RED_("Unknown card with backdoor, please report details!"));
@@ -10032,7 +10032,7 @@ static int CmdHF14AMfISEN(const char *Cmd) {
1003210032
free(dump);
1003310033
}
1003410034
t1 = msclock() - t1;
10035-
PrintAndLogEx(SUCCESS, "time: " _YELLOW_("%" PRIu64 ) " ms", t1);
10035+
PrintAndLogEx(SUCCESS, "time: " _YELLOW_("%" PRIu64) " ms", t1);
1003610036

1003710037
if (fnlen == 0) {
1003810038
snprintf(filename, sizeof(filename), "hf-mf-%s-nonces%s", sprint_hex_inrow(card.uid, card.uidlen), collect_fm11rf08s_with_data ? "_with_data" : "");

client/src/mifare/mifarehost.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ int mf_check_keys(uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t ke
250250
// 1 ==
251251
// 2 == Time-out, aborting
252252
int mf_check_keys_fast_ex(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk, uint8_t strategy,
253-
uint32_t size, uint8_t *keyBlock, sector_t *e_sector, bool use_flashmemory,
254-
bool verbose, bool quiet, uint16_t singleSectorParams) {
253+
uint32_t size, uint8_t *keyBlock, sector_t *e_sector, bool use_flashmemory,
254+
bool verbose, bool quiet, uint16_t singleSectorParams) {
255255

256256
uint64_t t2 = msclock();
257257

@@ -358,7 +358,7 @@ int mf_check_keys_fast_ex(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastCh
358358
}
359359

360360
int mf_check_keys_fast(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk, uint8_t strategy,
361-
uint32_t size, uint8_t *keyBlock, sector_t *e_sector, bool use_flashmemory, bool verbose) {
361+
uint32_t size, uint8_t *keyBlock, sector_t *e_sector, bool use_flashmemory, bool verbose) {
362362
return mf_check_keys_fast_ex(sectorsCnt, firstChunk, lastChunk, strategy, size, keyBlock, e_sector, use_flashmemory, verbose, false, 0);
363363
}
364364

@@ -1014,12 +1014,12 @@ int mf_write_block(uint8_t blockno, uint8_t keyType, const uint8_t *key, uint8_t
10141014
return res;
10151015
}
10161016

1017-
int mf_write_sector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t *sector){
1017+
int mf_write_sector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t *sector) {
10181018
int res;
1019-
for (int i=0;i<4; i++){
1020-
res = mf_write_block((sectorNo*4)+i, keyType, key, sector+(i*MFBLOCK_SIZE));
1021-
if (res != PM3_SUCCESS){
1022-
return (i==0)?PM3_EFAILED:PM3_EPARTIAL;
1019+
for (int i = 0; i < 4; i++) {
1020+
res = mf_write_block((sectorNo * 4) + i, keyType, key, sector + (i * MFBLOCK_SIZE));
1021+
if (res != PM3_SUCCESS) {
1022+
return (i == 0) ? PM3_EFAILED : PM3_EPARTIAL;
10231023
}
10241024
}
10251025
return PM3_SUCCESS;

client/src/mifare/mifarehost.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ int mf_nested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo
7575
int mf_static_nested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKey);
7676
int mf_check_keys(uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keycnt, uint8_t *keyBlock, uint64_t *key);
7777
int mf_check_keys_fast(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk,
78-
uint8_t strategy, uint32_t size, uint8_t *keyBlock, sector_t *e_sector,
79-
bool use_flashmemory, bool verbose);
78+
uint8_t strategy, uint32_t size, uint8_t *keyBlock, sector_t *e_sector,
79+
bool use_flashmemory, bool verbose);
8080
int mf_check_keys_fast_ex(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk, uint8_t strategy,
81-
uint32_t size, uint8_t *keyBlock, sector_t *e_sector, bool use_flashmemory,
82-
bool verbose, bool quiet, uint16_t singleSectorParams);
81+
uint32_t size, uint8_t *keyBlock, sector_t *e_sector, bool use_flashmemory,
82+
bool verbose, bool quiet, uint16_t singleSectorParams);
8383

8484
int mf_check_keys_file(uint8_t *destfn, uint64_t *key);
8585

0 commit comments

Comments
 (0)