Skip to content

Commit 4a119a7

Browse files
authored
Merge pull request #2629 from pingu2211/hf-mifare-refacor
Style src/mifare/mifarehost
2 parents 39c846a + 579ea6f commit 4a119a7

File tree

8 files changed

+202
-202
lines changed

8 files changed

+202
-202
lines changed

armsrc/Standalone/hf_young.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,14 @@ void RunMod(void) {
177177
MifareCGetBlock(c->arg[0], c->arg[1], c->d.asBytes);
178178
break;
179179
180-
mfCSetUID provides example logic for UID set workflow:
180+
mf_chinese_set_uid provides example logic for UID set workflow:
181181
-Read block0 from card in field with MifareCGetBlock()
182182
-Configure new values without replacing reserved bytes
183183
memcpy(block0, uid, 4); // Copy UID bytes from byte array
184184
// Mifare UID BCC
185185
block0[4] = block0[0]^block0[1]^block0[2]^block0[3]; // BCC on byte 5
186186
Bytes 5-7 are reserved SAK and ATQA for mifare classic
187-
-Use mfCSetBlock(0, block0, oldUID, wantWipe, MAGIC_SINGLE | MAGIC_WUPC) to write it
187+
-Use mf_chinese_set_block(0, block0, oldUID, wantWipe, MAGIC_SINGLE | MAGIC_WUPC) to write it
188188
*/
189189
uint8_t oldBlock0[16] = {0}, newBlock0[16] = {0};
190190
// arg0 = Flags, arg1=blockNo

client/src/cmdhfict.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ static int CmdHfIctCredential(const char *Cmd) {
525525
}
526526

527527
// diversified key A?
528-
int res = mfReadSector(ICT_MIFARE_SECTOR, MF_KEY_A, ICT_MIFARE_A_KEY, data);
528+
int res = mf_read_sector(ICT_MIFARE_SECTOR, MF_KEY_A, ICT_MIFARE_A_KEY, data);
529529
if (res != PM3_SUCCESS) {
530530
free(data);
531531
return res;

client/src/cmdhfjooki.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ static int CmdHF14AJookiSim(const char *Cmd) {
531531
g_conn.block_after_ACK = true;
532532
uint8_t blockwidth = 4, counter = 0, blockno = 0;
533533

534-
// 12 is the size of the struct the fct mfEmlSetMem_xt uses to transfer to device
534+
// 12 is the size of the struct the fct mf_eml_set_mem_xt uses to transfer to device
535535
uint16_t max_avail_blocks = ((PM3_CMD_DATA_SIZE - 12) / blockwidth) * blockwidth;
536536

537537
while (datalen) {
@@ -542,7 +542,7 @@ static int CmdHF14AJookiSim(const char *Cmd) {
542542
uint16_t chunk_size = MIN(max_avail_blocks, datalen);
543543
uint16_t blocks_to_send = chunk_size / blockwidth;
544544

545-
if (mfEmlSetMem_xt(data + counter, blockno, blocks_to_send, blockwidth) != PM3_SUCCESS) {
545+
if (mf_eml_set_mem_xt(data + counter, blockno, blocks_to_send, blockwidth) != PM3_SUCCESS) {
546546
PrintAndLogEx(FAILED, "Cant set emul block: %3d", blockno);
547547
free(data);
548548
return PM3_ESOFT;

client/src/cmdhfmf.c

Lines changed: 121 additions & 121 deletions
Large diffs are not rendered by default.

client/src/cmdhfmfp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1914,7 +1914,7 @@ static int CmdHFMFPMAD(const char *Cmd) {
19141914
if (aaid == mad[i]) {
19151915

19161916
uint8_t vsector[16 * 4] = {0};
1917-
if (mfReadSector(i + 1, keyB ? MF_KEY_B : MF_KEY_A, akey, vsector)) {
1917+
if (mf_read_sector(i + 1, keyB ? MF_KEY_B : MF_KEY_A, akey, vsector)) {
19181918
PrintAndLogEx(NORMAL, "");
19191919
PrintAndLogEx(ERR, "error, read sector %d", i + 1);
19201920
return PM3_ESOFT;

client/src/mifare/mifarehost.c

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#include "gen4.h"
4545
#include "parity.h"
4646

47-
int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
47+
int mf_dark_side(uint8_t blockno, uint8_t key_type, uint64_t *key) {
4848
uint32_t uid = 0;
4949
uint32_t nt = 0, nr = 0, ar = 0;
5050
uint64_t par_list = 0, ks_list = 0;
@@ -189,7 +189,7 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
189189
}
190190
}
191191

192-
if (mfCheckKeys(blockno, key_type - 0x60, false, size, keyBlock, key) == PM3_SUCCESS) {
192+
if (mf_check_keys(blockno, key_type - 0x60, false, size, keyBlock, key) == PM3_SUCCESS) {
193193
break;
194194
}
195195
}
@@ -208,7 +208,7 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
208208
return PM3_SUCCESS;
209209
}
210210

211-
int mfCheckKeys(uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keycnt, uint8_t *keyBlock, uint64_t *key) {
211+
int mf_check_keys(uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keycnt, uint8_t *keyBlock, uint64_t *key) {
212212
if (key) {
213213
*key = -1;
214214
}
@@ -249,9 +249,9 @@ int mfCheckKeys(uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keyc
249249
// 0 == ok all keys found
250250
// 1 ==
251251
// 2 == Time-out, aborting
252-
int mfCheckKeys_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) {
252+
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) {
255255

256256
uint64_t t2 = msclock();
257257

@@ -357,15 +357,15 @@ int mfCheckKeys_fast_ex(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChun
357357
return PM3_ESOFT;
358358
}
359359

360-
int mfCheckKeys_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) {
362-
return mfCheckKeys_fast_ex(sectorsCnt, firstChunk, lastChunk, strategy, size, keyBlock, e_sector, use_flashmemory, verbose, false, 0);
360+
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) {
362+
return mf_check_keys_fast_ex(sectorsCnt, firstChunk, lastChunk, strategy, size, keyBlock, e_sector, use_flashmemory, verbose, false, 0);
363363
}
364364

365365
// Trigger device to use a binary file on flash mem as keylist for mfCheckKeys.
366366
// As of now, 255 keys possible in the file
367367
// 6 * 255 = 1500 bytes
368-
int mfCheckKeys_file(uint8_t *destfn, uint64_t *key) {
368+
int mf_check_keys_file(uint8_t *destfn, uint64_t *key) {
369369
*key = -1;
370370
clearCommandBuffer();
371371

@@ -412,7 +412,7 @@ int mfCheckKeys_file(uint8_t *destfn, uint64_t *key) {
412412

413413
// PM3 imp of J-Run mf_key_brute (part 2)
414414
// ref: https://github.com/J-Run/mf_key_brute
415-
int mfKeyBrute(uint8_t blockNo, uint8_t keyType, const uint8_t *key, uint64_t *resultkey) {
415+
int mf_key_brute(uint8_t blockNo, uint8_t keyType, const uint8_t *key, uint64_t *resultkey) {
416416

417417
uint64_t key64;
418418
uint8_t found = false;
@@ -441,7 +441,7 @@ int mfKeyBrute(uint8_t blockNo, uint8_t keyType, const uint8_t *key, uint64_t *r
441441
memcpy(keyBlock, candidates + i, KEYBLOCK_SIZE);
442442

443443
// check a block of generated key candidates.
444-
if (mfCheckKeys(blockNo, keyType, true, KEYS_IN_BLOCK, keyBlock, &key64) == PM3_SUCCESS) {
444+
if (mf_check_keys(blockNo, keyType, true, KEYS_IN_BLOCK, keyBlock, &key64) == PM3_SUCCESS) {
445445
*resultkey = key64;
446446
found = true;
447447
break;
@@ -483,7 +483,7 @@ __attribute__((force_align_arg_pointer))
483483
return statelist->head.slhead;
484484
}
485485

486-
int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKey, bool calibrate) {
486+
int mf_nested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKey, bool calibrate) {
487487

488488
uint32_t uid;
489489
StateList_t statelists[2];
@@ -625,7 +625,7 @@ int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo,
625625
num_to_bytes(key64, 6, keyBlock + j * MIFARE_KEY_SIZE);
626626
}
627627

628-
if (mfCheckKeys(statelists[0].blockNo, statelists[0].keyType, false, size, keyBlock, &key64) == PM3_SUCCESS) {
628+
if (mf_check_keys(statelists[0].blockNo, statelists[0].keyType, false, size, keyBlock, &key64) == PM3_SUCCESS) {
629629
free(statelists[0].head.slhead);
630630
free(statelists[1].head.slhead);
631631
num_to_bytes(key64, 6, resultKey);
@@ -669,7 +669,7 @@ int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo,
669669
return PM3_ESOFT;
670670
}
671671

672-
int mfStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKey) {
672+
int mf_static_nested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKey) {
673673

674674
uint32_t uid;
675675
StateList_t statelists[2];
@@ -902,9 +902,9 @@ int mfStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBl
902902
free(mem);
903903
return res;
904904
}
905-
res = mfCheckKeys_file(fn, &key64);
905+
res = mf_check_keys_file(fn, &key64);
906906
} else {
907-
res = mfCheckKeys(statelists[0].blockNo, statelists[0].keyType, true, chunk, mem, &key64);
907+
res = mf_check_keys(statelists[0].blockNo, statelists[0].keyType, true, chunk, mem, &key64);
908908
}
909909

910910
if (res == PM3_SUCCESS) {
@@ -949,7 +949,7 @@ int mfStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBl
949949
}
950950

951951
// MIFARE
952-
int mfReadSector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t *data) {
952+
int mf_read_sector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t *data) {
953953

954954
clearCommandBuffer();
955955
SendCommandMIX(CMD_HF_MIFARE_READSC, sectorNo, keyType, 0, (uint8_t *)key, MIFARE_KEY_SIZE);
@@ -970,7 +970,7 @@ int mfReadSector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t
970970
return PM3_SUCCESS;
971971
}
972972

973-
int mfReadBlock(uint8_t blockNo, uint8_t keyType, const uint8_t *key, uint8_t *data) {
973+
int mf_read_block(uint8_t blockNo, uint8_t keyType, const uint8_t *key, uint8_t *data) {
974974
mf_readblock_t payload = {
975975
.blockno = blockNo,
976976
.keytype = keyType
@@ -994,7 +994,7 @@ int mfReadBlock(uint8_t blockNo, uint8_t keyType, const uint8_t *key, uint8_t *d
994994
return PM3_SUCCESS;
995995
}
996996

997-
int mfWriteBlock(uint8_t blockno, uint8_t keyType, const uint8_t *key, uint8_t *block) {
997+
int mf_write_block(uint8_t blockno, uint8_t keyType, const uint8_t *key, uint8_t *block) {
998998

999999
uint8_t data[26];
10001000
memcpy(data, key, MIFARE_KEY_SIZE);
@@ -1014,10 +1014,10 @@ int mfWriteBlock(uint8_t blockno, uint8_t keyType, const uint8_t *key, uint8_t *
10141014
return res;
10151015
}
10161016

1017-
int mfWriteSector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t *sector){
1018-
1019-
for (int i = 0; i < 4; i++) {
1020-
int res = mfWriteBlock((sectorNo * 4) + i, keyType, key, sector + ( i * MFBLOCK_SIZE ));
1017+
int mf_write_sector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t *sector) {
1018+
int res;
1019+
for (int i = 0; i < mfNumBlocksPerSector(sectorNo); i++) {
1020+
res = mf_write_block((mfFirstBlockOfSector(sectorNo)) + i, keyType, key, sector + (i * MFBLOCK_SIZE));
10211021
if (res != PM3_SUCCESS) {
10221022
return (i == 0) ? PM3_EFAILED : PM3_EPARTIAL;
10231023
}
@@ -1026,7 +1026,7 @@ int mfWriteSector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t
10261026
}
10271027

10281028
// EMULATOR
1029-
int mfEmlGetMem(uint8_t *data, int blockNum, int blocksCount) {
1029+
int mf_eml_get_mem(uint8_t *data, int blockNum, int blocksCount) {
10301030

10311031
size_t size = blocksCount * MFBLOCK_SIZE;
10321032
if (size > PM3_CMD_DATA_SIZE) {
@@ -1056,11 +1056,11 @@ int mfEmlGetMem(uint8_t *data, int blockNum, int blocksCount) {
10561056
return resp.status;
10571057
}
10581058

1059-
int mfEmlSetMem(uint8_t *data, int blockNum, int blocksCount) {
1060-
return mfEmlSetMem_xt(data, blockNum, blocksCount, MFBLOCK_SIZE);
1059+
int mf_elm_set_mem(uint8_t *data, int blockNum, int blocksCount) {
1060+
return mf_eml_set_mem_xt(data, blockNum, blocksCount, MFBLOCK_SIZE);
10611061
}
10621062

1063-
int mfEmlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int blockBtWidth) {
1063+
int mf_eml_set_mem_xt(uint8_t *data, int blockNum, int blocksCount, int blockBtWidth) {
10641064

10651065
struct p {
10661066
uint8_t blockno;
@@ -1089,13 +1089,13 @@ int mfEmlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int blockBtWidt
10891089
}
10901090

10911091
// "MAGIC" CARD
1092-
int mfCSetUID(uint8_t *uid, uint8_t uidlen, const uint8_t *atqa, const uint8_t *sak, uint8_t *old_uid, uint8_t *verifed_uid, uint8_t wipecard, uint8_t gdm) {
1092+
int mf_chinese_set_uid(uint8_t *uid, uint8_t uidlen, const uint8_t *atqa, const uint8_t *sak, uint8_t *old_uid, uint8_t *verifed_uid, uint8_t wipecard, uint8_t gdm) {
10931093

10941094
uint8_t params = MAGIC_SINGLE | (gdm ? MAGIC_GDM_ALT_WUPC : MAGIC_WUPC);
10951095
uint8_t block0[MFBLOCK_SIZE];
10961096
memset(block0, 0x00, sizeof(block0));
10971097

1098-
int res = mfCGetBlock(0, block0, params);
1098+
int res = mf_chinese_get_block(0, block0, params);
10991099
if (res == 0) {
11001100
PrintAndLogEx(SUCCESS, "old block 0... %s", sprint_hex_inrow(block0, sizeof(block0)));
11011101
if (old_uid) {
@@ -1140,11 +1140,11 @@ int mfCSetUID(uint8_t *uid, uint8_t uidlen, const uint8_t *atqa, const uint8_t *
11401140
params |= MAGIC_WIPE;
11411141
}
11421142

1143-
res = mfCSetBlock(0, block0, NULL, params);
1143+
res = mf_chinese_set_block(0, block0, NULL, params);
11441144
if (res == PM3_SUCCESS) {
11451145
params = MAGIC_SINGLE | MAGIC_WUPC;
11461146
memset(block0, 0, sizeof(block0));
1147-
res = mfCGetBlock(0, block0, params);
1147+
res = mf_chinese_get_block(0, block0, params);
11481148
if (res == 0) {
11491149
if (verifed_uid) {
11501150
memcpy(verifed_uid, block0, uidlen);
@@ -1154,7 +1154,7 @@ int mfCSetUID(uint8_t *uid, uint8_t uidlen, const uint8_t *atqa, const uint8_t *
11541154
return res;
11551155
}
11561156

1157-
int mfCWipe(uint8_t *uid, const uint8_t *atqa, const uint8_t *sak, uint8_t gdm) {
1157+
int mf_chinese_wipe(uint8_t *uid, const uint8_t *atqa, const uint8_t *sak, uint8_t gdm) {
11581158
uint8_t block0[MFBLOCK_SIZE] = {0x00, 0x56, 0x78, 0xBB, 0x95, 0x08, 0x04, 0x00, 0x02, 0xB2, 0x1E, 0x24, 0x23, 0x27, 0x1E, 0x1D};
11591159
// uint8_t block0[MFBLOCK_SIZE] = {0x04, 0x03, 0x02, 0x01, 0x04, 0x08, 0x04, 0x00, 0x64, 0xB9, 0x95, 0x11, 0x4D, 0x20, 0x42, 0x09};
11601160
uint8_t blockD[MFBLOCK_SIZE] = {0x00};
@@ -1180,12 +1180,12 @@ int mfCWipe(uint8_t *uid, const uint8_t *atqa, const uint8_t *sak, uint8_t gdm)
11801180
PrintAndLogEx(INPLACE, "wipe block %d", blockNo);
11811181

11821182
if (blockNo == 0) {
1183-
res = mfCSetBlock(blockNo, block0, NULL, params);
1183+
res = mf_chinese_set_block(blockNo, block0, NULL, params);
11841184
} else {
11851185
if (mfIsSectorTrailer(blockNo))
1186-
res = mfCSetBlock(blockNo, blockK, NULL, params);
1186+
res = mf_chinese_set_block(blockNo, blockK, NULL, params);
11871187
else
1188-
res = mfCSetBlock(blockNo, blockD, NULL, params);
1188+
res = mf_chinese_set_block(blockNo, blockD, NULL, params);
11891189
}
11901190

11911191
if (res == PM3_SUCCESS)
@@ -1204,7 +1204,7 @@ int mfCWipe(uint8_t *uid, const uint8_t *atqa, const uint8_t *sak, uint8_t gdm)
12041204
return PM3_SUCCESS;
12051205
}
12061206

1207-
int mfCSetBlock(uint8_t blockNo, uint8_t *data, uint8_t *uid, uint8_t params) {
1207+
int mf_chinese_set_block(uint8_t blockNo, uint8_t *data, uint8_t *uid, uint8_t params) {
12081208
clearCommandBuffer();
12091209
SendCommandMIX(CMD_HF_MIFARE_CSETBL, params, blockNo, 0, data, MFBLOCK_SIZE);
12101210
PacketResponseNG resp;
@@ -1224,7 +1224,7 @@ int mfCSetBlock(uint8_t blockNo, uint8_t *data, uint8_t *uid, uint8_t params) {
12241224
return PM3_SUCCESS;
12251225
}
12261226

1227-
int mfCGetBlock(uint8_t blockNo, uint8_t *data, uint8_t params) {
1227+
int mf_chinese_get_block(uint8_t blockNo, uint8_t *data, uint8_t params) {
12281228
clearCommandBuffer();
12291229
SendCommandMIX(CMD_HF_MIFARE_CGETBL, params, blockNo, 0, NULL, 0);
12301230
PacketResponseNG resp;
@@ -1241,7 +1241,7 @@ int mfCGetBlock(uint8_t blockNo, uint8_t *data, uint8_t params) {
12411241
return PM3_SUCCESS;
12421242
}
12431243

1244-
int mfGen3UID(uint8_t *uid, uint8_t uidlen, uint8_t *oldUid) {
1244+
int mf_chinese_gen_3_uid(uint8_t *uid, uint8_t uidlen, uint8_t *oldUid) {
12451245
clearCommandBuffer();
12461246
SendCommandMIX(CMD_HF_MIFARE_GEN3UID, uidlen, 0, 0, uid, uidlen);
12471247
PacketResponseNG resp;
@@ -1256,7 +1256,7 @@ int mfGen3UID(uint8_t *uid, uint8_t uidlen, uint8_t *oldUid) {
12561256
}
12571257
}
12581258

1259-
int mfGen3Block(uint8_t *block, int blockLen, uint8_t *newBlock) {
1259+
int mf_chinese_gen_3_block(uint8_t *block, int blockLen, uint8_t *newBlock) {
12601260
clearCommandBuffer();
12611261
SendCommandMIX(CMD_HF_MIFARE_GEN3BLK, blockLen, 0, 0, block, MFBLOCK_SIZE);
12621262
PacketResponseNG resp;
@@ -1271,7 +1271,7 @@ int mfGen3Block(uint8_t *block, int blockLen, uint8_t *newBlock) {
12711271
}
12721272
}
12731273

1274-
int mfGen3Freeze(void) {
1274+
int mf_chinese_gen_3_freeze(void) {
12751275
clearCommandBuffer();
12761276
SendCommandNG(CMD_HF_MIFARE_GEN3FREEZ, NULL, 0);
12771277
PacketResponseNG resp;
@@ -1301,7 +1301,7 @@ void mf_crypto1_decrypt(struct Crypto1State *pcs, uint8_t *data, int len, bool i
13011301
}
13021302
}
13031303

1304-
int tryDecryptWord(uint32_t nt, uint32_t ar_enc, uint32_t at_enc, uint8_t *data, int len) {
1304+
int try_decrypt_word(uint32_t nt, uint32_t ar_enc, uint32_t at_enc, uint8_t *data, int len) {
13051305

13061306
PrintAndLogEx(SUCCESS, "encrypted data... %s", sprint_hex(data, len));
13071307
uint32_t ks2 = ar_enc ^ prng_successor(nt, 64);
@@ -1636,7 +1636,7 @@ uint16_t detect_mf_magic(bool is_mfc, uint8_t key_type, uint64_t key) {
16361636

16371637
bool detect_mfc_ev1_signature(void) {
16381638
uint64_t key = 0;
1639-
int res = mfCheckKeys(69, MF_KEY_B, false, 1, (uint8_t *)g_mifare_signature_key_b, &key);
1639+
int res = mf_check_keys(69, MF_KEY_B, false, 1, (uint8_t *)g_mifare_signature_key_b, &key);
16401640
return (res == PM3_SUCCESS);
16411641
}
16421642

@@ -1645,17 +1645,17 @@ int read_mfc_ev1_signature(uint8_t *signature) {
16451645
return PM3_EINVARG;
16461646
}
16471647
uint8_t sign[32] = {0};
1648-
int res = mfReadBlock(69, MF_KEY_B, g_mifare_signature_key_b, sign);
1648+
int res = mf_read_block(69, MF_KEY_B, g_mifare_signature_key_b, sign);
16491649
if (res == PM3_SUCCESS) {
1650-
res = mfReadBlock(70, MF_KEY_B, g_mifare_signature_key_b, sign + 16);
1650+
res = mf_read_block(70, MF_KEY_B, g_mifare_signature_key_b, sign + 16);
16511651
if (res == PM3_SUCCESS) {
16521652
memcpy(signature, sign, sizeof(sign));
16531653
}
16541654
} else {
16551655
// try QL88
1656-
res = mfReadBlock(69, MF_KEY_B, g_mifare_ql88_signature_key_b, sign);
1656+
res = mf_read_block(69, MF_KEY_B, g_mifare_ql88_signature_key_b, sign);
16571657
if (res == PM3_SUCCESS) {
1658-
res = mfReadBlock(70, MF_KEY_B, g_mifare_ql88_signature_key_b, sign + 16);
1658+
res = mf_read_block(70, MF_KEY_B, g_mifare_ql88_signature_key_b, sign + 16);
16591659
if (res == PM3_SUCCESS) {
16601660
memcpy(signature, sign, sizeof(sign));
16611661
}

0 commit comments

Comments
 (0)