mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
make style
This commit is contained in:
+6
-6
@@ -138,7 +138,7 @@ static void hitag_send_bit(int bit) {
|
||||
|
||||
static void hitag_send_frame(const uint8_t *frame, size_t frame_len) {
|
||||
// SOF - send start of frame
|
||||
hitag_send_bit(1);
|
||||
hitag_send_bit(1);
|
||||
hitag_send_bit(1);
|
||||
hitag_send_bit(1);
|
||||
hitag_send_bit(1);
|
||||
@@ -399,10 +399,10 @@ static bool hitag2_write_page(uint8_t *rx, const size_t rxlen, uint8_t *tx, size
|
||||
break;
|
||||
case WRITE_STATE_PAGENUM_WRITTEN:
|
||||
// Check if page number was received correctly
|
||||
if ( (rxlen == 10)
|
||||
&& (rx[0] == (0x82 | (blocknr << 3) | ((blocknr ^ 7) >> 2)))
|
||||
&& (rx[1] == (((blocknr & 0x3) ^ 0x3) << 6))) {
|
||||
|
||||
if ((rxlen == 10)
|
||||
&& (rx[0] == (0x82 | (blocknr << 3) | ((blocknr ^ 7) >> 2)))
|
||||
&& (rx[1] == (((blocknr & 0x3) ^ 0x3) << 6))) {
|
||||
|
||||
*txlen = 32;
|
||||
memset(tx, 0, HITAG_FRAME_LEN);
|
||||
memcpy(tx, writedata, 4);
|
||||
@@ -1280,7 +1280,7 @@ void ReaderHitag(hitag_function htf, hitag_data *htd) {
|
||||
|
||||
// Receive frame, watch for at most T0*EOF periods
|
||||
while (AT91C_BASE_TC1->TC_CV < T0 * HITAG_T_WAIT_MAX) {
|
||||
|
||||
|
||||
// Check if falling edge in tag modulation is detected
|
||||
if (AT91C_BASE_TC1->TC_SR & AT91C_TC_LDRAS) {
|
||||
// Retrieve the new timing values
|
||||
|
||||
+1
-1
@@ -3340,7 +3340,7 @@ void Mifare1ksim(uint8_t flags, uint8_t exitAfterNReads, uint8_t arg2, uint8_t *
|
||||
num_to_bytes(ans, 4, response);
|
||||
mf_crypto1_encrypt(pcs, response, 4, response_par);
|
||||
EmSendCmdPar(response, 4, response_par);
|
||||
|
||||
|
||||
LED_C_ON();
|
||||
|
||||
if (MF_DBGLEVEL >= 3) {
|
||||
|
||||
+6
-6
@@ -1938,13 +1938,13 @@ void MifareCIdent() {
|
||||
uint8_t *buf = BigBuf_malloc(USB_CMD_DATA_SIZE);
|
||||
uint8_t *uid = BigBuf_malloc(10);
|
||||
uint32_t cuid = 0;
|
||||
|
||||
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
// Generation 1 test
|
||||
ReaderTransmitBitsPar(wupC1, 7, NULL, NULL);
|
||||
if (!ReaderReceive(rec, recpar) || (rec[0] != 0x0a)) {
|
||||
goto TEST2;
|
||||
goto TEST2;
|
||||
};
|
||||
isGen = GEN_1B;
|
||||
|
||||
@@ -1960,10 +1960,10 @@ TEST2:
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
SpinDelay(100);
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
|
||||
int res = iso14443a_select_card(uid, NULL, &cuid, true, 0, true);
|
||||
if ( res == 2 ) {
|
||||
ReaderTransmit(rats, sizeof(rats), NULL);
|
||||
if (res == 2) {
|
||||
ReaderTransmit(rats, sizeof(rats), NULL);
|
||||
res = ReaderReceive(buf, par);
|
||||
if (memcmp(buf, "\x09\x78\x00\x91\x02\xDA\xBC\x19\x10\xF0\x05", 11) == 0) {
|
||||
isGen = GEN_2;
|
||||
@@ -1973,7 +1973,7 @@ TEST2:
|
||||
isGen = GEN_2;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
OUT:
|
||||
cmd_send(CMD_ACK, isGen, 0, 0, 0, 0);
|
||||
// turns off
|
||||
|
||||
+8
-8
@@ -137,15 +137,15 @@ bool IsBlock0PCF7931(uint8_t *block) {
|
||||
bool IsBlock1PCF7931(uint8_t *block) {
|
||||
// assuming all RFU bits are set to 0
|
||||
if (block[10] == 0
|
||||
&& block[11] == 0
|
||||
&& block[12] == 0
|
||||
&& block[13] == 0) {
|
||||
|
||||
if ( (block[14] & 0x7f) <= 9
|
||||
&& block[15] <= 9) {
|
||||
return true;
|
||||
}
|
||||
&& block[11] == 0
|
||||
&& block[12] == 0
|
||||
&& block[13] == 0) {
|
||||
|
||||
if ((block[14] & 0x7f) <= 9
|
||||
&& block[15] <= 9) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ int GetModels(char *Models[], int *count, uint8_t *width) {
|
||||
PrintAndLogEx(WARNING, "out of memory?");
|
||||
return 0;
|
||||
}
|
||||
if ( model.name != NULL ) {
|
||||
if (model.name != NULL) {
|
||||
memcpy(tmp, model.name, size);
|
||||
Models[mode] = tmp;
|
||||
width[mode] = plen(model.spoly);
|
||||
|
||||
+12
-12
@@ -459,7 +459,7 @@ int ASKDemod_ext(const char *Cmd, bool verbose, bool emSearch, uint8_t askType,
|
||||
uint8_t bits[MAX_GRAPH_TRACE_LEN] = {0};
|
||||
|
||||
sscanf(Cmd, "%i %i %i %i %c", &clk, &invert, &maxErr, &maxLen, &);
|
||||
|
||||
|
||||
if (!maxLen) maxLen = BIGBUF_SIZE;
|
||||
|
||||
if (invert != 0 && invert != 1) {
|
||||
@@ -486,17 +486,17 @@ int ASKDemod_ext(const char *Cmd, bool verbose, bool emSearch, uint8_t askType,
|
||||
if (amp == 'a') {
|
||||
askAmp(bits, BitLen);
|
||||
}
|
||||
|
||||
|
||||
size_t ststart = 0, stend = 0;
|
||||
// if (*stCheck)
|
||||
bool st = DetectST(bits, &BitLen, &foundclk, &ststart, &stend);
|
||||
|
||||
if ( clk == 0 ) {
|
||||
if ( foundclk == 32 || foundclk == 64 ) {
|
||||
if (clk == 0) {
|
||||
if (foundclk == 32 || foundclk == 64) {
|
||||
clk = foundclk;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (st) {
|
||||
*stCheck = st;
|
||||
CursorCPos = ststart;
|
||||
@@ -618,11 +618,11 @@ int Cmdmandecoderaw(const char *Cmd) {
|
||||
/*
|
||||
* @author marshmellow
|
||||
* biphase decode
|
||||
* decodes 01 or 10 -> ZERO
|
||||
* decodes 01 or 10 -> ZERO
|
||||
* 11 or 00 -> ONE
|
||||
* param offset adjust start position
|
||||
* param invert invert output
|
||||
* param masxErr maximum tolerated errors
|
||||
* param masxErr maximum tolerated errors
|
||||
*/
|
||||
int CmdBiphaseDecodeRaw(const char *Cmd) {
|
||||
size_t size = 0;
|
||||
@@ -1098,9 +1098,9 @@ int CmdFSKrawdemod(const char *Cmd) {
|
||||
//attempt to psk1 demod graph buffer
|
||||
int PSKDemod(const char *Cmd, bool verbose) {
|
||||
int invert = 0, clk = 0, maxErr = 100;
|
||||
|
||||
|
||||
sscanf(Cmd, "%i %i %i", &clk, &invert, &maxErr);
|
||||
|
||||
|
||||
if (clk == 1) {
|
||||
invert = 1;
|
||||
clk = 0;
|
||||
@@ -1115,9 +1115,9 @@ int PSKDemod(const char *Cmd, bool verbose) {
|
||||
|
||||
uint8_t bits[MAX_GRAPH_TRACE_LEN] = {0};
|
||||
size_t bitlen = getFromGraphBuf(bits);
|
||||
if (bitlen == 0)
|
||||
if (bitlen == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
int startIdx = 0;
|
||||
int errCnt = pskRawDemod_ext(bits, &bitlen, &clk, &invert, &startIdx);
|
||||
if (errCnt > maxErr) {
|
||||
@@ -1320,7 +1320,7 @@ int CmdRawDemod(const char *Cmd) {
|
||||
void setClockGrid(int clk, int offset) {
|
||||
g_DemodStartIdx = offset;
|
||||
g_DemodClock = clk;
|
||||
if ( clk == 0 && offset == 0)
|
||||
if (clk == 0 && offset == 0)
|
||||
PrintAndLogEx(DEBUG, "DEBUG: (setClockGrid) clear settings");
|
||||
else
|
||||
PrintAndLogEx(DEBUG, "DEBUG: (setClockGrid) demodoffset %d, clk %d", offset, clk);
|
||||
|
||||
+8
-8
@@ -524,7 +524,7 @@ int CmdHF14AInfo(const char *Cmd) {
|
||||
(tb1 ? "" : " NOT"),
|
||||
(tc1 ? "" : " NOT"),
|
||||
fsci,
|
||||
fsci < sizeof(atsFSC)/sizeof(atsFSC[0]) ? atsFSC[fsci] : -1
|
||||
fsci < sizeof(atsFSC) / sizeof(atsFSC[0]) ? atsFSC[fsci] : -1
|
||||
);
|
||||
}
|
||||
pos = 2;
|
||||
@@ -544,8 +544,8 @@ int CmdHF14AInfo(const char *Cmd) {
|
||||
((card.ats[pos] & 0x80) ? " NOT" : ""),
|
||||
dr,
|
||||
ds
|
||||
);
|
||||
|
||||
);
|
||||
|
||||
pos++;
|
||||
}
|
||||
if (tb1) {
|
||||
@@ -959,7 +959,7 @@ int SelectCard14443_4(bool disconnect, iso14a_card_select_t *card) {
|
||||
// get frame length from ATS in data field
|
||||
if (resp.arg[0] > 1) {
|
||||
uint8_t fsci = resp.d.asBytes[1] & 0x0f;
|
||||
if (fsci < sizeof(atsFSC)/sizeof(atsFSC[0]))
|
||||
if (fsci < sizeof(atsFSC) / sizeof(atsFSC[0]))
|
||||
frameLength = atsFSC[fsci];
|
||||
}
|
||||
} else {
|
||||
@@ -967,7 +967,7 @@ int SelectCard14443_4(bool disconnect, iso14a_card_select_t *card) {
|
||||
iso14a_card_select_t *vcard = (iso14a_card_select_t *) resp.d.asBytes;
|
||||
if (vcard->ats_len > 1) {
|
||||
uint8_t fsci = vcard->ats[1] & 0x0f;
|
||||
if (fsci < sizeof(atsFSC)/sizeof(atsFSC[0]))
|
||||
if (fsci < sizeof(atsFSC) / sizeof(atsFSC[0]))
|
||||
frameLength = atsFSC[fsci];
|
||||
}
|
||||
|
||||
@@ -1000,10 +1000,10 @@ int CmdExchangeAPDU(bool chainingin, uint8_t *datain, int datainlen, bool activa
|
||||
// here length USB_CMD_DATA_SIZE=512
|
||||
// timeout must be authomatically set by "get ATS"
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_APDU | ISO14A_NO_DISCONNECT | cmdc, (datainlen & 0xFFFF), 0}};
|
||||
|
||||
if ( datain )
|
||||
|
||||
if (datain)
|
||||
memcpy(c.d.asBytes, datain, datainlen);
|
||||
|
||||
|
||||
SendCommand(&c);
|
||||
|
||||
uint8_t *recv;
|
||||
|
||||
@@ -425,8 +425,8 @@ int CmdHFFelicaDumpLite(const char *Cmd) {
|
||||
}
|
||||
|
||||
uint64_t tracelen = resp.arg[1];
|
||||
if (tracelen == 0)
|
||||
return 1;
|
||||
if (tracelen == 0)
|
||||
return 1;
|
||||
|
||||
uint8_t *trace = calloc(tracelen, sizeof(uint8_t));
|
||||
if (trace == NULL) {
|
||||
@@ -444,14 +444,14 @@ int CmdHFFelicaDumpLite(const char *Cmd) {
|
||||
|
||||
print_hex_break(trace, tracelen, 32);
|
||||
printSep();
|
||||
|
||||
|
||||
uint16_t tracepos = 0;
|
||||
while (tracepos < tracelen)
|
||||
tracepos = PrintFliteBlock(tracepos, trace, tracelen);
|
||||
|
||||
printSep();
|
||||
|
||||
free(trace);
|
||||
free(trace);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -785,7 +785,7 @@ int CmdHFiClassDecrypt(const char *Cmd) {
|
||||
|
||||
saveFile(outfilename, "bin", decrypted, fsize);
|
||||
printIclassDumpContents(decrypted, 1, (fsize / 8), fsize);
|
||||
free(decrypted);
|
||||
free(decrypted);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1282,7 +1282,7 @@ int CmdLegicWipe(const char *Cmd) {
|
||||
}
|
||||
}
|
||||
PrintAndLogEx(SUCCESS, "ok\n");
|
||||
free(data);
|
||||
free(data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -84,11 +84,11 @@ void transform_D(uint8_t *ru) {
|
||||
uint32_t v1 = ((ru[3] << 24) | (ru[2] << 16) | (ru[1] << 8) | ru[0]) + c_D[p++];
|
||||
uint32_t v2 = ((ru[7] << 24) | (ru[6] << 16) | (ru[5] << 8) | ru[4]) + c_D[p++];
|
||||
for (i = 0; i < 12; i += 2) {
|
||||
|
||||
|
||||
uint32_t xor1 = v1 ^ v2;
|
||||
uint32_t t1 = ROTL(xor1, v2 & 0x1F) + c_D[p++];
|
||||
uint32_t xor2 = v2 ^ t1;
|
||||
uint32_t t2 = ROTL(xor2, t1 & 0x1F) + c_D[p++];
|
||||
uint32_t xor2 = v2 ^ t1;
|
||||
uint32_t t2 = ROTL(xor2, t1 & 0x1F) + c_D[p++];
|
||||
uint32_t xor3 = t1 ^ t2;
|
||||
uint32_t xor4 = t2 ^ v1;
|
||||
v1 = ROTL(xor3, t2 & 0x1F) + c_D[p++];
|
||||
@@ -322,9 +322,9 @@ static int ul_read(uint8_t page, uint8_t *response, uint16_t responseLength) {
|
||||
|
||||
static int ul_comp_write(uint8_t page, uint8_t *data, uint8_t datalen) {
|
||||
|
||||
if (data == NULL)
|
||||
if (data == NULL)
|
||||
return -1;
|
||||
|
||||
|
||||
uint8_t cmd[18];
|
||||
memset(cmd, 0x00, sizeof(cmd));
|
||||
datalen = (datalen > 16) ? 16 : datalen;
|
||||
|
||||
+17
-17
@@ -344,7 +344,7 @@ int CmdLFHitagSim(const char *Cmd) {
|
||||
}
|
||||
|
||||
static void printHitagConfiguration(uint8_t config) {
|
||||
|
||||
|
||||
char msg[100];
|
||||
memset(msg, 0, sizeof(msg));
|
||||
|
||||
@@ -357,10 +357,10 @@ static void printHitagConfiguration(uint8_t config) {
|
||||
|
||||
PrintAndLogEx(INFO, "\n\nHitag2 tag information ");
|
||||
PrintAndLogEx(INFO, "------------------------------------");
|
||||
|
||||
|
||||
//configuration byte
|
||||
PrintAndLogEx(SUCCESS, "Config byte : 0x%02X [ %s ]", config, bits);
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Config byte : 0x%02X [ %s ]", config, bits);
|
||||
|
||||
// encoding
|
||||
strcat(msg, "Encoding : ");
|
||||
if (config & 0x1) {
|
||||
@@ -415,7 +415,7 @@ static void printHitagConfiguration(uint8_t config) {
|
||||
memset(msg, 0, sizeof(msg));
|
||||
|
||||
// page access
|
||||
strcat(msg, "Page 4,5 : ");
|
||||
strcat(msg, "Page 4,5 : ");
|
||||
if (config & 0x20) {
|
||||
strcat(msg + strlen(msg), "read only");
|
||||
} else {
|
||||
@@ -467,9 +467,9 @@ static bool getHitagUid(uint32_t *uid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( uid )
|
||||
if (uid)
|
||||
*uid = bytes_to_num(resp.d.asBytes, 4);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -480,18 +480,18 @@ int CmdLFHitagInfo(const char *Cmd) {
|
||||
|
||||
char ctmp = tolower(param_getchar(Cmd, 0));
|
||||
if (ctmp == 'h') return usage_hitag_info();
|
||||
|
||||
|
||||
// pwd or key
|
||||
|
||||
// read UID
|
||||
uint32_t uid = 0;
|
||||
if ( getHitagUid( &uid ) == false )
|
||||
if (getHitagUid(&uid) == false)
|
||||
return 1;
|
||||
|
||||
|
||||
PrintAndLogEx(SUCCESS, "UID: %08X", uid);
|
||||
|
||||
|
||||
// how to detemine Hitag types?
|
||||
|
||||
|
||||
// read block3, get configuration byte.
|
||||
|
||||
// common configurations.
|
||||
@@ -503,7 +503,7 @@ int CmdLFHitagInfo(const char *Cmd) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO: iceman
|
||||
// TODO: iceman
|
||||
// Hitag2 reader, problem is that this command mixes up stuff. So 26 give uid. 21 etc will also give you a memory dump !?
|
||||
//
|
||||
int CmdLFHitagReader(const char *Cmd) {
|
||||
@@ -568,8 +568,8 @@ int CmdLFHitagReader(const char *Cmd) {
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Valid Hitag2 tag found - UID: %08x", id);
|
||||
if (htf != RHT2F_UID_ONLY) {
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Dumping tag memory..." );
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Dumping tag memory...");
|
||||
uint8_t *data = resp.d.asBytes;
|
||||
|
||||
char filename[FILE_PATH_SIZE];
|
||||
@@ -580,9 +580,9 @@ int CmdLFHitagReader(const char *Cmd) {
|
||||
saveFile(filename, "bin", data, 48);
|
||||
saveFileEML(filename, "eml", data, 48, 4);
|
||||
saveFileJSON(filename, "json", jsfHitag, data, 48);
|
||||
|
||||
|
||||
// block3, 1 byte
|
||||
printHitagConfiguration(data[4*3] );
|
||||
printHitagConfiguration(data[4 * 3]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
+76
-76
@@ -47,7 +47,7 @@ int usage_lf_indala_sim(void) {
|
||||
|
||||
int usage_lf_indala_clone(void) {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(NORMAL, "Usage: lf indala clone [h]<l> <uid> [Q5]");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " h : This help");
|
||||
@@ -64,27 +64,27 @@ int usage_lf_indala_clone(void) {
|
||||
// redesigned by marshmellow adjusted from existing decode functions
|
||||
// indala id decoding
|
||||
int detectIndala(uint8_t *dest, size_t *size, uint8_t *invert) {
|
||||
|
||||
uint8_t preamble64_i[] = {0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0};
|
||||
|
||||
uint8_t preamble64_i[] = {0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0};
|
||||
uint8_t preamble224_i[] = {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0};
|
||||
|
||||
|
||||
size_t idx = 0;
|
||||
size_t found_size = *size;
|
||||
|
||||
// PSK1
|
||||
|
||||
// PSK1
|
||||
bool res = preambleSearch(dest, preamble64, sizeof(preamble64), &found_size, &idx);
|
||||
if ( res ) {
|
||||
if (res) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK1 found 64");
|
||||
goto out;
|
||||
}
|
||||
idx = 0;
|
||||
found_size = *size;
|
||||
res = preambleSearch(dest, preamble64_i, sizeof(preamble64_i), &found_size, &idx);
|
||||
if ( res ) {
|
||||
if (res) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK1 found 64 inverted preamble");
|
||||
goto inv;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
idx = 0;
|
||||
found_size = *size;
|
||||
@@ -93,12 +93,12 @@ int detectIndala(uint8_t *dest, size_t *size, uint8_t *invert) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK1 found 224");
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
idx = 0;
|
||||
found_size = *size;
|
||||
found_size = *size;
|
||||
res = preambleSearch(dest, preamble224_i, sizeof(preamble224_i), &found_size, &idx);
|
||||
if ( res ) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK1 found 224 inverted preamble");
|
||||
PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK1 found 224 inverted preamble");
|
||||
goto inv;
|
||||
}
|
||||
*/
|
||||
@@ -106,41 +106,41 @@ int detectIndala(uint8_t *dest, size_t *size, uint8_t *invert) {
|
||||
// PSK2
|
||||
psk1TOpsk2(dest, *size);
|
||||
PrintAndLogEx(DEBUG, "DEBUG: detectindala Converting PSK1 -> PSK2");
|
||||
|
||||
|
||||
idx = 0;
|
||||
found_size = *size;
|
||||
found_size = *size;
|
||||
res = preambleSearch(dest, preamble64, sizeof(preamble64), &found_size, &idx);
|
||||
if ( res ) {
|
||||
if (res) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK2 found 64 preamble");
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
idx = 0;
|
||||
found_size = *size;
|
||||
res = preambleSearch(dest, preamble224, sizeof(preamble224), &found_size, &idx);
|
||||
if ( res ) {
|
||||
if (res) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK2 found 224 preamble");
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
idx = 0;
|
||||
found_size = *size;
|
||||
found_size = *size;
|
||||
res = preambleSearch(dest, preamble64_i, sizeof(preamble64_i), &found_size, &idx);
|
||||
if ( res ) {
|
||||
if (res) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK2 found 64 inverted preamble");
|
||||
goto inv;
|
||||
}
|
||||
|
||||
|
||||
idx = 0;
|
||||
found_size = *size;
|
||||
res = preambleSearch(dest, preamble224_i, sizeof(preamble224_i), &found_size, &idx);
|
||||
if ( res ) {
|
||||
if (res) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK2 found 224 inverted preamble");
|
||||
goto inv;
|
||||
}
|
||||
|
||||
|
||||
inv:
|
||||
if ( res == 0 ) {
|
||||
if (res == 0) {
|
||||
return -4;
|
||||
}
|
||||
|
||||
@@ -157,18 +157,18 @@ inv:
|
||||
out:
|
||||
|
||||
*size = found_size;
|
||||
|
||||
|
||||
//PrintAndLogEx(INFO, "DEBUG: detectindala RES = %d | %d | %d", res, found_size, idx);
|
||||
|
||||
|
||||
if (found_size != 224 && found_size != 64) {
|
||||
PrintAndLogEx(INFO, "DEBUG: detectindala | %d", found_size);
|
||||
PrintAndLogEx(INFO, "DEBUG: detectindala | %d", found_size);
|
||||
return -5;
|
||||
}
|
||||
|
||||
// 224 formats are typically PSK2 (afaik 2017 Marshmellow)
|
||||
// note loses 1 bit at beginning of transformation...
|
||||
return (int) idx;
|
||||
|
||||
return (int) idx;
|
||||
|
||||
}
|
||||
|
||||
// this read is the "normal" read, which download lf signal and tries to demod here.
|
||||
@@ -210,12 +210,12 @@ int CmdIndalaDemod(const char *Cmd) {
|
||||
}
|
||||
setDemodBuf(DemodBuffer, size, idx);
|
||||
setClockGrid(g_DemodClock, g_DemodStartIdx + (idx * g_DemodClock));
|
||||
|
||||
|
||||
//convert UID to HEX
|
||||
uint32_t uid1, uid2, uid3, uid4, uid5, uid6, uid7;
|
||||
uid1 = bytebits_to_byte(DemodBuffer, 32);
|
||||
uid2 = bytebits_to_byte(DemodBuffer + 32, 32);
|
||||
uint64_t foo = (((uint64_t)uid1 << 32) & 0x1FFFFFFF ) | (uid2 & 0x7FFFFFFF );
|
||||
uint64_t foo = (((uint64_t)uid1 << 32) & 0x1FFFFFFF) | (uid2 & 0x7FFFFFFF);
|
||||
|
||||
if (DemodBufferLen == 64) {
|
||||
PrintAndLogEx(
|
||||
@@ -225,40 +225,40 @@ int CmdIndalaDemod(const char *Cmd) {
|
||||
, uid1
|
||||
, uid2
|
||||
);
|
||||
|
||||
|
||||
uint16_t p1 = 0;
|
||||
p1 |= DemodBuffer[32+ 3] << 8;
|
||||
p1 |= DemodBuffer[32+ 6] << 5;
|
||||
p1 |= DemodBuffer[32+ 8] << 4;
|
||||
p1 |= DemodBuffer[32+ 9] << 3;
|
||||
p1 |= DemodBuffer[32+11] << 1;
|
||||
p1 |= DemodBuffer[32+16] << 6;
|
||||
p1 |= DemodBuffer[32+19] << 7;
|
||||
p1 |= DemodBuffer[32+20] << 10;
|
||||
p1 |= DemodBuffer[32+21] << 2;
|
||||
p1 |= DemodBuffer[32+22] << 0;
|
||||
p1 |= DemodBuffer[32+24] << 9;
|
||||
|
||||
/*
|
||||
uint16_t fc = 0;
|
||||
fc |= DemodBuffer[32+ 1] << 0;
|
||||
fc |= DemodBuffer[32+ 2] << 1;
|
||||
fc |= DemodBuffer[32+ 4] << 2;
|
||||
fc |= DemodBuffer[32+ 5] << 3;
|
||||
fc |= DemodBuffer[32+ 7] << 4;
|
||||
fc |= DemodBuffer[32+10] << 5;
|
||||
fc |= DemodBuffer[32+14] << 6;
|
||||
fc |= DemodBuffer[32+15] << 7;
|
||||
fc |= DemodBuffer[32+17] << 8;
|
||||
*/
|
||||
|
||||
p1 |= DemodBuffer[32 + 3] << 8;
|
||||
p1 |= DemodBuffer[32 + 6] << 5;
|
||||
p1 |= DemodBuffer[32 + 8] << 4;
|
||||
p1 |= DemodBuffer[32 + 9] << 3;
|
||||
p1 |= DemodBuffer[32 + 11] << 1;
|
||||
p1 |= DemodBuffer[32 + 16] << 6;
|
||||
p1 |= DemodBuffer[32 + 19] << 7;
|
||||
p1 |= DemodBuffer[32 + 20] << 10;
|
||||
p1 |= DemodBuffer[32 + 21] << 2;
|
||||
p1 |= DemodBuffer[32 + 22] << 0;
|
||||
p1 |= DemodBuffer[32 + 24] << 9;
|
||||
|
||||
/*
|
||||
uint16_t fc = 0;
|
||||
fc |= DemodBuffer[32+ 1] << 0;
|
||||
fc |= DemodBuffer[32+ 2] << 1;
|
||||
fc |= DemodBuffer[32+ 4] << 2;
|
||||
fc |= DemodBuffer[32+ 5] << 3;
|
||||
fc |= DemodBuffer[32+ 7] << 4;
|
||||
fc |= DemodBuffer[32+10] << 5;
|
||||
fc |= DemodBuffer[32+14] << 6;
|
||||
fc |= DemodBuffer[32+15] << 7;
|
||||
fc |= DemodBuffer[32+17] << 8;
|
||||
*/
|
||||
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(SUCCESS, "Possible de-scramble patterns");
|
||||
PrintAndLogEx(SUCCESS, "\tPrinted | __%04d__ [0x%X]", p1, p1);
|
||||
//PrintAndLogEx(SUCCESS, "\tPrinted | __%04d__ [0x%X]", fc, fc);
|
||||
PrintAndLogEx(SUCCESS, "\tInternal ID | %" PRIu64 , foo);
|
||||
|
||||
|
||||
PrintAndLogEx(SUCCESS, "\tInternal ID | %" PRIu64, foo);
|
||||
|
||||
|
||||
} else {
|
||||
uid3 = bytebits_to_byte(DemodBuffer + 64, 32);
|
||||
uid4 = bytebits_to_byte(DemodBuffer + 96, 32);
|
||||
@@ -266,17 +266,17 @@ int CmdIndalaDemod(const char *Cmd) {
|
||||
uid6 = bytebits_to_byte(DemodBuffer + 160, 32);
|
||||
uid7 = bytebits_to_byte(DemodBuffer + 192, 32);
|
||||
PrintAndLogEx(SUCCESS, "Indala Found - bitlength %d, UID = 0x%x%08x%08x%08x%08x%08x%08x"
|
||||
, DemodBufferLen
|
||||
, uid1
|
||||
, uid2
|
||||
, uid3
|
||||
, uid4
|
||||
, uid5
|
||||
, uid6
|
||||
, uid7
|
||||
);
|
||||
, DemodBufferLen
|
||||
, uid1
|
||||
, uid2
|
||||
, uid3
|
||||
, uid4
|
||||
, uid5
|
||||
, uid6
|
||||
, uid7
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (g_debugMode) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Indala - printing demodbuffer");
|
||||
printDemodBuff();
|
||||
@@ -532,9 +532,9 @@ int CmdIndalaSim(const char *Cmd) {
|
||||
int CmdIndalaClone(const char *Cmd) {
|
||||
|
||||
bool isLongUid = false;
|
||||
uint8_t data[7*4];
|
||||
uint8_t data[7 * 4];
|
||||
int datalen = 0;
|
||||
|
||||
|
||||
CLIParserInit("lf indala clone",
|
||||
"Enables cloning of Indala card with specified uid onto T55x7\n"
|
||||
"defaults to 64.\n",
|
||||
@@ -555,8 +555,8 @@ int CmdIndalaClone(const char *Cmd) {
|
||||
CLIGetHexWithReturn(2, data, &datalen);
|
||||
CLIParserFree();
|
||||
|
||||
UsbCommand c = {0, {0,0,0}};
|
||||
|
||||
UsbCommand c = {0, {0, 0, 0}};
|
||||
|
||||
if (isLongUid) {
|
||||
PrintAndLogEx(INFO, "Preparing to clone Indala 224bit tag with UID %s", sprint_hex(data, datalen));
|
||||
c.cmd = CMD_INDALA_CLONE_TAG_L;
|
||||
@@ -569,11 +569,11 @@ int CmdIndalaClone(const char *Cmd) {
|
||||
c.d.asDwords[6] = bytes_to_num(data + 24, 4);
|
||||
} else {
|
||||
PrintAndLogEx(INFO, "Preparing to clone Indala 64bit tag with UID %s", sprint_hex(data, datalen));
|
||||
c.cmd = CMD_INDALA_CLONE_TAG;
|
||||
c.cmd = CMD_INDALA_CLONE_TAG;
|
||||
c.d.asDwords[0] = bytes_to_num(data, 4);
|
||||
c.d.asDwords[1] = bytes_to_num(data + 4, 4);
|
||||
}
|
||||
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
|
||||
+4
-4
@@ -41,8 +41,8 @@ int usage_lf_keri_sim(void) {
|
||||
// find KERI preamble in already demoded data
|
||||
int detectKeri(uint8_t *dest, size_t *size, bool *invert) {
|
||||
|
||||
uint8_t preamble[] = {1,1,1,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
|
||||
uint8_t preamble_i[] = {0,0,0,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0};
|
||||
uint8_t preamble[] = {1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
|
||||
uint8_t preamble_i[] = {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0};
|
||||
|
||||
// sanity check.
|
||||
if (*size < sizeof(preamble) + 100) return -1;
|
||||
@@ -159,10 +159,10 @@ int CmdKeriClone(const char *Cmd) {
|
||||
|
||||
// MSB is ONE
|
||||
internalid |= 0x80000000;
|
||||
|
||||
|
||||
// 3 LSB is ONE
|
||||
uint64_t data = ((uint64_t)internalid << 3) + 7;
|
||||
PrintAndLogEx(INFO, "Preparing to clone KERI to T55x7 with Internal Id: %" PRIx64, internalid );
|
||||
PrintAndLogEx(INFO, "Preparing to clone KERI to T55x7 with Internal Id: %" PRIx64, internalid);
|
||||
|
||||
//
|
||||
blocks[1] = data >> 32;
|
||||
|
||||
@@ -237,11 +237,11 @@ int CmdPyramidDemod(const char *Cmd) {
|
||||
}
|
||||
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Pyramid: checksum : 0x%02X - %02X - %s"
|
||||
, checksum
|
||||
, checkCS
|
||||
, (checksum == checkCS) ? _GREEN_("Passed") : _RED_("Failed")
|
||||
);
|
||||
|
||||
, checksum
|
||||
, checkCS
|
||||
, (checksum == checkCS) ? _GREEN_("Passed") : _RED_("Failed")
|
||||
);
|
||||
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Pyramid: idx: %d, Len: %d, Printing Demod Buffer:", idx, 128);
|
||||
if (g_debugMode)
|
||||
printDemodBuff();
|
||||
|
||||
+32
-32
@@ -144,8 +144,8 @@ int usage_t55xx_wakup() {
|
||||
int usage_t55xx_chk() {
|
||||
PrintAndLogEx(NORMAL, "This command uses a dictionary attack");
|
||||
PrintAndLogEx(NORMAL, "press " _YELLOW_("'enter'") " to cancel the command");
|
||||
PrintAndLogEx(NORMAL, "WARNING: this may brick non-password protected chips!");
|
||||
PrintAndLogEx(NORMAL, "Try to reading block 7 before\n");
|
||||
PrintAndLogEx(NORMAL, "WARNING: this may brick non-password protected chips!");
|
||||
PrintAndLogEx(NORMAL, "Try to reading block 7 before\n");
|
||||
PrintAndLogEx(NORMAL, "Usage: lf t55xx chk [h] <m> [i <*.dic>]");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " h - this help");
|
||||
@@ -161,8 +161,8 @@ int usage_t55xx_chk() {
|
||||
int usage_t55xx_bruteforce() {
|
||||
PrintAndLogEx(NORMAL, "This command uses bruteforce to scan a number range");
|
||||
PrintAndLogEx(NORMAL, "press " _YELLOW_("'enter'") " to cancel the command");
|
||||
PrintAndLogEx(NORMAL, "WARNING: this may brick non-password protected chips!");
|
||||
PrintAndLogEx(NORMAL, "Try to reading block 7 before\n");
|
||||
PrintAndLogEx(NORMAL, "WARNING: this may brick non-password protected chips!");
|
||||
PrintAndLogEx(NORMAL, "Try to reading block 7 before\n");
|
||||
PrintAndLogEx(NORMAL, "Usage: lf t55xx bruteforce [h] <start password> <end password>");
|
||||
PrintAndLogEx(NORMAL, " password must be 4 bytes (8 hex symbols)");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
@@ -177,9 +177,9 @@ int usage_t55xx_bruteforce() {
|
||||
}
|
||||
int usage_t55xx_recoverpw() {
|
||||
PrintAndLogEx(NORMAL, "This command uses a few tricks to try to recover mangled password");
|
||||
PrintAndLogEx(NORMAL, "press " _YELLOW_("'enter'") " to cancel the command");
|
||||
PrintAndLogEx(NORMAL, "press " _YELLOW_("'enter'") " to cancel the command");
|
||||
PrintAndLogEx(NORMAL, "WARNING: this may brick non-password protected chips!");
|
||||
PrintAndLogEx(NORMAL, "Try to reading block 7 before\n");
|
||||
PrintAndLogEx(NORMAL, "Try to reading block 7 before\n");
|
||||
PrintAndLogEx(NORMAL, "Usage: lf t55xx recoverpw [password]");
|
||||
PrintAndLogEx(NORMAL, " password must be 4 bytes (8 hex symbols)");
|
||||
PrintAndLogEx(NORMAL, " default password is 51243648, used by many cloners");
|
||||
@@ -1058,7 +1058,7 @@ int CmdT55xxWriteBlock(const char *Cmd) {
|
||||
c.arg[2] = password;
|
||||
c.d.asBytes[0] |= 0x1;
|
||||
}
|
||||
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
|
||||
@@ -1369,7 +1369,7 @@ bool AquireData(uint8_t page, uint8_t block, bool pwdmode, uint32_t password) {
|
||||
// bit1 = page to read from
|
||||
// arg1: which block to read
|
||||
// arg2: password
|
||||
uint8_t arg0 = ( page << 1 | (pwdmode) );
|
||||
uint8_t arg0 = (page << 1 | (pwdmode));
|
||||
UsbCommand c = {CMD_T55XX_READ_BLOCK, {arg0, block, password}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
@@ -1637,7 +1637,7 @@ int CmdT55xxChkPwds(const char *Cmd) {
|
||||
bool found = false;
|
||||
uint8_t timeout = 0;
|
||||
uint8_t *keyBlock = NULL;
|
||||
|
||||
|
||||
char cmdp = tolower(param_getchar(Cmd, 0));
|
||||
if (strlen(Cmd) == 0 || cmdp == 'h') return usage_t55xx_chk();
|
||||
|
||||
@@ -1676,7 +1676,7 @@ int CmdT55xxChkPwds(const char *Cmd) {
|
||||
|
||||
found = tryDetectModulation();
|
||||
if (found) {
|
||||
PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08") " ]", resp.arg[1]);
|
||||
PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08") " ]", resp.arg[1]);
|
||||
} else {
|
||||
PrintAndLogEx(WARNING, "Check pwd failed");
|
||||
}
|
||||
@@ -1688,22 +1688,22 @@ int CmdT55xxChkPwds(const char *Cmd) {
|
||||
}
|
||||
|
||||
if (cmdp == 'i') {
|
||||
|
||||
|
||||
int len = strlen(Cmd + 2);
|
||||
if (len > FILE_PATH_SIZE) len = FILE_PATH_SIZE;
|
||||
memcpy(filename, Cmd + 2, len);
|
||||
|
||||
|
||||
uint16_t keycount = 0;
|
||||
size_t datalen = 0;
|
||||
|
||||
|
||||
// TODO, a way of reallocating memory if file was larger
|
||||
keyBlock = calloc(4*200, sizeof(uint8_t));
|
||||
if ( keyBlock == NULL ) {
|
||||
keyBlock = calloc(4 * 200, sizeof(uint8_t));
|
||||
if (keyBlock == NULL) {
|
||||
PrintAndLogDevice(WARNING, "error, cannot allocate memory ");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int res = loadFileDICTIONARY(filename, "dic", keyBlock, &datalen, 4, &keycount );
|
||||
|
||||
int res = loadFileDICTIONARY(filename, "dic", keyBlock, &datalen, 4, &keycount);
|
||||
if (res || keycount == 0) {
|
||||
PrintAndLogEx(WARNING, "No keys found in file");
|
||||
free(keyBlock);
|
||||
@@ -1728,7 +1728,7 @@ int CmdT55xxChkPwds(const char *Cmd) {
|
||||
curr_password = bytes_to_num(keyBlock + 4 * c, 4);
|
||||
|
||||
PrintAndLogEx(INFO, "Testing %08X", curr_password);
|
||||
|
||||
|
||||
if (!AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, curr_password)) {
|
||||
continue;
|
||||
}
|
||||
@@ -1776,7 +1776,7 @@ int CmdT55xxBruteForce(const char *Cmd) {
|
||||
PrintAndLogEx(INFO, "Search password range [%08X -> %08X]", start_password, end_password);
|
||||
|
||||
while (!found) {
|
||||
|
||||
|
||||
printf(".");
|
||||
fflush(stdout);
|
||||
|
||||
@@ -1788,7 +1788,7 @@ int CmdT55xxBruteForce(const char *Cmd) {
|
||||
|
||||
if (curr == end_password)
|
||||
break;
|
||||
|
||||
|
||||
curr++;
|
||||
}
|
||||
|
||||
@@ -1806,12 +1806,12 @@ int CmdT55xxBruteForce(const char *Cmd) {
|
||||
|
||||
int tryOnePassword(uint32_t password) {
|
||||
PrintAndLogEx(INFO, "Trying password %08X", password);
|
||||
|
||||
|
||||
AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, password);
|
||||
|
||||
if (getSignalProperties()->isnoise == false)
|
||||
return 0;
|
||||
|
||||
|
||||
if (tryDetectModulation())
|
||||
return 1;
|
||||
else
|
||||
@@ -1834,12 +1834,12 @@ int CmdT55xxRecoverPW(const char *Cmd) {
|
||||
while (bit < 32) {
|
||||
curr_password = orig_password ^ (1u << bit);
|
||||
found = tryOnePassword(curr_password);
|
||||
if ( found == 1)
|
||||
if (found == 1)
|
||||
goto out;
|
||||
|
||||
|
||||
bit++;
|
||||
|
||||
if (IsCancelled())
|
||||
if (IsCancelled())
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1857,15 +1857,15 @@ int CmdT55xxRecoverPW(const char *Cmd) {
|
||||
bit++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
found = tryOnePassword(curr_password);
|
||||
if ( found == 1 )
|
||||
goto out;
|
||||
|
||||
if (found == 1)
|
||||
goto out;
|
||||
|
||||
bit++;
|
||||
prev_password = curr_password;
|
||||
|
||||
if (IsCancelled())
|
||||
if (IsCancelled())
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1881,13 +1881,13 @@ int CmdT55xxRecoverPW(const char *Cmd) {
|
||||
continue;
|
||||
}
|
||||
found = tryOnePassword(curr_password);
|
||||
if ( found == 1 )
|
||||
if (found == 1)
|
||||
goto out;
|
||||
|
||||
bit++;
|
||||
prev_password = curr_password;
|
||||
|
||||
if (IsCancelled())
|
||||
if (IsCancelled())
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -679,14 +679,14 @@ int CmdSmartUpgrade(const char *Cmd) {
|
||||
if (fsize < 0) {
|
||||
PrintAndLogEx(FAILED, "Could not determine size of SHA-512 file");
|
||||
fclose(f);
|
||||
free(dump);
|
||||
free(dump);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fsize < 128) {
|
||||
PrintAndLogEx(FAILED, "SHA-512 file too short");
|
||||
fclose(f);
|
||||
free(dump);
|
||||
free(dump);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -700,20 +700,20 @@ int CmdSmartUpgrade(const char *Cmd) {
|
||||
uint8_t hash1[64];
|
||||
if (bytes_read != 128 || param_gethex(hashstring, 0, hash1, 128)) {
|
||||
PrintAndLogEx(FAILED, "Couldn't read SHA-512 file");
|
||||
free(dump);
|
||||
free(dump);
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t hash2[64];
|
||||
if (sha512hash(dump, firmware_size, hash2)) {
|
||||
PrintAndLogEx(FAILED, "Couldn't calculate SHA-512 of firmware");
|
||||
free(dump);
|
||||
free(dump);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (memcmp(hash1, hash2, 64)) {
|
||||
PrintAndLogEx(FAILED, "Couldn't verify integrity of firmware file " _RED_("(wrong SHA-512 hash)"));
|
||||
free(dump);
|
||||
free(dump);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -417,16 +417,16 @@ int main(int argc, char **argv) {
|
||||
infiles[0] = fopen(argv[2], "rb");
|
||||
if (infiles[0] == NULL) {
|
||||
fprintf(stderr, "Error. Cannot open input file %s\n\n", argv[2]);
|
||||
free(infiles);
|
||||
free(infiles);
|
||||
return (EXIT_FAILURE);
|
||||
}
|
||||
outfile = fopen(argv[3], "wb");
|
||||
if (outfile == NULL) {
|
||||
fprintf(stderr, "Error. Cannot open output file %s\n\n", argv[3]);
|
||||
free(infiles);
|
||||
free(infiles);
|
||||
return (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
int ret = zlib_decompress(infiles[0], outfile);
|
||||
free(infiles);
|
||||
return (ret);
|
||||
@@ -466,13 +466,13 @@ int main(int argc, char **argv) {
|
||||
if (outfile == NULL) {
|
||||
fprintf(stderr, "Error. Cannot open output file %s\n\n", argv[argc - 1]);
|
||||
free(infile_names);
|
||||
free(infiles);
|
||||
free(infiles);
|
||||
return (EXIT_FAILURE);
|
||||
}
|
||||
if (generate_version_file) {
|
||||
if (generate_fpga_version_info(infiles, infile_names, num_input_files, outfile)) {
|
||||
free(infile_names);
|
||||
free(infiles);
|
||||
free(infiles);
|
||||
return (EXIT_FAILURE);
|
||||
}
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -630,7 +630,7 @@ usage(void) {
|
||||
"\t preset values\n"
|
||||
"\n"
|
||||
"Copyright (C)\n"
|
||||
"2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Gregory Cook\n"
|
||||
"2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Gregory Cook\n"
|
||||
"This is free software; see the source for copying conditions. There is NO\n"
|
||||
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
|
||||
"Version "
|
||||
|
||||
@@ -242,9 +242,9 @@ void mrev(model_t *model) {
|
||||
|
||||
void mnovel(model_t *model) {
|
||||
/* remove name and check string from modified model */
|
||||
/* previous classification no longer applies */
|
||||
/* previous classification no longer applies */
|
||||
model->name = NULL;
|
||||
model->flags &= ~P_CLMASK;
|
||||
model->flags &= ~P_CLMASK;
|
||||
pfree(&model->check);
|
||||
pfree(&model->magic);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user