fix: standalone mode mattyrun now compiles

This commit is contained in:
iceman1001 2019-05-23 03:03:24 -04:00
parent 62b0732a8c
commit 81053d8c42
3 changed files with 13 additions and 12 deletions

View file

@ -235,7 +235,7 @@ void RunMod() {
uint64_t key64; // Defines current key uint64_t key64; // Defines current key
uint8_t *keyBlock; // Where the keys will be held in memory. uint8_t *keyBlock; // Where the keys will be held in memory.
uint8_t stKeyBlock = 20; // Set the quantity of keys in the block. uint8_t stKeyBlock = 20; // Set the quantity of keys in the block.
uint8_t filled = 0; // Used to check if the memory was filled with success. int filled; // Used to check if the memory was filled with success.
bool keyFound = false; bool keyFound = false;
/* /*
@ -369,26 +369,26 @@ void RunMod() {
if (ecfill) { if (ecfill) {
Dbprintf("\tFilling in with key A."); Dbprintf("\tFilling in with key A.");
MifareECardLoad(sectorsCnt, 0, 0, &filled); filled = MifareECardLoad(sectorsCnt, 0);
if (filled != 1) { if (filled != PM3_SUCCESS) {
Dbprintf("\t✕ Failed filling with A."); Dbprintf("\t✕ Failed filling with A.");
} }
Dbprintf("\tFilling in with key B."); Dbprintf("\tFilling in with key B.");
MifareECardLoad(sectorsCnt, 1, 0, &filled); filled = MifareECardLoad(sectorsCnt, 1);
if (filled != 1) { if (filled != PM3_SUCCESS) {
Dbprintf("\t✕ Failed filling with B."); Dbprintf("\t✕ Failed filling with B.");
} }
if ((filled == 1) && simulation) { if ((filled == PM3_SUCCESS) && simulation) {
Dbprintf("\tFilled, simulation started."); Dbprintf("\tEmulator memory filled, simulation started.");
// This will tell the fpga to emulate using previous keys and current target tag content. // This will tell the fpga to emulate using previous keys and current target tag content.
Dbprintf("\t Press button to abort simulation at anytime."); Dbprintf("\t Press button to abort simulation at anytime.");
LED_B_ON(); // green LED_B_ON(); // green
// assuming arg0==0, use hardcoded uid 0xdeadbeaf // assuming arg0==0, use hardcoded uid 0xdeadbeaf
Mifare1ksim(FLAG_4B_UID_IN_DATA | FLAG_UID_IN_EMUL, 0, 0, uid); Mifare1ksim(FLAG_4B_UID_IN_DATA | FLAG_UID_IN_EMUL, 0, uid);
LED_B_OFF(); LED_B_OFF();
/* /*
@ -428,8 +428,8 @@ void RunMod() {
} }
} }
} else if (filled != 1) { } else if (filled != PM3_SUCCESS) {
Dbprintf("\tMemory could not be filled due to errors."); Dbprintf("\tEmulator memory could not be filled due to errors.");
LED_C_ON(); LED_C_ON();
} }
} }

View file

@ -159,7 +159,7 @@ void MifareSetDbgLvl(uint16_t arg0);
void MifareEMemClr(void); void MifareEMemClr(void);
void MifareEMemSet(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain); void MifareEMemSet(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
void MifareEMemGet(uint32_t arg0, uint32_t arg1); void MifareEMemGet(uint32_t arg0, uint32_t arg1);
void MifareECardLoad(uint32_t arg0, uint32_t arg1); int MifareECardLoad(uint32_t arg0, uint32_t arg1);
void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain); // Work with "magic Chinese" card void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain); // Work with "magic Chinese" card
void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain); void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain);
void MifareCIdent(); // is "magic chinese" card? void MifareCIdent(); // is "magic chinese" card?

View file

@ -1650,7 +1650,7 @@ void MifareEMemGet(uint32_t arg0, uint32_t arg1) {
// Load a card into the emulator memory // Load a card into the emulator memory
// //
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void MifareECardLoad(uint32_t arg0, uint32_t arg1) { int MifareECardLoad(uint32_t arg0, uint32_t arg1) {
uint64_t ui64Key; uint64_t ui64Key;
uint32_t cuid = 0; uint32_t cuid = 0;
uint8_t numSectors = arg0; uint8_t numSectors = arg0;
@ -1726,6 +1726,7 @@ void MifareECardLoad(uint32_t arg0, uint32_t arg1) {
if (MF_DBGLEVEL >= 2) DbpString("EMUL FILL SECTORS FINISHED"); if (MF_DBGLEVEL >= 2) DbpString("EMUL FILL SECTORS FINISHED");
set_tracing(false); set_tracing(false);
return (isOK) ? PM3_SUCCESS : PM3_EUNDEF;
} }