mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
rmeoved some fct devices side regarding eml get/ set
This commit is contained in:
parent
40533497d3
commit
6ba002725f
10 changed files with 45 additions and 64 deletions
|
@ -308,15 +308,22 @@ bool RAMFUNC LogTraceBits(const uint8_t *btBytes, uint16_t bitLen, uint32_t time
|
||||||
// Emulator memory
|
// Emulator memory
|
||||||
uint8_t emlSet(uint8_t *data, uint32_t offset, uint32_t length) {
|
uint8_t emlSet(uint8_t *data, uint32_t offset, uint32_t length) {
|
||||||
uint8_t *mem = BigBuf_get_EM_addr();
|
uint8_t *mem = BigBuf_get_EM_addr();
|
||||||
if (offset + length < CARD_MEMORY_SIZE) {
|
if (offset + length <= CARD_MEMORY_SIZE) {
|
||||||
memcpy(mem + offset, data, length);
|
memcpy(mem + offset, data, length);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Dbprintf("Error, trying to set memory outside of bounds! " _RED_("%d") " > %d", (offset + length), CARD_MEMORY_SIZE);
|
Dbprintf("Error, trying to set memory outside of bounds! " _RED_("%d") " > %d", (offset + length), CARD_MEMORY_SIZE);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
uint8_t emlGet(uint8_t *out, uint32_t offset, uint32_t length) {
|
||||||
|
uint8_t *mem = BigBuf_get_EM_addr();
|
||||||
|
if (offset + length <= CARD_MEMORY_SIZE) {
|
||||||
|
memcpy(out, mem + offset, length);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
Dbprintf("Error, trying to read memory outside of bounds! " _RED_("%d") " > %d", (offset + length), CARD_MEMORY_SIZE);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// get the address of the ToSend buffer. Allocate part of Bigbuf for it, if not yet done
|
// get the address of the ToSend buffer. Allocate part of Bigbuf for it, if not yet done
|
||||||
tosend_t *get_tosend(void) {
|
tosend_t *get_tosend(void) {
|
||||||
|
|
|
@ -56,6 +56,7 @@ bool RAMFUNC LogTraceBits(const uint8_t *btBytes, uint16_t bitLen, uint32_t time
|
||||||
bool LogTrace_ISO15693(const uint8_t *bytes, uint16_t len, uint32_t ts_start, uint32_t ts_end, uint8_t *parity, bool reader2tag);
|
bool LogTrace_ISO15693(const uint8_t *bytes, uint16_t len, uint32_t ts_start, uint32_t ts_end, uint8_t *parity, bool reader2tag);
|
||||||
|
|
||||||
uint8_t emlSet(uint8_t *data, uint32_t offset, uint32_t length);
|
uint8_t emlSet(uint8_t *data, uint32_t offset, uint32_t length);
|
||||||
|
uint8_t emlGet(uint8_t *out, uint32_t offset, uint32_t length);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int max;
|
int max;
|
||||||
|
|
|
@ -293,7 +293,7 @@ static void ReadLastTagFromFlash(void) {
|
||||||
rdv40_spiffs_read_as_filetype((char *)HFCOLIN_LASTTAG_SYMLINK, (uint8_t *)mem, len, RDV40_SPIFFS_SAFETY_SAFE);
|
rdv40_spiffs_read_as_filetype((char *)HFCOLIN_LASTTAG_SYMLINK, (uint8_t *)mem, len, RDV40_SPIFFS_SAFETY_SAFE);
|
||||||
|
|
||||||
// copy 64blocks (16bytes) starting w block0, to emulator mem.
|
// copy 64blocks (16bytes) starting w block0, to emulator mem.
|
||||||
emlSetMem(mem, 0, 64);
|
emlSetMem_xt(mem, 0, 64, 16);
|
||||||
|
|
||||||
DbprintfEx(FLAG_NEWLINE, "[OK] Last tag recovered from FLASHMEM set to emulator");
|
DbprintfEx(FLAG_NEWLINE, "[OK] Last tag recovered from FLASHMEM set to emulator");
|
||||||
cjSetCursLeft();
|
cjSetCursLeft();
|
||||||
|
@ -650,7 +650,7 @@ failtag:
|
||||||
for (uint8_t t = 0; t < 2; t++) {
|
for (uint8_t t = 0; t < 2; t++) {
|
||||||
memcpy(mblock + t * 10, foundKey[t][sectorNo], 6);
|
memcpy(mblock + t * 10, foundKey[t][sectorNo], 6);
|
||||||
}
|
}
|
||||||
emlSetMem(mblock, FirstBlockOfSector(sectorNo) + NumBlocksPerSector(sectorNo) - 1, 1);
|
emlSetMem_xt(mblock, FirstBlockOfSector(sectorNo) + NumBlocksPerSector(sectorNo) - 1, 1, 16);
|
||||||
}
|
}
|
||||||
cjSetCursLeft();
|
cjSetCursLeft();
|
||||||
|
|
||||||
|
@ -827,12 +827,12 @@ int e_MifareECardLoad(uint32_t numofsectors, uint8_t keytype) {
|
||||||
};
|
};
|
||||||
if (isOK) {
|
if (isOK) {
|
||||||
if (blockNo < NumBlocksPerSector(s) - 1) {
|
if (blockNo < NumBlocksPerSector(s) - 1) {
|
||||||
emlSetMem(dataoutbuf, FirstBlockOfSector(s) + blockNo, 1);
|
emlSetMem_xt(dataoutbuf, FirstBlockOfSector(s) + blockNo, 1, 16);
|
||||||
} else {
|
} else {
|
||||||
// sector trailer, keep the keys, set only the AC
|
// sector trailer, keep the keys, set only the AC
|
||||||
emlGetMem(dataoutbuf2, FirstBlockOfSector(s) + blockNo, 1);
|
emlGetMem(dataoutbuf2, FirstBlockOfSector(s) + blockNo, 1);
|
||||||
memcpy(&dataoutbuf2[6], &dataoutbuf[6], 4);
|
memcpy(&dataoutbuf2[6], &dataoutbuf[6], 4);
|
||||||
emlSetMem(dataoutbuf2, FirstBlockOfSector(s) + blockNo, 1);
|
emlSetMem_xt(dataoutbuf2, FirstBlockOfSector(s) + blockNo, 1, 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,12 +273,12 @@ static int saMifareECardLoad(uint32_t numofsectors, uint8_t keytype) {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (blockNo < NumBlocksPerSector(s) - 1) {
|
if (blockNo < NumBlocksPerSector(s) - 1) {
|
||||||
emlSetMem(dataoutbuf, FirstBlockOfSector(s) + blockNo, 1);
|
emlSetMem_xt(dataoutbuf, FirstBlockOfSector(s) + blockNo, 1, 16);
|
||||||
} else {
|
} else {
|
||||||
// sector trailer, keep the keys, set only the AC
|
// sector trailer, keep the keys, set only the AC
|
||||||
emlGetMem(dataoutbuf2, FirstBlockOfSector(s) + blockNo, 1);
|
emlGetMem(dataoutbuf2, FirstBlockOfSector(s) + blockNo, 1);
|
||||||
memcpy(&dataoutbuf2[6], &dataoutbuf[6], 4);
|
memcpy(&dataoutbuf2[6], &dataoutbuf[6], 4);
|
||||||
emlSetMem(dataoutbuf2, FirstBlockOfSector(s) + blockNo, 1);
|
emlSetMem_xt(dataoutbuf2, FirstBlockOfSector(s) + blockNo, 1, 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -505,7 +505,7 @@ void RunMod(void) {
|
||||||
memcpy(mblock + t * 10, foundKey[t][sectorNo], 6);
|
memcpy(mblock + t * 10, foundKey[t][sectorNo], 6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emlSetMem(mblock, FirstBlockOfSector(sectorNo) + NumBlocksPerSector(sectorNo) - 1, 1);
|
emlSetMem_xt(mblock, FirstBlockOfSector(sectorNo) + NumBlocksPerSector(sectorNo) - 1, 1, 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2119,7 +2119,6 @@ void Iso15693InitTag(void) {
|
||||||
StartCountSspClk();
|
StartCountSspClk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EmlClearIso15693(void) {
|
void EmlClearIso15693(void) {
|
||||||
// Resetting the bitstream also frees the BigBuf memory, so we do this here to prevent
|
// Resetting the bitstream also frees the BigBuf memory, so we do this here to prevent
|
||||||
// an inconvenient reset in the future by Iso15693InitTag
|
// an inconvenient reset in the future by Iso15693InitTag
|
||||||
|
@ -2128,16 +2127,6 @@ void EmlClearIso15693(void) {
|
||||||
reply_ng(CMD_HF_ISO15693_EML_CLEAR, PM3_SUCCESS, NULL, 0);
|
reply_ng(CMD_HF_ISO15693_EML_CLEAR, PM3_SUCCESS, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmlSetMemIso15693(uint8_t count, uint8_t *data, uint32_t offset) {
|
|
||||||
uint8_t *emCARD = BigBuf_get_EM_addr();
|
|
||||||
memcpy(emCARD + offset, data, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmlGetMemIso15693(uint8_t count, uint8_t *output, uint32_t offset) {
|
|
||||||
uint8_t *emCARD = BigBuf_get_EM_addr();
|
|
||||||
memcpy(output, emCARD + offset, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Simulate an ISO15693 TAG, perform anti-collision and then print any reader commands
|
// Simulate an ISO15693 TAG, perform anti-collision and then print any reader commands
|
||||||
// all demodulation performed in arm rather than host. - greg
|
// all demodulation performed in arm rather than host. - greg
|
||||||
void SimTagIso15693(uint8_t *uid, uint8_t block_size) {
|
void SimTagIso15693(uint8_t *uid, uint8_t block_size) {
|
||||||
|
@ -2296,8 +2285,11 @@ void SimTagIso15693(uint8_t *uid, uint8_t block_size) {
|
||||||
}
|
}
|
||||||
// Block data
|
// Block data
|
||||||
if (block_size * (block_idx + j + 1) <= CARD_MEMORY_SIZE) {
|
if (block_size * (block_idx + j + 1) <= CARD_MEMORY_SIZE) {
|
||||||
EmlGetMemIso15693(block_size, resp_readblock + (work_offset + security_offset),
|
emlGet(
|
||||||
block_size * (block_idx + j));
|
resp_readblock + (work_offset + security_offset),
|
||||||
|
block_size * (block_idx + j),
|
||||||
|
block_size
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
memset(resp_readblock + work_offset + security_offset, 0, block_size);
|
memset(resp_readblock + work_offset + security_offset, 0, block_size);
|
||||||
}
|
}
|
||||||
|
@ -2334,7 +2326,7 @@ void SimTagIso15693(uint8_t *uid, uint8_t block_size) {
|
||||||
uint8_t *data = cmd + 3 + address_offset + multi_offset;
|
uint8_t *data = cmd + 3 + address_offset + multi_offset;
|
||||||
|
|
||||||
// write data
|
// write data
|
||||||
EmlSetMemIso15693(block_count * block_size, data, block_idx * block_size);
|
emlSet(data, (block_idx * block_size), (block_count * block_size));
|
||||||
|
|
||||||
// Build WRITE_(MULTI_)BLOCK response
|
// Build WRITE_(MULTI_)BLOCK response
|
||||||
int response_length = 3;
|
int response_length = 3;
|
||||||
|
|
|
@ -47,8 +47,6 @@ int GetIso15693AnswerFromTag(uint8_t *response, uint16_t max_len, uint16_t timeo
|
||||||
void AcquireRawAdcSamplesIso15693(void);
|
void AcquireRawAdcSamplesIso15693(void);
|
||||||
void ReaderIso15693(iso15_card_select_t *p_card); // ISO15693 reader
|
void ReaderIso15693(iso15_card_select_t *p_card); // ISO15693 reader
|
||||||
void EmlClearIso15693(void);
|
void EmlClearIso15693(void);
|
||||||
void EmlSetMemIso15693(uint8_t count, uint8_t *data, uint32_t offset);
|
|
||||||
void EmlGetMemIso15693(uint8_t count, uint8_t *output, uint32_t offset);
|
|
||||||
void SimTagIso15693(uint8_t *uid, uint8_t block_size); // simulate an ISO15693 tag
|
void SimTagIso15693(uint8_t *uid, uint8_t block_size); // simulate an ISO15693 tag
|
||||||
void BruteforceIso15693Afi(uint32_t speed); // find an AFI of a tag
|
void BruteforceIso15693Afi(uint32_t speed); // find an AFI of a tag
|
||||||
void DirectTag15693Command(uint32_t datalen, uint32_t speed, uint32_t recv, uint8_t *data); // send arbitrary commands from CLI
|
void DirectTag15693Command(uint32_t datalen, uint32_t speed, uint32_t recv, uint8_t *data); // send arbitrary commands from CLI
|
||||||
|
|
|
@ -2019,15 +2019,6 @@ void MifareEMemClr(void) {
|
||||||
emlClearMem();
|
emlClearMem();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MifareEMemSet(uint8_t blockno, uint8_t blockcnt, uint8_t blockwidth, uint8_t *datain) {
|
|
||||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
|
||||||
|
|
||||||
if (blockwidth == 0)
|
|
||||||
blockwidth = 16; // backwards compat... default bytewidth
|
|
||||||
|
|
||||||
emlSetMem_xt(datain, blockno, blockcnt, blockwidth); // data, block num, blocks count, block byte width
|
|
||||||
}
|
|
||||||
|
|
||||||
void MifareEMemGet(uint8_t blockno, uint8_t blockcnt) {
|
void MifareEMemGet(uint8_t blockno, uint8_t blockcnt) {
|
||||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||||
|
|
||||||
|
@ -2167,9 +2158,9 @@ int MifareECardLoad(uint8_t sectorcnt, uint8_t keytype) {
|
||||||
uint8_t st[16] = {0x00};
|
uint8_t st[16] = {0x00};
|
||||||
emlGetMem(st, tb, 1);
|
emlGetMem(st, tb, 1);
|
||||||
memcpy(st + 6, data + 6, 4);
|
memcpy(st + 6, data + 6, 4);
|
||||||
emlSetMem(st, tb, 1);
|
emlSetMem_xt(st, tb, 1, 16);
|
||||||
} else {
|
} else {
|
||||||
emlSetMem(data, tb, 1);
|
emlSetMem_xt(data, tb, 1, 16);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,6 @@ void MifareChkKeys_fast(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *da
|
||||||
void MifareChkKeys_file(uint8_t *fn);
|
void MifareChkKeys_file(uint8_t *fn);
|
||||||
|
|
||||||
void MifareEMemClr(void);
|
void MifareEMemClr(void);
|
||||||
void MifareEMemSet(uint8_t blockno, uint8_t blockcnt, uint8_t blockwidth, uint8_t *datain);
|
|
||||||
void MifareEMemGet(uint8_t blockno, uint8_t blockcnt);
|
void MifareEMemGet(uint8_t blockno, uint8_t blockcnt);
|
||||||
int MifareECardLoad(uint8_t sectorcnt, uint8_t keytype);
|
int MifareECardLoad(uint8_t sectorcnt, uint8_t keytype);
|
||||||
int MifareECardLoadExt(uint8_t sectorcnt, uint8_t keytype);
|
int MifareECardLoadExt(uint8_t sectorcnt, uint8_t keytype);
|
||||||
|
|
|
@ -1272,7 +1272,7 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t *datain, uint1
|
||||||
memcpy(receivedCmd_dec, response, 16); // don't change anything
|
memcpy(receivedCmd_dec, response, 16); // don't change anything
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emlSetMem(receivedCmd_dec, cardWRBL, 1);
|
emlSetMem_xt(receivedCmd_dec, cardWRBL, 1, 16);
|
||||||
EmSend4bit(mf_crypto1_encrypt4bit(pcs, CARD_ACK)); // always ACK?
|
EmSend4bit(mf_crypto1_encrypt4bit(pcs, CARD_ACK)); // always ACK?
|
||||||
FpgaDisableTracing();
|
FpgaDisableTracing();
|
||||||
|
|
||||||
|
|
|
@ -617,16 +617,9 @@ uint8_t FirstBlockOfSector(uint8_t sectorNo) {
|
||||||
return sectorNo * 4;
|
return sectorNo * 4;
|
||||||
else
|
else
|
||||||
return 32 * 4 + (sectorNo - 32) * 16;
|
return 32 * 4 + (sectorNo - 32) * 16;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// work with emulator memory
|
// work with emulator memory
|
||||||
void emlSetMem(uint8_t *data, int blockNum, int blocksCount) {
|
|
||||||
uint32_t offset = blockNum * 16;
|
|
||||||
uint32_t len = blocksCount * 16;
|
|
||||||
emlSet(data, offset, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
void emlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int block_width) {
|
void emlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int block_width) {
|
||||||
uint32_t offset = blockNum * block_width;
|
uint32_t offset = blockNum * block_width;
|
||||||
uint32_t len = blocksCount * block_width;
|
uint32_t len = blocksCount * block_width;
|
||||||
|
@ -634,18 +627,18 @@ void emlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int block_width)
|
||||||
}
|
}
|
||||||
|
|
||||||
void emlGetMem(uint8_t *data, int blockNum, int blocksCount) {
|
void emlGetMem(uint8_t *data, int blockNum, int blocksCount) {
|
||||||
uint8_t *emCARD = BigBuf_get_EM_addr();
|
uint8_t *mem = BigBuf_get_EM_addr();
|
||||||
memcpy(data, emCARD + blockNum * 16, blocksCount * 16);
|
memcpy(data, mem + blockNum * 16, blocksCount * 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
void emlGetMemBt(uint8_t *data, int offset, int byteCount) {
|
void emlGetMemBt(uint8_t *data, int offset, int byteCount) {
|
||||||
uint8_t *emCARD = BigBuf_get_EM_addr();
|
uint8_t *mem = BigBuf_get_EM_addr();
|
||||||
memcpy(data, emCARD + offset, byteCount);
|
memcpy(data, mem + offset, byteCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
int emlCheckValBl(int blockNum) {
|
int emlCheckValBl(int blockNum) {
|
||||||
uint8_t *emCARD = BigBuf_get_EM_addr();
|
uint8_t *mem = BigBuf_get_EM_addr();
|
||||||
uint8_t *data = emCARD + blockNum * 16;
|
uint8_t *data = mem + blockNum * 16;
|
||||||
|
|
||||||
if ((data[0] != (data[4] ^ 0xff)) || (data[0] != data[8]) ||
|
if ((data[0] != (data[4] ^ 0xff)) || (data[0] != data[8]) ||
|
||||||
(data[1] != (data[5] ^ 0xff)) || (data[1] != data[9]) ||
|
(data[1] != (data[5] ^ 0xff)) || (data[1] != data[9]) ||
|
||||||
|
@ -659,8 +652,8 @@ int emlCheckValBl(int blockNum) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int emlGetValBl(uint32_t *blReg, uint8_t *blBlock, int blockNum) {
|
int emlGetValBl(uint32_t *blReg, uint8_t *blBlock, int blockNum) {
|
||||||
uint8_t *emCARD = BigBuf_get_EM_addr();
|
uint8_t *mem = BigBuf_get_EM_addr();
|
||||||
uint8_t *data = emCARD + blockNum * 16;
|
uint8_t *data = mem + blockNum * 16;
|
||||||
|
|
||||||
if (emlCheckValBl(blockNum))
|
if (emlCheckValBl(blockNum))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -671,8 +664,8 @@ int emlGetValBl(uint32_t *blReg, uint8_t *blBlock, int blockNum) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int emlSetValBl(uint32_t blReg, uint8_t blBlock, int blockNum) {
|
int emlSetValBl(uint32_t blReg, uint8_t blBlock, int blockNum) {
|
||||||
uint8_t *emCARD = BigBuf_get_EM_addr();
|
uint8_t *mem = BigBuf_get_EM_addr();
|
||||||
uint8_t *data = emCARD + blockNum * 16;
|
uint8_t *data = mem + blockNum * 16;
|
||||||
|
|
||||||
memcpy(data + 0, &blReg, 4);
|
memcpy(data + 0, &blReg, 4);
|
||||||
memcpy(data + 8, &blReg, 4);
|
memcpy(data + 8, &blReg, 4);
|
||||||
|
@ -683,29 +676,29 @@ int emlSetValBl(uint32_t blReg, uint8_t blBlock, int blockNum) {
|
||||||
data[13] = blBlock ^ 0xff;
|
data[13] = blBlock ^ 0xff;
|
||||||
data[14] = blBlock;
|
data[14] = blBlock;
|
||||||
data[15] = blBlock ^ 0xff;
|
data[15] = blBlock ^ 0xff;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t emlGetKey(int sectorNum, int keyType) {
|
uint64_t emlGetKey(int sectorNum, int keyType) {
|
||||||
uint8_t key[6] = {0x00};
|
uint8_t key[6] = {0x00};
|
||||||
uint8_t *em = BigBuf_get_EM_addr();
|
uint8_t *mem = BigBuf_get_EM_addr();
|
||||||
memcpy(key, em + 16 * (FirstBlockOfSector(sectorNum) + NumBlocksPerSector(sectorNum) - 1) + keyType * 10, 6);
|
memcpy(key, mem + 16 * (FirstBlockOfSector(sectorNum) + NumBlocksPerSector(sectorNum) - 1) + keyType * 10, 6);
|
||||||
return bytes_to_num(key, 6);
|
return bytes_to_num(key, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void emlClearMem(void) {
|
void emlClearMem(void) {
|
||||||
const uint8_t trailer[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x80, 0x69, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
const uint8_t trailer[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x80, 0x69, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||||
const uint8_t uid[] = {0xe6, 0x84, 0x87, 0xf3, 0x16, 0x88, 0x04, 0x00, 0x46, 0x8e, 0x45, 0x55, 0x4d, 0x70, 0x41, 0x04};
|
const uint8_t uid[] = {0xe6, 0x84, 0x87, 0xf3, 0x16, 0x88, 0x04, 0x00, 0x46, 0x8e, 0x45, 0x55, 0x4d, 0x70, 0x41, 0x04};
|
||||||
uint8_t *emCARD = BigBuf_get_EM_addr();
|
uint8_t *mem = BigBuf_get_EM_addr();
|
||||||
memset(emCARD, 0, CARD_MEMORY_SIZE);
|
memset(mem, 0, CARD_MEMORY_SIZE);
|
||||||
|
|
||||||
// fill sectors trailer data
|
// fill sectors trailer data
|
||||||
for (uint16_t b = 3; b < MIFARE_4K_MAXBLOCK; ((b < MIFARE_2K_MAXBLOCK - 4) ? (b += 4) : (b += 16)))
|
for (uint16_t b = 3; b < MIFARE_4K_MAXBLOCK; ((b < MIFARE_2K_MAXBLOCK - 4) ? (b += 4) : (b += 16))) {
|
||||||
emlSetMem((uint8_t *)trailer, b, 1);
|
emlSetMem_xt((uint8_t *)trailer, b, 1, 16);
|
||||||
|
}
|
||||||
|
|
||||||
// uid
|
// uid
|
||||||
emlSetMem((uint8_t *)uid, 0, 1);
|
emlSetMem_xt((uint8_t *)uid, 0, 1, 16);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue