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
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 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;
/*
@ -369,26 +369,26 @@ void RunMod() {
if (ecfill) {
Dbprintf("\tFilling in with key A.");
MifareECardLoad(sectorsCnt, 0, 0, &filled);
if (filled != 1) {
filled = MifareECardLoad(sectorsCnt, 0);
if (filled != PM3_SUCCESS) {
Dbprintf("\t✕ Failed filling with A.");
}
Dbprintf("\tFilling in with key B.");
MifareECardLoad(sectorsCnt, 1, 0, &filled);
if (filled != 1) {
filled = MifareECardLoad(sectorsCnt, 1);
if (filled != PM3_SUCCESS) {
Dbprintf("\t✕ Failed filling with B.");
}
if ((filled == 1) && simulation) {
Dbprintf("\tFilled, simulation started.");
if ((filled == PM3_SUCCESS) && simulation) {
Dbprintf("\tEmulator memory filled, simulation started.");
// This will tell the fpga to emulate using previous keys and current target tag content.
Dbprintf("\t Press button to abort simulation at anytime.");
LED_B_ON(); // green
// 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();
/*
@ -428,8 +428,8 @@ void RunMod() {
}
}
} else if (filled != 1) {
Dbprintf("\tMemory could not be filled due to errors.");
} else if (filled != PM3_SUCCESS) {
Dbprintf("\tEmulator memory could not be filled due to errors.");
LED_C_ON();
}
}

View file

@ -159,7 +159,7 @@ void MifareSetDbgLvl(uint16_t arg0);
void MifareEMemClr(void);
void MifareEMemSet(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
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 MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain);
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
//
//-----------------------------------------------------------------------------
void MifareECardLoad(uint32_t arg0, uint32_t arg1) {
int MifareECardLoad(uint32_t arg0, uint32_t arg1) {
uint64_t ui64Key;
uint32_t cuid = 0;
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");
set_tracing(false);
return (isOK) ? PM3_SUCCESS : PM3_EUNDEF;
}