mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
rename all mifarehost functions to match style guide
This commit is contained in:
@@ -177,14 +177,14 @@ void RunMod(void) {
|
||||
MifareCGetBlock(c->arg[0], c->arg[1], c->d.asBytes);
|
||||
break;
|
||||
|
||||
mfCSetUID provides example logic for UID set workflow:
|
||||
mf_chinese_set_uid provides example logic for UID set workflow:
|
||||
-Read block0 from card in field with MifareCGetBlock()
|
||||
-Configure new values without replacing reserved bytes
|
||||
memcpy(block0, uid, 4); // Copy UID bytes from byte array
|
||||
// Mifare UID BCC
|
||||
block0[4] = block0[0]^block0[1]^block0[2]^block0[3]; // BCC on byte 5
|
||||
Bytes 5-7 are reserved SAK and ATQA for mifare classic
|
||||
-Use mfCSetBlock(0, block0, oldUID, wantWipe, MAGIC_SINGLE | MAGIC_WUPC) to write it
|
||||
-Use mf_chinese_set_block(0, block0, oldUID, wantWipe, MAGIC_SINGLE | MAGIC_WUPC) to write it
|
||||
*/
|
||||
uint8_t oldBlock0[16] = {0}, newBlock0[16] = {0};
|
||||
// arg0 = Flags, arg1=blockNo
|
||||
|
||||
@@ -525,7 +525,7 @@ static int CmdHfIctCredential(const char *Cmd) {
|
||||
}
|
||||
|
||||
// diversified key A?
|
||||
int res = mfReadSector(ICT_MIFARE_SECTOR, MF_KEY_A, ICT_MIFARE_A_KEY, data);
|
||||
int res = mf_read_sector(ICT_MIFARE_SECTOR, MF_KEY_A, ICT_MIFARE_A_KEY, data);
|
||||
if (res != PM3_SUCCESS) {
|
||||
free(data);
|
||||
return res;
|
||||
|
||||
@@ -531,7 +531,7 @@ static int CmdHF14AJookiSim(const char *Cmd) {
|
||||
g_conn.block_after_ACK = true;
|
||||
uint8_t blockwidth = 4, counter = 0, blockno = 0;
|
||||
|
||||
// 12 is the size of the struct the fct mfEmlSetMem_xt uses to transfer to device
|
||||
// 12 is the size of the struct the fct mf_eml_set_mem_xt uses to transfer to device
|
||||
uint16_t max_avail_blocks = ((PM3_CMD_DATA_SIZE - 12) / blockwidth) * blockwidth;
|
||||
|
||||
while (datalen) {
|
||||
@@ -542,7 +542,7 @@ static int CmdHF14AJookiSim(const char *Cmd) {
|
||||
uint16_t chunk_size = MIN(max_avail_blocks, datalen);
|
||||
uint16_t blocks_to_send = chunk_size / blockwidth;
|
||||
|
||||
if (mfEmlSetMem_xt(data + counter, blockno, blocks_to_send, blockwidth) != PM3_SUCCESS) {
|
||||
if (mf_eml_set_mem_xt(data + counter, blockno, blocks_to_send, blockwidth) != PM3_SUCCESS) {
|
||||
PrintAndLogEx(FAILED, "Cant set emul block: %3d", blockno);
|
||||
free(data);
|
||||
return PM3_ESOFT;
|
||||
|
||||
+90
-90
File diff suppressed because it is too large
Load Diff
@@ -1914,7 +1914,7 @@ static int CmdHFMFPMAD(const char *Cmd) {
|
||||
if (aaid == mad[i]) {
|
||||
|
||||
uint8_t vsector[16 * 4] = {0};
|
||||
if (mfReadSector(i + 1, keyB ? MF_KEY_B : MF_KEY_A, akey, vsector)) {
|
||||
if (mf_read_sector(i + 1, keyB ? MF_KEY_B : MF_KEY_A, akey, vsector)) {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(ERR, "error, read sector %d", i + 1);
|
||||
return PM3_ESOFT;
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include "gen4.h"
|
||||
#include "parity.h"
|
||||
|
||||
int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
|
||||
int mf_dark_side(uint8_t blockno, uint8_t key_type, uint64_t *key) {
|
||||
uint32_t uid = 0;
|
||||
uint32_t nt = 0, nr = 0, ar = 0;
|
||||
uint64_t par_list = 0, ks_list = 0;
|
||||
@@ -189,7 +189,7 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
|
||||
}
|
||||
}
|
||||
|
||||
if (mfCheckKeys(blockno, key_type - 0x60, false, size, keyBlock, key) == PM3_SUCCESS) {
|
||||
if (mf_check_keys(blockno, key_type - 0x60, false, size, keyBlock, key) == PM3_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -208,7 +208,7 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int mfCheckKeys(uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keycnt, uint8_t *keyBlock, uint64_t *key) {
|
||||
int mf_check_keys(uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keycnt, uint8_t *keyBlock, uint64_t *key) {
|
||||
if (key) {
|
||||
*key = -1;
|
||||
}
|
||||
@@ -249,7 +249,7 @@ int mfCheckKeys(uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keyc
|
||||
// 0 == ok all keys found
|
||||
// 1 ==
|
||||
// 2 == Time-out, aborting
|
||||
int mfCheckKeys_fast_ex(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk, uint8_t strategy,
|
||||
int mf_check_keys_fast_ex(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk, uint8_t strategy,
|
||||
uint32_t size, uint8_t *keyBlock, sector_t *e_sector, bool use_flashmemory,
|
||||
bool verbose, bool quiet, uint16_t singleSectorParams) {
|
||||
|
||||
@@ -357,15 +357,15 @@ int mfCheckKeys_fast_ex(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChun
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
int mfCheckKeys_fast(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk, uint8_t strategy,
|
||||
int mf_check_keys_fast(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk, uint8_t strategy,
|
||||
uint32_t size, uint8_t *keyBlock, sector_t *e_sector, bool use_flashmemory, bool verbose) {
|
||||
return mfCheckKeys_fast_ex(sectorsCnt, firstChunk, lastChunk, strategy, size, keyBlock, e_sector, use_flashmemory, verbose, false, 0);
|
||||
return mf_check_keys_fast_ex(sectorsCnt, firstChunk, lastChunk, strategy, size, keyBlock, e_sector, use_flashmemory, verbose, false, 0);
|
||||
}
|
||||
|
||||
// Trigger device to use a binary file on flash mem as keylist for mfCheckKeys.
|
||||
// As of now, 255 keys possible in the file
|
||||
// 6 * 255 = 1500 bytes
|
||||
int mfCheckKeys_file(uint8_t *destfn, uint64_t *key) {
|
||||
int mf_check_keys_file(uint8_t *destfn, uint64_t *key) {
|
||||
*key = -1;
|
||||
clearCommandBuffer();
|
||||
|
||||
@@ -412,7 +412,7 @@ int mfCheckKeys_file(uint8_t *destfn, uint64_t *key) {
|
||||
|
||||
// PM3 imp of J-Run mf_key_brute (part 2)
|
||||
// ref: https://github.com/J-Run/mf_key_brute
|
||||
int mfKeyBrute(uint8_t blockNo, uint8_t keyType, const uint8_t *key, uint64_t *resultkey) {
|
||||
int mf_key_brute(uint8_t blockNo, uint8_t keyType, const uint8_t *key, uint64_t *resultkey) {
|
||||
|
||||
uint64_t key64;
|
||||
uint8_t found = false;
|
||||
@@ -441,7 +441,7 @@ int mfKeyBrute(uint8_t blockNo, uint8_t keyType, const uint8_t *key, uint64_t *r
|
||||
memcpy(keyBlock, candidates + i, KEYBLOCK_SIZE);
|
||||
|
||||
// check a block of generated key candidates.
|
||||
if (mfCheckKeys(blockNo, keyType, true, KEYS_IN_BLOCK, keyBlock, &key64) == PM3_SUCCESS) {
|
||||
if (mf_check_keys(blockNo, keyType, true, KEYS_IN_BLOCK, keyBlock, &key64) == PM3_SUCCESS) {
|
||||
*resultkey = key64;
|
||||
found = true;
|
||||
break;
|
||||
@@ -483,7 +483,7 @@ __attribute__((force_align_arg_pointer))
|
||||
return statelist->head.slhead;
|
||||
}
|
||||
|
||||
int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKey, bool calibrate) {
|
||||
int mf_nested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKey, bool calibrate) {
|
||||
|
||||
uint32_t uid;
|
||||
StateList_t statelists[2];
|
||||
@@ -625,7 +625,7 @@ int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo,
|
||||
num_to_bytes(key64, 6, keyBlock + j * MIFARE_KEY_SIZE);
|
||||
}
|
||||
|
||||
if (mfCheckKeys(statelists[0].blockNo, statelists[0].keyType, false, size, keyBlock, &key64) == PM3_SUCCESS) {
|
||||
if (mf_check_keys(statelists[0].blockNo, statelists[0].keyType, false, size, keyBlock, &key64) == PM3_SUCCESS) {
|
||||
free(statelists[0].head.slhead);
|
||||
free(statelists[1].head.slhead);
|
||||
num_to_bytes(key64, 6, resultKey);
|
||||
@@ -669,7 +669,7 @@ out:
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
int mfStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKey) {
|
||||
int mf_static_nested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKey) {
|
||||
|
||||
uint32_t uid;
|
||||
StateList_t statelists[2];
|
||||
@@ -902,9 +902,9 @@ int mfStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBl
|
||||
free(mem);
|
||||
return res;
|
||||
}
|
||||
res = mfCheckKeys_file(fn, &key64);
|
||||
res = mf_check_keys_file(fn, &key64);
|
||||
} else {
|
||||
res = mfCheckKeys(statelists[0].blockNo, statelists[0].keyType, true, chunk, mem, &key64);
|
||||
res = mf_check_keys(statelists[0].blockNo, statelists[0].keyType, true, chunk, mem, &key64);
|
||||
}
|
||||
|
||||
if (res == PM3_SUCCESS) {
|
||||
@@ -949,7 +949,7 @@ out:
|
||||
}
|
||||
|
||||
// MIFARE
|
||||
int mfReadSector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t *data) {
|
||||
int mf_read_sector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t *data) {
|
||||
|
||||
clearCommandBuffer();
|
||||
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
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int mfReadBlock(uint8_t blockNo, uint8_t keyType, const uint8_t *key, uint8_t *data) {
|
||||
int mf_read_block(uint8_t blockNo, uint8_t keyType, const uint8_t *key, uint8_t *data) {
|
||||
mf_readblock_t payload = {
|
||||
.blockno = blockNo,
|
||||
.keytype = keyType
|
||||
@@ -994,7 +994,7 @@ int mfReadBlock(uint8_t blockNo, uint8_t keyType, const uint8_t *key, uint8_t *d
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int mfWriteBlock(uint8_t blockno, uint8_t keyType, const uint8_t *key, uint8_t *block) {
|
||||
int mf_write_block(uint8_t blockno, uint8_t keyType, const uint8_t *key, uint8_t *block) {
|
||||
|
||||
uint8_t data[26];
|
||||
memcpy(data, key, MIFARE_KEY_SIZE);
|
||||
@@ -1014,19 +1014,19 @@ int mfWriteBlock(uint8_t blockno, uint8_t keyType, const uint8_t *key, uint8_t *
|
||||
return res;
|
||||
}
|
||||
|
||||
int mfWriteSector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t *sector){
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int res = mfWriteBlock((sectorNo * 4) + i, keyType, key, sector + ( i * MFBLOCK_SIZE ));
|
||||
if (res != PM3_SUCCESS) {
|
||||
return (i == 0) ? PM3_EFAILED : PM3_EPARTIAL;
|
||||
int mf_write_sector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t *sector){
|
||||
int res;
|
||||
for (int i=0;i<4; i++){
|
||||
res = mf_write_block((sectorNo*4)+i, keyType, key, sector+(i*MFBLOCK_SIZE));
|
||||
if (res != PM3_SUCCESS){
|
||||
return (i==0)?PM3_EFAILED:PM3_EPARTIAL;
|
||||
}
|
||||
}
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
// EMULATOR
|
||||
int mfEmlGetMem(uint8_t *data, int blockNum, int blocksCount) {
|
||||
int mf_eml_get_mem(uint8_t *data, int blockNum, int blocksCount) {
|
||||
|
||||
size_t size = blocksCount * MFBLOCK_SIZE;
|
||||
if (size > PM3_CMD_DATA_SIZE) {
|
||||
@@ -1056,11 +1056,11 @@ int mfEmlGetMem(uint8_t *data, int blockNum, int blocksCount) {
|
||||
return resp.status;
|
||||
}
|
||||
|
||||
int mfEmlSetMem(uint8_t *data, int blockNum, int blocksCount) {
|
||||
return mfEmlSetMem_xt(data, blockNum, blocksCount, MFBLOCK_SIZE);
|
||||
int mf_elm_set_mem(uint8_t *data, int blockNum, int blocksCount) {
|
||||
return mf_eml_set_mem_xt(data, blockNum, blocksCount, MFBLOCK_SIZE);
|
||||
}
|
||||
|
||||
int mfEmlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int blockBtWidth) {
|
||||
int mf_eml_set_mem_xt(uint8_t *data, int blockNum, int blocksCount, int blockBtWidth) {
|
||||
|
||||
struct p {
|
||||
uint8_t blockno;
|
||||
@@ -1089,13 +1089,13 @@ int mfEmlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int blockBtWidt
|
||||
}
|
||||
|
||||
// "MAGIC" CARD
|
||||
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) {
|
||||
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) {
|
||||
|
||||
uint8_t params = MAGIC_SINGLE | (gdm ? MAGIC_GDM_ALT_WUPC : MAGIC_WUPC);
|
||||
uint8_t block0[MFBLOCK_SIZE];
|
||||
memset(block0, 0x00, sizeof(block0));
|
||||
|
||||
int res = mfCGetBlock(0, block0, params);
|
||||
int res = mf_chinese_get_block(0, block0, params);
|
||||
if (res == 0) {
|
||||
PrintAndLogEx(SUCCESS, "old block 0... %s", sprint_hex_inrow(block0, sizeof(block0)));
|
||||
if (old_uid) {
|
||||
@@ -1140,11 +1140,11 @@ int mfCSetUID(uint8_t *uid, uint8_t uidlen, const uint8_t *atqa, const uint8_t *
|
||||
params |= MAGIC_WIPE;
|
||||
}
|
||||
|
||||
res = mfCSetBlock(0, block0, NULL, params);
|
||||
res = mf_chinese_set_block(0, block0, NULL, params);
|
||||
if (res == PM3_SUCCESS) {
|
||||
params = MAGIC_SINGLE | MAGIC_WUPC;
|
||||
memset(block0, 0, sizeof(block0));
|
||||
res = mfCGetBlock(0, block0, params);
|
||||
res = mf_chinese_get_block(0, block0, params);
|
||||
if (res == 0) {
|
||||
if (verifed_uid) {
|
||||
memcpy(verifed_uid, block0, uidlen);
|
||||
@@ -1154,7 +1154,7 @@ int mfCSetUID(uint8_t *uid, uint8_t uidlen, const uint8_t *atqa, const uint8_t *
|
||||
return res;
|
||||
}
|
||||
|
||||
int mfCWipe(uint8_t *uid, const uint8_t *atqa, const uint8_t *sak, uint8_t gdm) {
|
||||
int mf_chinese_wipe(uint8_t *uid, const uint8_t *atqa, const uint8_t *sak, uint8_t gdm) {
|
||||
uint8_t block0[MFBLOCK_SIZE] = {0x00, 0x56, 0x78, 0xBB, 0x95, 0x08, 0x04, 0x00, 0x02, 0xB2, 0x1E, 0x24, 0x23, 0x27, 0x1E, 0x1D};
|
||||
// uint8_t block0[MFBLOCK_SIZE] = {0x04, 0x03, 0x02, 0x01, 0x04, 0x08, 0x04, 0x00, 0x64, 0xB9, 0x95, 0x11, 0x4D, 0x20, 0x42, 0x09};
|
||||
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)
|
||||
PrintAndLogEx(INPLACE, "wipe block %d", blockNo);
|
||||
|
||||
if (blockNo == 0) {
|
||||
res = mfCSetBlock(blockNo, block0, NULL, params);
|
||||
res = mf_chinese_set_block(blockNo, block0, NULL, params);
|
||||
} else {
|
||||
if (mfIsSectorTrailer(blockNo))
|
||||
res = mfCSetBlock(blockNo, blockK, NULL, params);
|
||||
res = mf_chinese_set_block(blockNo, blockK, NULL, params);
|
||||
else
|
||||
res = mfCSetBlock(blockNo, blockD, NULL, params);
|
||||
res = mf_chinese_set_block(blockNo, blockD, NULL, params);
|
||||
}
|
||||
|
||||
if (res == PM3_SUCCESS)
|
||||
@@ -1204,7 +1204,7 @@ int mfCWipe(uint8_t *uid, const uint8_t *atqa, const uint8_t *sak, uint8_t gdm)
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int mfCSetBlock(uint8_t blockNo, uint8_t *data, uint8_t *uid, uint8_t params) {
|
||||
int mf_chinese_set_block(uint8_t blockNo, uint8_t *data, uint8_t *uid, uint8_t params) {
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_MIFARE_CSETBL, params, blockNo, 0, data, MFBLOCK_SIZE);
|
||||
PacketResponseNG resp;
|
||||
@@ -1224,7 +1224,7 @@ int mfCSetBlock(uint8_t blockNo, uint8_t *data, uint8_t *uid, uint8_t params) {
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int mfCGetBlock(uint8_t blockNo, uint8_t *data, uint8_t params) {
|
||||
int mf_chinese_get_block(uint8_t blockNo, uint8_t *data, uint8_t params) {
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_MIFARE_CGETBL, params, blockNo, 0, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
@@ -1241,7 +1241,7 @@ int mfCGetBlock(uint8_t blockNo, uint8_t *data, uint8_t params) {
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int mfGen3UID(uint8_t *uid, uint8_t uidlen, uint8_t *oldUid) {
|
||||
int mf_chinese_gen_3_uid(uint8_t *uid, uint8_t uidlen, uint8_t *oldUid) {
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_MIFARE_GEN3UID, uidlen, 0, 0, uid, uidlen);
|
||||
PacketResponseNG resp;
|
||||
@@ -1256,7 +1256,7 @@ int mfGen3UID(uint8_t *uid, uint8_t uidlen, uint8_t *oldUid) {
|
||||
}
|
||||
}
|
||||
|
||||
int mfGen3Block(uint8_t *block, int blockLen, uint8_t *newBlock) {
|
||||
int mf_chinese_gen_3_block(uint8_t *block, int blockLen, uint8_t *newBlock) {
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_MIFARE_GEN3BLK, blockLen, 0, 0, block, MFBLOCK_SIZE);
|
||||
PacketResponseNG resp;
|
||||
@@ -1271,7 +1271,7 @@ int mfGen3Block(uint8_t *block, int blockLen, uint8_t *newBlock) {
|
||||
}
|
||||
}
|
||||
|
||||
int mfGen3Freeze(void) {
|
||||
int mf_chinese_gen_3_freeze(void) {
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_HF_MIFARE_GEN3FREEZ, NULL, 0);
|
||||
PacketResponseNG resp;
|
||||
@@ -1301,7 +1301,7 @@ void mf_crypto1_decrypt(struct Crypto1State *pcs, uint8_t *data, int len, bool i
|
||||
}
|
||||
}
|
||||
|
||||
int tryDecryptWord(uint32_t nt, uint32_t ar_enc, uint32_t at_enc, uint8_t *data, int len) {
|
||||
int try_decrypt_word(uint32_t nt, uint32_t ar_enc, uint32_t at_enc, uint8_t *data, int len) {
|
||||
|
||||
PrintAndLogEx(SUCCESS, "encrypted data... %s", sprint_hex(data, len));
|
||||
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) {
|
||||
|
||||
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 = mf_check_keys(69, MF_KEY_B, false, 1, (uint8_t *)g_mifare_signature_key_b, &key);
|
||||
return (res == PM3_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -1645,17 +1645,17 @@ int read_mfc_ev1_signature(uint8_t *signature) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
uint8_t sign[32] = {0};
|
||||
int res = mfReadBlock(69, MF_KEY_B, g_mifare_signature_key_b, sign);
|
||||
int res = mf_read_block(69, MF_KEY_B, g_mifare_signature_key_b, sign);
|
||||
if (res == PM3_SUCCESS) {
|
||||
res = mfReadBlock(70, MF_KEY_B, g_mifare_signature_key_b, sign + 16);
|
||||
res = mf_read_block(70, MF_KEY_B, g_mifare_signature_key_b, sign + 16);
|
||||
if (res == PM3_SUCCESS) {
|
||||
memcpy(signature, sign, sizeof(sign));
|
||||
}
|
||||
} else {
|
||||
// try QL88
|
||||
res = mfReadBlock(69, MF_KEY_B, g_mifare_ql88_signature_key_b, sign);
|
||||
res = mf_read_block(69, MF_KEY_B, g_mifare_ql88_signature_key_b, sign);
|
||||
if (res == PM3_SUCCESS) {
|
||||
res = mfReadBlock(70, MF_KEY_B, g_mifare_ql88_signature_key_b, sign + 16);
|
||||
res = mf_read_block(70, MF_KEY_B, g_mifare_ql88_signature_key_b, sign + 16);
|
||||
if (res == PM3_SUCCESS) {
|
||||
memcpy(signature, sign, sizeof(sign));
|
||||
}
|
||||
|
||||
@@ -70,41 +70,41 @@ typedef struct {
|
||||
#define KEYBLOCK_SIZE (KEYS_IN_BLOCK * MIFARE_KEY_SIZE)
|
||||
#define CANDIDATE_SIZE (0xFFFF * MIFARE_KEY_SIZE)
|
||||
|
||||
int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key);
|
||||
int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKey, bool calibrate);
|
||||
int mfStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKey);
|
||||
int mfCheckKeys(uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keycnt, uint8_t *keyBlock, uint64_t *key);
|
||||
int mfCheckKeys_fast(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk,
|
||||
int mf_dark_side(uint8_t blockno, uint8_t key_type, uint64_t *key);
|
||||
int mf_nested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKey, bool calibrate);
|
||||
int mf_static_nested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKey);
|
||||
int mf_check_keys(uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keycnt, uint8_t *keyBlock, uint64_t *key);
|
||||
int mf_check_keys_fast(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk,
|
||||
uint8_t strategy, uint32_t size, uint8_t *keyBlock, sector_t *e_sector,
|
||||
bool use_flashmemory, bool verbose);
|
||||
int mfCheckKeys_fast_ex(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk, uint8_t strategy,
|
||||
int mf_check_keys_fast_ex(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk, uint8_t strategy,
|
||||
uint32_t size, uint8_t *keyBlock, sector_t *e_sector, bool use_flashmemory,
|
||||
bool verbose, bool quiet, uint16_t singleSectorParams);
|
||||
|
||||
int mfCheckKeys_file(uint8_t *destfn, uint64_t *key);
|
||||
int mf_check_keys_file(uint8_t *destfn, uint64_t *key);
|
||||
|
||||
int mfKeyBrute(uint8_t blockNo, uint8_t keyType, const uint8_t *key, uint64_t *resultkey);
|
||||
int mf_key_brute(uint8_t blockNo, uint8_t keyType, const uint8_t *key, uint64_t *resultkey);
|
||||
|
||||
int mfReadSector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t *data);
|
||||
int mfReadBlock(uint8_t blockNo, uint8_t keyType, const uint8_t *key, uint8_t *data);
|
||||
int mf_read_sector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t *data);
|
||||
int mf_read_block(uint8_t blockNo, uint8_t keyType, const uint8_t *key, uint8_t *data);
|
||||
|
||||
int mfWriteBlock(uint8_t blockno, uint8_t keyType, const uint8_t *key, uint8_t *block);
|
||||
int mfWriteSector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t *sector);
|
||||
int mf_write_block(uint8_t blockno, uint8_t keyType, const uint8_t *key, uint8_t *block);
|
||||
int mf_write_sector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t *sector);
|
||||
|
||||
int mfEmlGetMem(uint8_t *data, int blockNum, int blocksCount);
|
||||
int mfEmlSetMem(uint8_t *data, int blockNum, int blocksCount);
|
||||
int mfEmlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int blockBtWidth);
|
||||
int mf_eml_get_mem(uint8_t *data, int blockNum, int blocksCount);
|
||||
int mf_elm_set_mem(uint8_t *data, int blockNum, int blocksCount);
|
||||
int mf_eml_set_mem_xt(uint8_t *data, int blockNum, int blocksCount, int blockBtWidth);
|
||||
|
||||
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);
|
||||
int mfCWipe(uint8_t *uid, const uint8_t *atqa, const uint8_t *sak, uint8_t gdm);
|
||||
int mfCSetBlock(uint8_t blockNo, uint8_t *data, uint8_t *uid, uint8_t params);
|
||||
int mfCGetBlock(uint8_t blockNo, uint8_t *data, uint8_t params);
|
||||
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);
|
||||
int mf_chinese_wipe(uint8_t *uid, const uint8_t *atqa, const uint8_t *sak, uint8_t gdm);
|
||||
int mf_chinese_set_block(uint8_t blockNo, uint8_t *data, uint8_t *uid, uint8_t params);
|
||||
int mf_chinese_get_block(uint8_t blockNo, uint8_t *data, uint8_t params);
|
||||
|
||||
int mfGen3UID(uint8_t *uid, uint8_t uidlen, uint8_t *oldUid);
|
||||
int mfGen3Block(uint8_t *block, int blockLen, uint8_t *newBlock);
|
||||
int mfGen3Freeze(void);
|
||||
int mf_chinese_gen_3_uid(uint8_t *uid, uint8_t uidlen, uint8_t *oldUid);
|
||||
int mf_chinese_gen_3_block(uint8_t *block, int blockLen, uint8_t *newBlock);
|
||||
int mf_chinese_gen_3_freeze(void);
|
||||
|
||||
int tryDecryptWord(uint32_t nt, uint32_t ar_enc, uint32_t at_enc, uint8_t *data, int len);
|
||||
int try_decrypt_word(uint32_t nt, uint32_t ar_enc, uint32_t at_enc, uint8_t *data, int len);
|
||||
|
||||
int detect_classic_prng(void);
|
||||
int detect_classic_nackbug(bool verbose);
|
||||
|
||||
@@ -423,7 +423,7 @@ static int l_mfDarkside(lua_State *L) {
|
||||
break;
|
||||
}
|
||||
|
||||
int retval = mfDarkside(blockno & 0xFF, keytype & 0xFF, &key);
|
||||
int retval = mf_dark_side(blockno & 0xFF, keytype & 0xFF, &key);
|
||||
|
||||
uint8_t dest_key[8];
|
||||
num_to_bytes(key, sizeof(dest_key), dest_key);
|
||||
|
||||
Reference in New Issue
Block a user