mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
chg: removed debugstatements, the code doesnt use them
This commit is contained in:
parent
b22ea6f846
commit
30be05ec3f
1 changed files with 45 additions and 80 deletions
|
@ -232,14 +232,6 @@ static void cjSetCursLeft(void) {
|
||||||
|
|
||||||
static void cjTabulize(void) { DbprintfEx(FLAG_RAWPRINT, "\t\t\t"); }
|
static void cjTabulize(void) { DbprintfEx(FLAG_RAWPRINT, "\t\t\t"); }
|
||||||
|
|
||||||
/*
|
|
||||||
void cjPrintKey(uint64_t key, uint8_t *foundKey, uint16_t sectorNo, uint8_t type) {
|
|
||||||
char tosendkey[13];
|
|
||||||
sprintf(tosendkey, "%02x%02x%02x%02x%02x%02x", foundKey[0], foundKey[1], foundKey[2], foundKey[3], foundKey[4],
|
|
||||||
foundKey[5]); cjSetCursRight(); DbprintfEx(FLAG_NEWLINE, "SEC: %02x | KEY : %s | TYP: %d", sectorNo, tosendkey, type);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
static char *ReadSchemasFromSPIFFS(char *filename) {
|
static char *ReadSchemasFromSPIFFS(char *filename) {
|
||||||
SpinOff(0);
|
SpinOff(0);
|
||||||
|
|
||||||
|
@ -292,6 +284,7 @@ static void ReadLastTagFromFlash(void) {
|
||||||
// this one will handle filetype (symlink or not) and resolving by itself
|
// this one will handle filetype (symlink or not) and resolving by itself
|
||||||
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.
|
||||||
emlSetMem(mem, 0, 64);
|
emlSetMem(mem, 0, 64);
|
||||||
|
|
||||||
DbprintfEx(FLAG_NEWLINE, "[OK] Last tag recovered from FLASHMEM set to emulator");
|
DbprintfEx(FLAG_NEWLINE, "[OK] Last tag recovered from FLASHMEM set to emulator");
|
||||||
|
@ -330,16 +323,22 @@ void WriteTagToFlash(uint32_t uid, size_t size) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModInfo(void) { DbpString(" HF Mifare ultra fast sniff/sim/clone - aka VIGIKPWN (Colin Brigato)"); }
|
void ModInfo(void) {
|
||||||
|
DbpString(" HF Mifare ultra fast sniff/sim/clone - aka VIGIKPWN (Colin Brigato)");
|
||||||
|
}
|
||||||
|
|
||||||
void RunMod(void) {
|
void RunMod(void) {
|
||||||
StandAloneMode();
|
StandAloneMode();
|
||||||
|
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||||
|
Dbprintf(">> HF Mifare ultra fast sniff/sim/clone a.k.a VIGIKPWN Started <<");
|
||||||
|
|
||||||
|
// turn off all debugging.
|
||||||
|
DBGLEVEL = DBG_NONE;
|
||||||
|
|
||||||
// add_schema(Schemas, Noralsy, &total_schemas);
|
// add_schema(Schemas, Noralsy, &total_schemas);
|
||||||
// add_schema(Schemas, InfiHexact, &total_schemas);
|
// add_schema(Schemas, InfiHexact, &total_schemas);
|
||||||
// add_schema_from_json_in_spiffs((char *)HFCOLIN_URMETCAPTIVE_JSON);
|
// add_schema_from_json_in_spiffs((char *)HFCOLIN_URMETCAPTIVE_JSON);
|
||||||
// add_schema(Schemas, UrmetCaptive, &total_schemas);
|
// add_schema(Schemas, UrmetCaptive, &total_schemas);
|
||||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
|
||||||
|
|
||||||
currline = 20;
|
currline = 20;
|
||||||
curlline = 20;
|
curlline = 20;
|
||||||
|
@ -386,11 +385,11 @@ void RunMod(void) {
|
||||||
ACCBITS : 796788[00]+VALUE
|
ACCBITS : 796788[00]+VALUE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//----------------------------
|
// ----------------------------
|
||||||
// Set of keys to be used.
|
// Set of keys to be used.
|
||||||
// This should cover ~98% of
|
// This should cover ~98% of
|
||||||
// French VIGIK system @2017
|
// French VIGIK system @2017
|
||||||
//----------------------------
|
// ----------------------------
|
||||||
|
|
||||||
const uint64_t mfKeys[] = {
|
const uint64_t mfKeys[] = {
|
||||||
0xffffffffffff, // TRANSPORTS
|
0xffffffffffff, // TRANSPORTS
|
||||||
|
@ -459,7 +458,6 @@ void RunMod(void) {
|
||||||
bool err = 0;
|
bool err = 0;
|
||||||
bool trapped = 0;
|
bool trapped = 0;
|
||||||
bool allKeysFound = true;
|
bool allKeysFound = true;
|
||||||
|
|
||||||
uint32_t size = mfKeysCnt;
|
uint32_t size = mfKeysCnt;
|
||||||
|
|
||||||
// banner:
|
// banner:
|
||||||
|
@ -487,7 +485,7 @@ failtag:
|
||||||
SpinOff(50);
|
SpinOff(50);
|
||||||
LED_A_ON();
|
LED_A_ON();
|
||||||
uint8_t ticker = 0;
|
uint8_t ticker = 0;
|
||||||
// while (!BUTTON_PRESS() && !iso14443a_select_card(cjuid, NULL, &cjcuid, true, 0, true))
|
|
||||||
while (!iso14443a_select_card(cjuid, &p_card, &cjcuid, true, 0, true)) {
|
while (!iso14443a_select_card(cjuid, &p_card, &cjcuid, true, 0, true)) {
|
||||||
WDT_HIT();
|
WDT_HIT();
|
||||||
|
|
||||||
|
@ -505,8 +503,8 @@ failtag:
|
||||||
}
|
}
|
||||||
|
|
||||||
SpinOff(50);
|
SpinOff(50);
|
||||||
|
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||||
|
|
||||||
vtsend_cursor_position_restore(NULL);
|
vtsend_cursor_position_restore(NULL);
|
||||||
DbprintfEx(FLAG_NEWLINE, "\t\t\t%s[ GOT a Tag ! ]%s", _XGREEN_, _XWHITE_);
|
DbprintfEx(FLAG_NEWLINE, "\t\t\t%s[ GOT a Tag ! ]%s", _XGREEN_, _XWHITE_);
|
||||||
cjSetCursLeft();
|
cjSetCursLeft();
|
||||||
|
@ -534,7 +532,7 @@ failtag:
|
||||||
uint32_t start_time = GetTickCount();
|
uint32_t start_time = GetTickCount();
|
||||||
uint32_t delta_time = 0;
|
uint32_t delta_time = 0;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// WE SHOULD FIND A WAY TO GET UID TO AVOID THIS "TESTRUN"
|
// WE SHOULD FIND A WAY TO GET UID TO AVOID THIS "TESTRUN"
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
// + HERE IS TO BE THOUGHT AS ONLY A KEY SHOULD BE CHECK
|
// + HERE IS TO BE THOUGHT AS ONLY A KEY SHOULD BE CHECK
|
||||||
|
@ -544,7 +542,7 @@ failtag:
|
||||||
// `-+ THEN FILL EMULATOR WITH B KEEY
|
// `-+ THEN FILL EMULATOR WITH B KEEY
|
||||||
// `-+ THEN EMULATOR WITH CARD WITH B KEY
|
// `-+ THEN EMULATOR WITH CARD WITH B KEY
|
||||||
// `-+ IF IT HAS FAILED OF ANY OF SORT THEN WE ARE MARRON LIKE POMALO.
|
// `-+ IF IT HAS FAILED OF ANY OF SORT THEN WE ARE MARRON LIKE POMALO.
|
||||||
//----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// AN EVEN BETTER IMPLEMENTATION IS TO CHECK EVERY KEY FOR SECTOR 0 KEY A
|
// AN EVEN BETTER IMPLEMENTATION IS TO CHECK EVERY KEY FOR SECTOR 0 KEY A
|
||||||
// THEN IF FOUND CHECK THE SAME KEY FOR NEXT SECTOR ONLY KEY A
|
// THEN IF FOUND CHECK THE SAME KEY FOR NEXT SECTOR ONLY KEY A
|
||||||
// THEN IF FAIL CHECK EVERY SECTOR A KEY FOR EVERY OTHER KEY BUT NOT THE BLOCK
|
// THEN IF FAIL CHECK EVERY SECTOR A KEY FOR EVERY OTHER KEY BUT NOT THE BLOCK
|
||||||
|
@ -558,7 +556,7 @@ failtag:
|
||||||
// DERIVATION
|
// DERIVATION
|
||||||
// THEN IF B KEY IS NOT OF THIS SCHEME CHECK EVERY REMAINING B KEYED SECTOR
|
// THEN IF B KEY IS NOT OF THIS SCHEME CHECK EVERY REMAINING B KEYED SECTOR
|
||||||
// WITH EVERY REMAINING KEYS, BUT DISCARDING ANY DEFAULT TRANSPORT KEYS.
|
// WITH EVERY REMAINING KEYS, BUT DISCARDING ANY DEFAULT TRANSPORT KEYS.
|
||||||
//-----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// also we could avoid first UID check for every block
|
// also we could avoid first UID check for every block
|
||||||
|
|
||||||
// then let's expose this optimal case of well known vigik schemes :
|
// then let's expose this optimal case of well known vigik schemes :
|
||||||
|
@ -625,7 +623,6 @@ failtag:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* etc etc for testing schemes quick schemes */
|
/* etc etc for testing schemes quick schemes */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -641,7 +638,7 @@ failtag:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Settings keys to emulator */
|
// Settings keys to emulator
|
||||||
emlClearMem();
|
emlClearMem();
|
||||||
uint8_t mblock[16];
|
uint8_t mblock[16];
|
||||||
for (uint8_t sectorNo = 0; sectorNo < sectorsCnt; sectorNo++) {
|
for (uint8_t sectorNo = 0; sectorNo < sectorsCnt; sectorNo++) {
|
||||||
|
@ -655,7 +652,7 @@ failtag:
|
||||||
|
|
||||||
DbprintfEx(FLAG_NEWLINE, "%s>>%s Setting Keys->Emulator MEM...[%sOK%s]", _XYELLOW_, _XWHITE_, _XGREEN_, _XWHITE_);
|
DbprintfEx(FLAG_NEWLINE, "%s>>%s Setting Keys->Emulator MEM...[%sOK%s]", _XYELLOW_, _XWHITE_, _XGREEN_, _XWHITE_);
|
||||||
|
|
||||||
/* filling TAG to emulator */
|
// filling TAG to emulator
|
||||||
int filled;
|
int filled;
|
||||||
cjSetCursLeft();
|
cjSetCursLeft();
|
||||||
|
|
||||||
|
@ -666,11 +663,10 @@ failtag:
|
||||||
|
|
||||||
DbprintfEx(FLAG_NEWLINE, "%s>>%s W_FAILURE ! %sTrying fallback B keys....", _XRED_, _XORANGE_, _XWHITE_);
|
DbprintfEx(FLAG_NEWLINE, "%s>>%s W_FAILURE ! %sTrying fallback B keys....", _XRED_, _XORANGE_, _XWHITE_);
|
||||||
|
|
||||||
/* no trace, no dbg */
|
// no trace, no dbg
|
||||||
filled = e_MifareECardLoad(sectorsCnt, 1);
|
filled = e_MifareECardLoad(sectorsCnt, 1);
|
||||||
if (filled != PM3_SUCCESS) {
|
if (filled != PM3_SUCCESS) {
|
||||||
cjSetCursLeft();
|
cjSetCursLeft();
|
||||||
|
|
||||||
DbprintfEx(FLAG_NEWLINE, "FATAL:EML_FALLBACKFILL_B");
|
DbprintfEx(FLAG_NEWLINE, "FATAL:EML_FALLBACKFILL_B");
|
||||||
SpinErr(LED_C, 100, 8);
|
SpinErr(LED_C, 100, 8);
|
||||||
SpinOff(100);
|
SpinOff(100);
|
||||||
|
@ -717,10 +713,9 @@ readysim:
|
||||||
SpinOff(100);
|
SpinOff(100);
|
||||||
LED_C_ON();
|
LED_C_ON();
|
||||||
|
|
||||||
DBGLEVEL = DBG_NONE;
|
/*
|
||||||
|
uint16_t flags = 0;
|
||||||
//uint16_t flags=0;
|
switch (p_card.uidlen) {
|
||||||
/*switch (p_card.uidlen) {
|
|
||||||
case 10:
|
case 10:
|
||||||
flags = FLAG_10B_UID_IN_DATA;
|
flags = FLAG_10B_UID_IN_DATA;
|
||||||
break;
|
break;
|
||||||
|
@ -733,19 +728,18 @@ readysim:
|
||||||
default:
|
default:
|
||||||
flags = FLAG_UID_IN_EMUL;
|
flags = FLAG_UID_IN_EMUL;
|
||||||
break;
|
break;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
// Use UID, SAK, ATQA from EMUL, if uid not defined
|
// Use UID, SAK, ATQA from EMUL, if uid not defined
|
||||||
// if ((flags & (FLAG_4B_UID_IN_DATA | FLAG_7B_UID_IN_DATA | FLAG_10B_UID_IN_DATA)) == 0) {
|
if ((flags & (FLAG_4B_UID_IN_DATA | FLAG_7B_UID_IN_DATA | FLAG_10B_UID_IN_DATA)) == 0) {
|
||||||
//flags |= FLAG_UID_IN_EMUL;
|
flags |= FLAG_UID_IN_EMUL;
|
||||||
//}
|
}
|
||||||
//flags |= FLAG_MF_1K;
|
flags |= FLAG_MF_1K;
|
||||||
//if ((flags & (FLAG_4B_UID_IN_DATA | FLAG_7B_UID_IN_DATA | FLAG_10B_UID_IN_DATA)) == 0) {
|
if ((flags & (FLAG_4B_UID_IN_DATA | FLAG_7B_UID_IN_DATA | FLAG_10B_UID_IN_DATA)) == 0) {
|
||||||
// flags |= FLAG_UID_IN_EMUL;
|
flags |= FLAG_UID_IN_EMUL;
|
||||||
//}
|
}
|
||||||
//flags = 0x10;
|
flags = 0x10;
|
||||||
uint16_t flags = 0;
|
*/
|
||||||
flags = 16;
|
uint16_t flags = FLAG_UID_IN_EMUL;
|
||||||
DbprintfEx(FLAG_NEWLINE, "\n\n\n\n\n\n\n\nn\n\nn\n\n\nflags: %d (0x%02x)", flags, flags);
|
DbprintfEx(FLAG_NEWLINE, "\n\n\n\n\n\n\n\nn\n\nn\n\n\nflags: %d (0x%02x)", flags, flags);
|
||||||
cjSetCursLeft();
|
cjSetCursLeft();
|
||||||
SpinOff(1000);
|
SpinOff(1000);
|
||||||
|
@ -789,8 +783,6 @@ readysim:
|
||||||
* - tracing is falsed
|
* - tracing is falsed
|
||||||
*/
|
*/
|
||||||
int e_MifareECardLoad(uint32_t numofsectors, uint8_t keytype) {
|
int e_MifareECardLoad(uint32_t numofsectors, uint8_t keytype) {
|
||||||
DBGLEVEL = DBG_NONE;
|
|
||||||
|
|
||||||
uint8_t numSectors = numofsectors;
|
uint8_t numSectors = numofsectors;
|
||||||
uint8_t keyType = keytype;
|
uint8_t keyType = keytype;
|
||||||
|
|
||||||
|
@ -802,7 +794,6 @@ int e_MifareECardLoad(uint32_t numofsectors, uint8_t keytype) {
|
||||||
uint8_t dataoutbuf2[16];
|
uint8_t dataoutbuf2[16];
|
||||||
|
|
||||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||||
|
|
||||||
clear_trace();
|
clear_trace();
|
||||||
set_tracing(false);
|
set_tracing(false);
|
||||||
|
|
||||||
|
@ -810,24 +801,17 @@ int e_MifareECardLoad(uint32_t numofsectors, uint8_t keytype) {
|
||||||
|
|
||||||
if (!iso14443a_select_card(cjuid, &p_card, &cjcuid, true, 0, true)) {
|
if (!iso14443a_select_card(cjuid, &p_card, &cjcuid, true, 0, true)) {
|
||||||
isOK = false;
|
isOK = false;
|
||||||
if (DBGLEVEL >= 1)
|
|
||||||
DbprintfEx(FLAG_RAWPRINT, "Can't select card");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t s = 0; isOK && s < numSectors; s++) {
|
for (uint8_t s = 0; isOK && s < numSectors; s++) {
|
||||||
uint64_t ui64Key = emlGetKey(s, keyType);
|
uint64_t ui64Key = emlGetKey(s, keyType);
|
||||||
if (s == 0) {
|
if (s == 0) {
|
||||||
if (isOK && mifare_classic_auth(pcs, cjcuid, FirstBlockOfSector(s), keyType, ui64Key, AUTH_FIRST)) {
|
if (isOK && mifare_classic_auth(pcs, cjcuid, FirstBlockOfSector(s), keyType, ui64Key, AUTH_FIRST)) {
|
||||||
|
|
||||||
if (DBGLEVEL >= 1)
|
|
||||||
DbprintfEx(FLAG_NEWLINE, "Sector[%2d]. Auth error", s);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isOK && mifare_classic_auth(pcs, cjcuid, FirstBlockOfSector(s), keyType, ui64Key, AUTH_NESTED)) {
|
if (isOK && mifare_classic_auth(pcs, cjcuid, FirstBlockOfSector(s), keyType, ui64Key, AUTH_NESTED)) {
|
||||||
isOK = false;
|
isOK = false;
|
||||||
if (DBGLEVEL >= 1)
|
|
||||||
DbprintfEx(FLAG_NEWLINE, "Sector[%2d]. Auth nested error", s);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -835,8 +819,6 @@ int e_MifareECardLoad(uint32_t numofsectors, uint8_t keytype) {
|
||||||
for (uint8_t blockNo = 0; isOK && blockNo < NumBlocksPerSector(s); blockNo++) {
|
for (uint8_t blockNo = 0; isOK && blockNo < NumBlocksPerSector(s); blockNo++) {
|
||||||
if (isOK && mifare_classic_readblock(pcs, cjcuid, FirstBlockOfSector(s) + blockNo, dataoutbuf)) {
|
if (isOK && mifare_classic_readblock(pcs, cjcuid, FirstBlockOfSector(s) + blockNo, dataoutbuf)) {
|
||||||
isOK = false;
|
isOK = false;
|
||||||
if (DBGLEVEL >= 1)
|
|
||||||
DbprintfEx(FLAG_NEWLINE, "Error reading sector %2d block %2d", s, blockNo);
|
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
if (isOK) {
|
if (isOK) {
|
||||||
|
@ -852,23 +834,18 @@ int e_MifareECardLoad(uint32_t numofsectors, uint8_t keytype) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mifare_classic_halt(pcs, cjcuid)) {
|
int res = mifare_classic_halt(pcs, cjcuid);
|
||||||
if (DBGLEVEL >= 1)
|
(void)res;
|
||||||
DbprintfEx(FLAG_NEWLINE, "Halt error");
|
|
||||||
};
|
|
||||||
|
|
||||||
crypto1_deinit(pcs);
|
crypto1_deinit(pcs);
|
||||||
|
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||||
|
|
||||||
return (isOK) ? PM3_SUCCESS : PM3_EUNDEF;
|
return (isOK) ? PM3_SUCCESS : PM3_EUNDEF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the chk function is a piwi'ed(tm) check that will try all keys for
|
/* the chk function is a piwi'ed(tm) check that will try all keys for
|
||||||
a particular sector. also no tracing no dbg */
|
a particular sector. also no tracing no dbg */
|
||||||
int cjat91_saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace, uint8_t keyCount, uint8_t *datain,
|
int cjat91_saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace,
|
||||||
uint64_t *key) {
|
uint8_t keyCount, uint8_t *datain, uint64_t *key) {
|
||||||
DBGLEVEL = DBG_NONE;
|
|
||||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||||
set_tracing(false);
|
set_tracing(false);
|
||||||
|
|
||||||
|
@ -876,14 +853,16 @@ int cjat91_saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace, ui
|
||||||
struct Crypto1State *pcs;
|
struct Crypto1State *pcs;
|
||||||
pcs = &mpcs;
|
pcs = &mpcs;
|
||||||
|
|
||||||
for (int i = 0; i < keyCount; ++i) {
|
int retval = -1;
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < keyCount; i++) {
|
||||||
|
|
||||||
/* no need for anticollision. just verify tag is still here */
|
/* no need for anticollision. just verify tag is still here */
|
||||||
// if (!iso14443a_fast_select_card(cjuid, 0)) {
|
// if (!iso14443a_fast_select_card(cjuid, 0)) {
|
||||||
if (!iso14443a_select_card(cjuid, &p_card, &cjcuid, true, 0, true)) {
|
if (!iso14443a_select_card(cjuid, &p_card, &cjcuid, true, 0, true)) {
|
||||||
cjSetCursLeft();
|
cjSetCursLeft();
|
||||||
DbprintfEx(FLAG_NEWLINE, "%sFATAL%s : E_MF_LOSTTAG", _XRED_, _XWHITE_);
|
DbprintfEx(FLAG_NEWLINE, "%sFATAL%s : E_MF_LOSTTAG", _XRED_, _XWHITE_);
|
||||||
return -1;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t ui64Key = bytes_to_num(datain + i * 6, 6);
|
uint64_t ui64Key = bytes_to_num(datain + i * 6, 6);
|
||||||
|
@ -894,15 +873,13 @@ int cjat91_saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace, ui
|
||||||
SpinDelayUs(AUTHENTICATION_TIMEOUT);
|
SpinDelayUs(AUTHENTICATION_TIMEOUT);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
crypto1_deinit(pcs);
|
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
|
||||||
*key = ui64Key;
|
*key = ui64Key;
|
||||||
return i;
|
retval = i;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
crypto1_deinit(pcs);
|
crypto1_deinit(pcs);
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||||
|
return retval;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void saMifareMakeTag(void) {
|
void saMifareMakeTag(void) {
|
||||||
|
@ -920,7 +897,6 @@ void saMifareMakeTag(void) {
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
for (int blockNum = 0; blockNum < 16 * 4; blockNum++) {
|
for (int blockNum = 0; blockNum < 16 * 4; blockNum++) {
|
||||||
uint8_t mblock[16];
|
uint8_t mblock[16];
|
||||||
// cnt = 0;
|
|
||||||
emlGetMem(mblock, blockNum, 1);
|
emlGetMem(mblock, blockNum, 1);
|
||||||
// switch on field and send magic sequence
|
// switch on field and send magic sequence
|
||||||
if (blockNum == 0)
|
if (blockNum == 0)
|
||||||
|
@ -935,21 +911,15 @@ void saMifareMakeTag(void) {
|
||||||
flags = 0x04 + 0x10;
|
flags = 0x04 + 0x10;
|
||||||
|
|
||||||
if (saMifareCSetBlock(0, flags & 0xFE, blockNum, mblock)) {
|
if (saMifareCSetBlock(0, flags & 0xFE, blockNum, mblock)) {
|
||||||
//&& cnt <= retry) {
|
|
||||||
// cnt++;
|
|
||||||
cjSetCursFRight();
|
cjSetCursFRight();
|
||||||
if (currfline > 53) {
|
if (currfline > 53) {
|
||||||
currfline = 54;
|
currfline = 54;
|
||||||
}
|
}
|
||||||
DbprintfEx(FLAG_NEWLINE, "Block :%02x %sOK%s", blockNum, _XGREEN_, _XWHITE_);
|
DbprintfEx(FLAG_NEWLINE, "Block :%02x %sOK%s", blockNum, _XGREEN_, _XWHITE_);
|
||||||
// DbprintfEx(FLAG_RAWPRINT,"FATAL:E_MF_CHINESECOOK_NORICE");
|
|
||||||
// cfail=1;
|
|
||||||
// return;
|
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
cjSetCursLeft();
|
cjSetCursLeft();
|
||||||
cjSetCursLeft();
|
cjSetCursLeft();
|
||||||
|
|
||||||
DbprintfEx(FLAG_NEWLINE, "`--> %sFAIL%s : CHN_FAIL_BLK_%02x_NOK", _XRED_, _XWHITE_, blockNum);
|
DbprintfEx(FLAG_NEWLINE, "`--> %sFAIL%s : CHN_FAIL_BLK_%02x_NOK", _XRED_, _XWHITE_, blockNum);
|
||||||
cjSetCursFRight();
|
cjSetCursFRight();
|
||||||
DbprintfEx(FLAG_NEWLINE, "%s>>>>%s STOP AT %02x", _XRED_, _XWHITE_, blockNum);
|
DbprintfEx(FLAG_NEWLINE, "%s>>>>%s STOP AT %02x", _XRED_, _XWHITE_, blockNum);
|
||||||
|
@ -957,14 +927,9 @@ void saMifareMakeTag(void) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cjSetCursFRight();
|
cjSetCursFRight();
|
||||||
|
|
||||||
DbprintfEx(FLAG_NEWLINE, "%s>>>>>>>> END <<<<<<<<%s", _XYELLOW_, _XWHITE_);
|
DbprintfEx(FLAG_NEWLINE, "%s>>>>>>>> END <<<<<<<<%s", _XYELLOW_, _XWHITE_);
|
||||||
// break;
|
|
||||||
/*if (cfail == 1) {
|
|
||||||
DbprintfEx(FLAG_RAWPRINT,"FATAL: E_MF_HARA_KIRI_\r\n");
|
|
||||||
break;
|
|
||||||
} */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cfail == 0) {
|
if (cfail == 0) {
|
||||||
SpinUp(50);
|
SpinUp(50);
|
||||||
SpinUp(50);
|
SpinUp(50);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue