make style

This commit is contained in:
Philippe Teuwen 2019-03-28 14:19:41 +01:00
parent 2ebada74f0
commit db4aa08b78
28 changed files with 617 additions and 617 deletions

View file

@ -138,7 +138,7 @@ static void hitag_send_bit(int bit) {
static void hitag_send_frame(const uint8_t *frame, size_t frame_len) { static void hitag_send_frame(const uint8_t *frame, size_t frame_len) {
// SOF - send start of frame // 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); 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; break;
case WRITE_STATE_PAGENUM_WRITTEN: case WRITE_STATE_PAGENUM_WRITTEN:
// Check if page number was received correctly // Check if page number was received correctly
if ( (rxlen == 10) if ((rxlen == 10)
&& (rx[0] == (0x82 | (blocknr << 3) | ((blocknr ^ 7) >> 2))) && (rx[0] == (0x82 | (blocknr << 3) | ((blocknr ^ 7) >> 2)))
&& (rx[1] == (((blocknr & 0x3) ^ 0x3) << 6))) { && (rx[1] == (((blocknr & 0x3) ^ 0x3) << 6))) {
*txlen = 32; *txlen = 32;
memset(tx, 0, HITAG_FRAME_LEN); memset(tx, 0, HITAG_FRAME_LEN);
memcpy(tx, writedata, 4); 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 // Receive frame, watch for at most T0*EOF periods
while (AT91C_BASE_TC1->TC_CV < T0 * HITAG_T_WAIT_MAX) { while (AT91C_BASE_TC1->TC_CV < T0 * HITAG_T_WAIT_MAX) {
// Check if falling edge in tag modulation is detected // Check if falling edge in tag modulation is detected
if (AT91C_BASE_TC1->TC_SR & AT91C_TC_LDRAS) { if (AT91C_BASE_TC1->TC_SR & AT91C_TC_LDRAS) {
// Retrieve the new timing values // Retrieve the new timing values

View file

@ -3340,7 +3340,7 @@ void Mifare1ksim(uint8_t flags, uint8_t exitAfterNReads, uint8_t arg2, uint8_t *
num_to_bytes(ans, 4, response); num_to_bytes(ans, 4, response);
mf_crypto1_encrypt(pcs, response, 4, response_par); mf_crypto1_encrypt(pcs, response, 4, response_par);
EmSendCmdPar(response, 4, response_par); EmSendCmdPar(response, 4, response_par);
LED_C_ON(); LED_C_ON();
if (MF_DBGLEVEL >= 3) { if (MF_DBGLEVEL >= 3) {

View file

@ -1938,13 +1938,13 @@ void MifareCIdent() {
uint8_t *buf = BigBuf_malloc(USB_CMD_DATA_SIZE); uint8_t *buf = BigBuf_malloc(USB_CMD_DATA_SIZE);
uint8_t *uid = BigBuf_malloc(10); uint8_t *uid = BigBuf_malloc(10);
uint32_t cuid = 0; uint32_t cuid = 0;
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN); iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
// Generation 1 test // Generation 1 test
ReaderTransmitBitsPar(wupC1, 7, NULL, NULL); ReaderTransmitBitsPar(wupC1, 7, NULL, NULL);
if (!ReaderReceive(rec, recpar) || (rec[0] != 0x0a)) { if (!ReaderReceive(rec, recpar) || (rec[0] != 0x0a)) {
goto TEST2; goto TEST2;
}; };
isGen = GEN_1B; isGen = GEN_1B;
@ -1960,10 +1960,10 @@ TEST2:
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
SpinDelay(100); SpinDelay(100);
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN); iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
int res = iso14443a_select_card(uid, NULL, &cuid, true, 0, true); int res = iso14443a_select_card(uid, NULL, &cuid, true, 0, true);
if ( res == 2 ) { if (res == 2) {
ReaderTransmit(rats, sizeof(rats), NULL); ReaderTransmit(rats, sizeof(rats), NULL);
res = ReaderReceive(buf, par); res = ReaderReceive(buf, par);
if (memcmp(buf, "\x09\x78\x00\x91\x02\xDA\xBC\x19\x10\xF0\x05", 11) == 0) { if (memcmp(buf, "\x09\x78\x00\x91\x02\xDA\xBC\x19\x10\xF0\x05", 11) == 0) {
isGen = GEN_2; isGen = GEN_2;
@ -1973,7 +1973,7 @@ TEST2:
isGen = GEN_2; isGen = GEN_2;
} }
}; };
OUT: OUT:
cmd_send(CMD_ACK, isGen, 0, 0, 0, 0); cmd_send(CMD_ACK, isGen, 0, 0, 0, 0);
// turns off // turns off

View file

@ -137,15 +137,15 @@ bool IsBlock0PCF7931(uint8_t *block) {
bool IsBlock1PCF7931(uint8_t *block) { bool IsBlock1PCF7931(uint8_t *block) {
// assuming all RFU bits are set to 0 // assuming all RFU bits are set to 0
if (block[10] == 0 if (block[10] == 0
&& block[11] == 0 && block[11] == 0
&& block[12] == 0 && block[12] == 0
&& block[13] == 0) { && block[13] == 0) {
if ( (block[14] & 0x7f) <= 9 if ((block[14] & 0x7f) <= 9
&& block[15] <= 9) { && block[15] <= 9) {
return true; return true;
}
} }
}
return false; return false;
} }

View file

@ -93,7 +93,7 @@ int GetModels(char *Models[], int *count, uint8_t *width) {
PrintAndLogEx(WARNING, "out of memory?"); PrintAndLogEx(WARNING, "out of memory?");
return 0; return 0;
} }
if ( model.name != NULL ) { if (model.name != NULL) {
memcpy(tmp, model.name, size); memcpy(tmp, model.name, size);
Models[mode] = tmp; Models[mode] = tmp;
width[mode] = plen(model.spoly); width[mode] = plen(model.spoly);

View file

@ -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}; uint8_t bits[MAX_GRAPH_TRACE_LEN] = {0};
sscanf(Cmd, "%i %i %i %i %c", &clk, &invert, &maxErr, &maxLen, &amp); sscanf(Cmd, "%i %i %i %i %c", &clk, &invert, &maxErr, &maxLen, &amp);
if (!maxLen) maxLen = BIGBUF_SIZE; if (!maxLen) maxLen = BIGBUF_SIZE;
if (invert != 0 && invert != 1) { 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') { if (amp == 'a') {
askAmp(bits, BitLen); askAmp(bits, BitLen);
} }
size_t ststart = 0, stend = 0; size_t ststart = 0, stend = 0;
// if (*stCheck) // if (*stCheck)
bool st = DetectST(bits, &BitLen, &foundclk, &ststart, &stend); bool st = DetectST(bits, &BitLen, &foundclk, &ststart, &stend);
if ( clk == 0 ) { if (clk == 0) {
if ( foundclk == 32 || foundclk == 64 ) { if (foundclk == 32 || foundclk == 64) {
clk = foundclk; clk = foundclk;
} }
} }
if (st) { if (st) {
*stCheck = st; *stCheck = st;
CursorCPos = ststart; CursorCPos = ststart;
@ -618,11 +618,11 @@ int Cmdmandecoderaw(const char *Cmd) {
/* /*
* @author marshmellow * @author marshmellow
* biphase decode * biphase decode
* decodes 01 or 10 -> ZERO * decodes 01 or 10 -> ZERO
* 11 or 00 -> ONE * 11 or 00 -> ONE
* param offset adjust start position * param offset adjust start position
* param invert invert output * param invert invert output
* param masxErr maximum tolerated errors * param masxErr maximum tolerated errors
*/ */
int CmdBiphaseDecodeRaw(const char *Cmd) { int CmdBiphaseDecodeRaw(const char *Cmd) {
size_t size = 0; size_t size = 0;
@ -1098,9 +1098,9 @@ int CmdFSKrawdemod(const char *Cmd) {
//attempt to psk1 demod graph buffer //attempt to psk1 demod graph buffer
int PSKDemod(const char *Cmd, bool verbose) { int PSKDemod(const char *Cmd, bool verbose) {
int invert = 0, clk = 0, maxErr = 100; int invert = 0, clk = 0, maxErr = 100;
sscanf(Cmd, "%i %i %i", &clk, &invert, &maxErr); sscanf(Cmd, "%i %i %i", &clk, &invert, &maxErr);
if (clk == 1) { if (clk == 1) {
invert = 1; invert = 1;
clk = 0; clk = 0;
@ -1115,9 +1115,9 @@ int PSKDemod(const char *Cmd, bool verbose) {
uint8_t bits[MAX_GRAPH_TRACE_LEN] = {0}; uint8_t bits[MAX_GRAPH_TRACE_LEN] = {0};
size_t bitlen = getFromGraphBuf(bits); size_t bitlen = getFromGraphBuf(bits);
if (bitlen == 0) if (bitlen == 0)
return 0; return 0;
int startIdx = 0; int startIdx = 0;
int errCnt = pskRawDemod_ext(bits, &bitlen, &clk, &invert, &startIdx); int errCnt = pskRawDemod_ext(bits, &bitlen, &clk, &invert, &startIdx);
if (errCnt > maxErr) { if (errCnt > maxErr) {
@ -1320,7 +1320,7 @@ int CmdRawDemod(const char *Cmd) {
void setClockGrid(int clk, int offset) { void setClockGrid(int clk, int offset) {
g_DemodStartIdx = offset; g_DemodStartIdx = offset;
g_DemodClock = clk; g_DemodClock = clk;
if ( clk == 0 && offset == 0) if (clk == 0 && offset == 0)
PrintAndLogEx(DEBUG, "DEBUG: (setClockGrid) clear settings"); PrintAndLogEx(DEBUG, "DEBUG: (setClockGrid) clear settings");
else else
PrintAndLogEx(DEBUG, "DEBUG: (setClockGrid) demodoffset %d, clk %d", offset, clk); PrintAndLogEx(DEBUG, "DEBUG: (setClockGrid) demodoffset %d, clk %d", offset, clk);

View file

@ -524,7 +524,7 @@ int CmdHF14AInfo(const char *Cmd) {
(tb1 ? "" : " NOT"), (tb1 ? "" : " NOT"),
(tc1 ? "" : " NOT"), (tc1 ? "" : " NOT"),
fsci, fsci,
fsci < sizeof(atsFSC)/sizeof(atsFSC[0]) ? atsFSC[fsci] : -1 fsci < sizeof(atsFSC) / sizeof(atsFSC[0]) ? atsFSC[fsci] : -1
); );
} }
pos = 2; pos = 2;
@ -544,8 +544,8 @@ int CmdHF14AInfo(const char *Cmd) {
((card.ats[pos] & 0x80) ? " NOT" : ""), ((card.ats[pos] & 0x80) ? " NOT" : ""),
dr, dr,
ds ds
); );
pos++; pos++;
} }
if (tb1) { if (tb1) {
@ -959,7 +959,7 @@ int SelectCard14443_4(bool disconnect, iso14a_card_select_t *card) {
// get frame length from ATS in data field // get frame length from ATS in data field
if (resp.arg[0] > 1) { if (resp.arg[0] > 1) {
uint8_t fsci = resp.d.asBytes[1] & 0x0f; 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]; frameLength = atsFSC[fsci];
} }
} else { } 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; iso14a_card_select_t *vcard = (iso14a_card_select_t *) resp.d.asBytes;
if (vcard->ats_len > 1) { if (vcard->ats_len > 1) {
uint8_t fsci = vcard->ats[1] & 0x0f; uint8_t fsci = vcard->ats[1] & 0x0f;
if (fsci < sizeof(atsFSC)/sizeof(atsFSC[0])) if (fsci < sizeof(atsFSC) / sizeof(atsFSC[0]))
frameLength = atsFSC[fsci]; 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 // here length USB_CMD_DATA_SIZE=512
// timeout must be authomatically set by "get ATS" // timeout must be authomatically set by "get ATS"
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_APDU | ISO14A_NO_DISCONNECT | cmdc, (datainlen & 0xFFFF), 0}}; 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); memcpy(c.d.asBytes, datain, datainlen);
SendCommand(&c); SendCommand(&c);
uint8_t *recv; uint8_t *recv;

View file

@ -425,8 +425,8 @@ int CmdHFFelicaDumpLite(const char *Cmd) {
} }
uint64_t tracelen = resp.arg[1]; uint64_t tracelen = resp.arg[1];
if (tracelen == 0) if (tracelen == 0)
return 1; return 1;
uint8_t *trace = calloc(tracelen, sizeof(uint8_t)); uint8_t *trace = calloc(tracelen, sizeof(uint8_t));
if (trace == NULL) { if (trace == NULL) {
@ -444,14 +444,14 @@ int CmdHFFelicaDumpLite(const char *Cmd) {
print_hex_break(trace, tracelen, 32); print_hex_break(trace, tracelen, 32);
printSep(); printSep();
uint16_t tracepos = 0; uint16_t tracepos = 0;
while (tracepos < tracelen) while (tracepos < tracelen)
tracepos = PrintFliteBlock(tracepos, trace, tracelen); tracepos = PrintFliteBlock(tracepos, trace, tracelen);
printSep(); printSep();
free(trace); free(trace);
return 0; return 0;
} }

View file

@ -785,7 +785,7 @@ int CmdHFiClassDecrypt(const char *Cmd) {
saveFile(outfilename, "bin", decrypted, fsize); saveFile(outfilename, "bin", decrypted, fsize);
printIclassDumpContents(decrypted, 1, (fsize / 8), fsize); printIclassDumpContents(decrypted, 1, (fsize / 8), fsize);
free(decrypted); free(decrypted);
return 0; return 0;
} }

View file

@ -1282,7 +1282,7 @@ int CmdLegicWipe(const char *Cmd) {
} }
} }
PrintAndLogEx(SUCCESS, "ok\n"); PrintAndLogEx(SUCCESS, "ok\n");
free(data); free(data);
return 0; return 0;
} }

View file

@ -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 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++]; uint32_t v2 = ((ru[7] << 24) | (ru[6] << 16) | (ru[5] << 8) | ru[4]) + c_D[p++];
for (i = 0; i < 12; i += 2) { for (i = 0; i < 12; i += 2) {
uint32_t xor1 = v1 ^ v2; uint32_t xor1 = v1 ^ v2;
uint32_t t1 = ROTL(xor1, v2 & 0x1F) + c_D[p++]; uint32_t t1 = ROTL(xor1, v2 & 0x1F) + c_D[p++];
uint32_t xor2 = v2 ^ t1; uint32_t xor2 = v2 ^ t1;
uint32_t t2 = ROTL(xor2, t1 & 0x1F) + c_D[p++]; uint32_t t2 = ROTL(xor2, t1 & 0x1F) + c_D[p++];
uint32_t xor3 = t1 ^ t2; uint32_t xor3 = t1 ^ t2;
uint32_t xor4 = t2 ^ v1; uint32_t xor4 = t2 ^ v1;
v1 = ROTL(xor3, t2 & 0x1F) + c_D[p++]; 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) { static int ul_comp_write(uint8_t page, uint8_t *data, uint8_t datalen) {
if (data == NULL) if (data == NULL)
return -1; return -1;
uint8_t cmd[18]; uint8_t cmd[18];
memset(cmd, 0x00, sizeof(cmd)); memset(cmd, 0x00, sizeof(cmd));
datalen = (datalen > 16) ? 16 : datalen; datalen = (datalen > 16) ? 16 : datalen;

View file

@ -344,7 +344,7 @@ int CmdLFHitagSim(const char *Cmd) {
} }
static void printHitagConfiguration(uint8_t config) { static void printHitagConfiguration(uint8_t config) {
char msg[100]; char msg[100];
memset(msg, 0, sizeof(msg)); memset(msg, 0, sizeof(msg));
@ -357,10 +357,10 @@ static void printHitagConfiguration(uint8_t config) {
PrintAndLogEx(INFO, "\n\nHitag2 tag information "); PrintAndLogEx(INFO, "\n\nHitag2 tag information ");
PrintAndLogEx(INFO, "------------------------------------"); PrintAndLogEx(INFO, "------------------------------------");
//configuration byte //configuration byte
PrintAndLogEx(SUCCESS, "Config byte : 0x%02X [ %s ]", config, bits); PrintAndLogEx(SUCCESS, "Config byte : 0x%02X [ %s ]", config, bits);
// encoding // encoding
strcat(msg, "Encoding : "); strcat(msg, "Encoding : ");
if (config & 0x1) { if (config & 0x1) {
@ -415,7 +415,7 @@ static void printHitagConfiguration(uint8_t config) {
memset(msg, 0, sizeof(msg)); memset(msg, 0, sizeof(msg));
// page access // page access
strcat(msg, "Page 4,5 : "); strcat(msg, "Page 4,5 : ");
if (config & 0x20) { if (config & 0x20) {
strcat(msg + strlen(msg), "read only"); strcat(msg + strlen(msg), "read only");
} else { } else {
@ -467,9 +467,9 @@ static bool getHitagUid(uint32_t *uid) {
return false; return false;
} }
if ( uid ) if (uid)
*uid = bytes_to_num(resp.d.asBytes, 4); *uid = bytes_to_num(resp.d.asBytes, 4);
return true; return true;
} }
@ -480,18 +480,18 @@ int CmdLFHitagInfo(const char *Cmd) {
char ctmp = tolower(param_getchar(Cmd, 0)); char ctmp = tolower(param_getchar(Cmd, 0));
if (ctmp == 'h') return usage_hitag_info(); if (ctmp == 'h') return usage_hitag_info();
// pwd or key // pwd or key
// read UID // read UID
uint32_t uid = 0; uint32_t uid = 0;
if ( getHitagUid( &uid ) == false ) if (getHitagUid(&uid) == false)
return 1; return 1;
PrintAndLogEx(SUCCESS, "UID: %08X", uid); PrintAndLogEx(SUCCESS, "UID: %08X", uid);
// how to detemine Hitag types? // how to detemine Hitag types?
// read block3, get configuration byte. // read block3, get configuration byte.
// common configurations. // common configurations.
@ -503,7 +503,7 @@ int CmdLFHitagInfo(const char *Cmd) {
return 0; 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 !? // 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) { int CmdLFHitagReader(const char *Cmd) {
@ -568,8 +568,8 @@ int CmdLFHitagReader(const char *Cmd) {
PrintAndLogEx(SUCCESS, "Valid Hitag2 tag found - UID: %08x", id); PrintAndLogEx(SUCCESS, "Valid Hitag2 tag found - UID: %08x", id);
if (htf != RHT2F_UID_ONLY) { if (htf != RHT2F_UID_ONLY) {
PrintAndLogEx(SUCCESS, "Dumping tag memory..." ); PrintAndLogEx(SUCCESS, "Dumping tag memory...");
uint8_t *data = resp.d.asBytes; uint8_t *data = resp.d.asBytes;
char filename[FILE_PATH_SIZE]; char filename[FILE_PATH_SIZE];
@ -580,9 +580,9 @@ int CmdLFHitagReader(const char *Cmd) {
saveFile(filename, "bin", data, 48); saveFile(filename, "bin", data, 48);
saveFileEML(filename, "eml", data, 48, 4); saveFileEML(filename, "eml", data, 48, 4);
saveFileJSON(filename, "json", jsfHitag, data, 48); saveFileJSON(filename, "json", jsfHitag, data, 48);
// block3, 1 byte // block3, 1 byte
printHitagConfiguration(data[4*3] ); printHitagConfiguration(data[4 * 3]);
} }
return 0; return 0;
} }

View file

@ -47,7 +47,7 @@ int usage_lf_indala_sim(void) {
int usage_lf_indala_clone(void) { int usage_lf_indala_clone(void) {
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Usage: lf indala clone [h]<l> <uid> [Q5]"); PrintAndLogEx(NORMAL, "Usage: lf indala clone [h]<l> <uid> [Q5]");
PrintAndLogEx(NORMAL, "Options:"); PrintAndLogEx(NORMAL, "Options:");
PrintAndLogEx(NORMAL, " h : This help"); PrintAndLogEx(NORMAL, " h : This help");
@ -64,27 +64,27 @@ int usage_lf_indala_clone(void) {
// redesigned by marshmellow adjusted from existing decode functions // redesigned by marshmellow adjusted from existing decode functions
// indala id decoding // indala id decoding
int detectIndala(uint8_t *dest, size_t *size, uint8_t *invert) { 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}; 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 idx = 0;
size_t found_size = *size; size_t found_size = *size;
// PSK1 // PSK1
bool res = preambleSearch(dest, preamble64, sizeof(preamble64), &found_size, &idx); bool res = preambleSearch(dest, preamble64, sizeof(preamble64), &found_size, &idx);
if ( res ) { if (res) {
PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK1 found 64"); PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK1 found 64");
goto out; goto out;
} }
idx = 0; idx = 0;
found_size = *size; found_size = *size;
res = preambleSearch(dest, preamble64_i, sizeof(preamble64_i), &found_size, &idx); res = preambleSearch(dest, preamble64_i, sizeof(preamble64_i), &found_size, &idx);
if ( res ) { if (res) {
PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK1 found 64 inverted preamble"); PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK1 found 64 inverted preamble");
goto inv; goto inv;
} }
/* /*
idx = 0; idx = 0;
found_size = *size; 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"); PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK1 found 224");
goto out; goto out;
} }
idx = 0; idx = 0;
found_size = *size; found_size = *size;
res = preambleSearch(dest, preamble224_i, sizeof(preamble224_i), &found_size, &idx); res = preambleSearch(dest, preamble224_i, sizeof(preamble224_i), &found_size, &idx);
if ( res ) { if ( res ) {
PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK1 found 224 inverted preamble"); PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK1 found 224 inverted preamble");
goto inv; goto inv;
} }
*/ */
@ -106,41 +106,41 @@ int detectIndala(uint8_t *dest, size_t *size, uint8_t *invert) {
// PSK2 // PSK2
psk1TOpsk2(dest, *size); psk1TOpsk2(dest, *size);
PrintAndLogEx(DEBUG, "DEBUG: detectindala Converting PSK1 -> PSK2"); PrintAndLogEx(DEBUG, "DEBUG: detectindala Converting PSK1 -> PSK2");
idx = 0; idx = 0;
found_size = *size; found_size = *size;
res = preambleSearch(dest, preamble64, sizeof(preamble64), &found_size, &idx); res = preambleSearch(dest, preamble64, sizeof(preamble64), &found_size, &idx);
if ( res ) { if (res) {
PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK2 found 64 preamble"); PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK2 found 64 preamble");
goto out; goto out;
} }
idx = 0; idx = 0;
found_size = *size; found_size = *size;
res = preambleSearch(dest, preamble224, sizeof(preamble224), &found_size, &idx); res = preambleSearch(dest, preamble224, sizeof(preamble224), &found_size, &idx);
if ( res ) { if (res) {
PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK2 found 224 preamble"); PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK2 found 224 preamble");
goto out; goto out;
} }
idx = 0; idx = 0;
found_size = *size; found_size = *size;
res = preambleSearch(dest, preamble64_i, sizeof(preamble64_i), &found_size, &idx); res = preambleSearch(dest, preamble64_i, sizeof(preamble64_i), &found_size, &idx);
if ( res ) { if (res) {
PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK2 found 64 inverted preamble"); PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK2 found 64 inverted preamble");
goto inv; goto inv;
} }
idx = 0; idx = 0;
found_size = *size; found_size = *size;
res = preambleSearch(dest, preamble224_i, sizeof(preamble224_i), &found_size, &idx); res = preambleSearch(dest, preamble224_i, sizeof(preamble224_i), &found_size, &idx);
if ( res ) { if (res) {
PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK2 found 224 inverted preamble"); PrintAndLogEx(DEBUG, "DEBUG: detectindala PSK2 found 224 inverted preamble");
goto inv; goto inv;
} }
inv: inv:
if ( res == 0 ) { if (res == 0) {
return -4; return -4;
} }
@ -157,18 +157,18 @@ inv:
out: out:
*size = found_size; *size = found_size;
//PrintAndLogEx(INFO, "DEBUG: detectindala RES = %d | %d | %d", res, found_size, idx); //PrintAndLogEx(INFO, "DEBUG: detectindala RES = %d | %d | %d", res, found_size, idx);
if (found_size != 224 && found_size != 64) { if (found_size != 224 && found_size != 64) {
PrintAndLogEx(INFO, "DEBUG: detectindala | %d", found_size); PrintAndLogEx(INFO, "DEBUG: detectindala | %d", found_size);
return -5; return -5;
} }
// 224 formats are typically PSK2 (afaik 2017 Marshmellow) // 224 formats are typically PSK2 (afaik 2017 Marshmellow)
// note loses 1 bit at beginning of transformation... // 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. // 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); setDemodBuf(DemodBuffer, size, idx);
setClockGrid(g_DemodClock, g_DemodStartIdx + (idx * g_DemodClock)); setClockGrid(g_DemodClock, g_DemodStartIdx + (idx * g_DemodClock));
//convert UID to HEX //convert UID to HEX
uint32_t uid1, uid2, uid3, uid4, uid5, uid6, uid7; uint32_t uid1, uid2, uid3, uid4, uid5, uid6, uid7;
uid1 = bytebits_to_byte(DemodBuffer, 32); uid1 = bytebits_to_byte(DemodBuffer, 32);
uid2 = bytebits_to_byte(DemodBuffer + 32, 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) { if (DemodBufferLen == 64) {
PrintAndLogEx( PrintAndLogEx(
@ -225,40 +225,40 @@ int CmdIndalaDemod(const char *Cmd) {
, uid1 , uid1
, uid2 , uid2
); );
uint16_t p1 = 0; uint16_t p1 = 0;
p1 |= DemodBuffer[32+ 3] << 8; p1 |= DemodBuffer[32 + 3] << 8;
p1 |= DemodBuffer[32+ 6] << 5; p1 |= DemodBuffer[32 + 6] << 5;
p1 |= DemodBuffer[32+ 8] << 4; p1 |= DemodBuffer[32 + 8] << 4;
p1 |= DemodBuffer[32+ 9] << 3; p1 |= DemodBuffer[32 + 9] << 3;
p1 |= DemodBuffer[32+11] << 1; p1 |= DemodBuffer[32 + 11] << 1;
p1 |= DemodBuffer[32+16] << 6; p1 |= DemodBuffer[32 + 16] << 6;
p1 |= DemodBuffer[32+19] << 7; p1 |= DemodBuffer[32 + 19] << 7;
p1 |= DemodBuffer[32+20] << 10; p1 |= DemodBuffer[32 + 20] << 10;
p1 |= DemodBuffer[32+21] << 2; p1 |= DemodBuffer[32 + 21] << 2;
p1 |= DemodBuffer[32+22] << 0; p1 |= DemodBuffer[32 + 22] << 0;
p1 |= DemodBuffer[32+24] << 9; p1 |= DemodBuffer[32 + 24] << 9;
/* /*
uint16_t fc = 0; uint16_t fc = 0;
fc |= DemodBuffer[32+ 1] << 0; fc |= DemodBuffer[32+ 1] << 0;
fc |= DemodBuffer[32+ 2] << 1; fc |= DemodBuffer[32+ 2] << 1;
fc |= DemodBuffer[32+ 4] << 2; fc |= DemodBuffer[32+ 4] << 2;
fc |= DemodBuffer[32+ 5] << 3; fc |= DemodBuffer[32+ 5] << 3;
fc |= DemodBuffer[32+ 7] << 4; fc |= DemodBuffer[32+ 7] << 4;
fc |= DemodBuffer[32+10] << 5; fc |= DemodBuffer[32+10] << 5;
fc |= DemodBuffer[32+14] << 6; fc |= DemodBuffer[32+14] << 6;
fc |= DemodBuffer[32+15] << 7; fc |= DemodBuffer[32+15] << 7;
fc |= DemodBuffer[32+17] << 8; fc |= DemodBuffer[32+17] << 8;
*/ */
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(SUCCESS, "Possible de-scramble patterns"); PrintAndLogEx(SUCCESS, "Possible de-scramble patterns");
PrintAndLogEx(SUCCESS, "\tPrinted | __%04d__ [0x%X]", p1, p1); PrintAndLogEx(SUCCESS, "\tPrinted | __%04d__ [0x%X]", p1, p1);
//PrintAndLogEx(SUCCESS, "\tPrinted | __%04d__ [0x%X]", fc, fc); //PrintAndLogEx(SUCCESS, "\tPrinted | __%04d__ [0x%X]", fc, fc);
PrintAndLogEx(SUCCESS, "\tInternal ID | %" PRIu64 , foo); PrintAndLogEx(SUCCESS, "\tInternal ID | %" PRIu64, foo);
} else { } else {
uid3 = bytebits_to_byte(DemodBuffer + 64, 32); uid3 = bytebits_to_byte(DemodBuffer + 64, 32);
uid4 = bytebits_to_byte(DemodBuffer + 96, 32); uid4 = bytebits_to_byte(DemodBuffer + 96, 32);
@ -266,17 +266,17 @@ int CmdIndalaDemod(const char *Cmd) {
uid6 = bytebits_to_byte(DemodBuffer + 160, 32); uid6 = bytebits_to_byte(DemodBuffer + 160, 32);
uid7 = bytebits_to_byte(DemodBuffer + 192, 32); uid7 = bytebits_to_byte(DemodBuffer + 192, 32);
PrintAndLogEx(SUCCESS, "Indala Found - bitlength %d, UID = 0x%x%08x%08x%08x%08x%08x%08x" PrintAndLogEx(SUCCESS, "Indala Found - bitlength %d, UID = 0x%x%08x%08x%08x%08x%08x%08x"
, DemodBufferLen , DemodBufferLen
, uid1 , uid1
, uid2 , uid2
, uid3 , uid3
, uid4 , uid4
, uid5 , uid5
, uid6 , uid6
, uid7 , uid7
); );
} }
if (g_debugMode) { if (g_debugMode) {
PrintAndLogEx(DEBUG, "DEBUG: Indala - printing demodbuffer"); PrintAndLogEx(DEBUG, "DEBUG: Indala - printing demodbuffer");
printDemodBuff(); printDemodBuff();
@ -532,9 +532,9 @@ int CmdIndalaSim(const char *Cmd) {
int CmdIndalaClone(const char *Cmd) { int CmdIndalaClone(const char *Cmd) {
bool isLongUid = false; bool isLongUid = false;
uint8_t data[7*4]; uint8_t data[7 * 4];
int datalen = 0; int datalen = 0;
CLIParserInit("lf indala clone", CLIParserInit("lf indala clone",
"Enables cloning of Indala card with specified uid onto T55x7\n" "Enables cloning of Indala card with specified uid onto T55x7\n"
"defaults to 64.\n", "defaults to 64.\n",
@ -555,8 +555,8 @@ int CmdIndalaClone(const char *Cmd) {
CLIGetHexWithReturn(2, data, &datalen); CLIGetHexWithReturn(2, data, &datalen);
CLIParserFree(); CLIParserFree();
UsbCommand c = {0, {0,0,0}}; UsbCommand c = {0, {0, 0, 0}};
if (isLongUid) { if (isLongUid) {
PrintAndLogEx(INFO, "Preparing to clone Indala 224bit tag with UID %s", sprint_hex(data, datalen)); PrintAndLogEx(INFO, "Preparing to clone Indala 224bit tag with UID %s", sprint_hex(data, datalen));
c.cmd = CMD_INDALA_CLONE_TAG_L; 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); c.d.asDwords[6] = bytes_to_num(data + 24, 4);
} else { } else {
PrintAndLogEx(INFO, "Preparing to clone Indala 64bit tag with UID %s", sprint_hex(data, datalen)); 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[0] = bytes_to_num(data, 4);
c.d.asDwords[1] = bytes_to_num(data + 4, 4); c.d.asDwords[1] = bytes_to_num(data + 4, 4);
} }
clearCommandBuffer(); clearCommandBuffer();
SendCommand(&c); SendCommand(&c);
return 0; return 0;

View file

@ -41,8 +41,8 @@ int usage_lf_keri_sim(void) {
// find KERI preamble in already demoded data // find KERI preamble in already demoded data
int detectKeri(uint8_t *dest, size_t *size, bool *invert) { 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[] = {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_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. // sanity check.
if (*size < sizeof(preamble) + 100) return -1; if (*size < sizeof(preamble) + 100) return -1;
@ -159,10 +159,10 @@ int CmdKeriClone(const char *Cmd) {
// MSB is ONE // MSB is ONE
internalid |= 0x80000000; internalid |= 0x80000000;
// 3 LSB is ONE // 3 LSB is ONE
uint64_t data = ((uint64_t)internalid << 3) + 7; 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; blocks[1] = data >> 32;

View file

@ -237,11 +237,11 @@ int CmdPyramidDemod(const char *Cmd) {
} }
PrintAndLogEx(DEBUG, "DEBUG: Pyramid: checksum : 0x%02X - %02X - %s" PrintAndLogEx(DEBUG, "DEBUG: Pyramid: checksum : 0x%02X - %02X - %s"
, checksum , checksum
, checkCS , checkCS
, (checksum == checkCS) ? _GREEN_("Passed") : _RED_("Failed") , (checksum == checkCS) ? _GREEN_("Passed") : _RED_("Failed")
); );
PrintAndLogEx(DEBUG, "DEBUG: Pyramid: idx: %d, Len: %d, Printing Demod Buffer:", idx, 128); PrintAndLogEx(DEBUG, "DEBUG: Pyramid: idx: %d, Len: %d, Printing Demod Buffer:", idx, 128);
if (g_debugMode) if (g_debugMode)
printDemodBuff(); printDemodBuff();

View file

@ -144,8 +144,8 @@ int usage_t55xx_wakup() {
int usage_t55xx_chk() { int usage_t55xx_chk() {
PrintAndLogEx(NORMAL, "This command uses a dictionary attack"); PrintAndLogEx(NORMAL, "This command uses a dictionary attack");
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, "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 chk [h] <m> [i <*.dic>]"); PrintAndLogEx(NORMAL, "Usage: lf t55xx chk [h] <m> [i <*.dic>]");
PrintAndLogEx(NORMAL, "Options:"); PrintAndLogEx(NORMAL, "Options:");
PrintAndLogEx(NORMAL, " h - this help"); PrintAndLogEx(NORMAL, " h - this help");
@ -161,8 +161,8 @@ int usage_t55xx_chk() {
int usage_t55xx_bruteforce() { int usage_t55xx_bruteforce() {
PrintAndLogEx(NORMAL, "This command uses bruteforce to scan a number range"); PrintAndLogEx(NORMAL, "This command uses bruteforce to scan a number range");
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, "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 bruteforce [h] <start password> <end password>"); PrintAndLogEx(NORMAL, "Usage: lf t55xx bruteforce [h] <start password> <end password>");
PrintAndLogEx(NORMAL, " password must be 4 bytes (8 hex symbols)"); PrintAndLogEx(NORMAL, " password must be 4 bytes (8 hex symbols)");
PrintAndLogEx(NORMAL, "Options:"); PrintAndLogEx(NORMAL, "Options:");
@ -177,9 +177,9 @@ int usage_t55xx_bruteforce() {
} }
int usage_t55xx_recoverpw() { int usage_t55xx_recoverpw() {
PrintAndLogEx(NORMAL, "This command uses a few tricks to try to recover mangled password"); 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, "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, "Usage: lf t55xx recoverpw [password]");
PrintAndLogEx(NORMAL, " password must be 4 bytes (8 hex symbols)"); PrintAndLogEx(NORMAL, " password must be 4 bytes (8 hex symbols)");
PrintAndLogEx(NORMAL, " default password is 51243648, used by many cloners"); PrintAndLogEx(NORMAL, " default password is 51243648, used by many cloners");
@ -1058,7 +1058,7 @@ int CmdT55xxWriteBlock(const char *Cmd) {
c.arg[2] = password; c.arg[2] = password;
c.d.asBytes[0] |= 0x1; c.d.asBytes[0] |= 0x1;
} }
clearCommandBuffer(); clearCommandBuffer();
SendCommand(&c); SendCommand(&c);
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) { 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 // bit1 = page to read from
// arg1: which block to read // arg1: which block to read
// arg2: password // arg2: password
uint8_t arg0 = ( page << 1 | (pwdmode) ); uint8_t arg0 = (page << 1 | (pwdmode));
UsbCommand c = {CMD_T55XX_READ_BLOCK, {arg0, block, password}}; UsbCommand c = {CMD_T55XX_READ_BLOCK, {arg0, block, password}};
clearCommandBuffer(); clearCommandBuffer();
SendCommand(&c); SendCommand(&c);
@ -1637,7 +1637,7 @@ int CmdT55xxChkPwds(const char *Cmd) {
bool found = false; bool found = false;
uint8_t timeout = 0; uint8_t timeout = 0;
uint8_t *keyBlock = NULL; uint8_t *keyBlock = NULL;
char cmdp = tolower(param_getchar(Cmd, 0)); char cmdp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) == 0 || cmdp == 'h') return usage_t55xx_chk(); if (strlen(Cmd) == 0 || cmdp == 'h') return usage_t55xx_chk();
@ -1676,7 +1676,7 @@ int CmdT55xxChkPwds(const char *Cmd) {
found = tryDetectModulation(); found = tryDetectModulation();
if (found) { if (found) {
PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08") " ]", resp.arg[1]); PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08") " ]", resp.arg[1]);
} else { } else {
PrintAndLogEx(WARNING, "Check pwd failed"); PrintAndLogEx(WARNING, "Check pwd failed");
} }
@ -1688,22 +1688,22 @@ int CmdT55xxChkPwds(const char *Cmd) {
} }
if (cmdp == 'i') { if (cmdp == 'i') {
int len = strlen(Cmd + 2); int len = strlen(Cmd + 2);
if (len > FILE_PATH_SIZE) len = FILE_PATH_SIZE; if (len > FILE_PATH_SIZE) len = FILE_PATH_SIZE;
memcpy(filename, Cmd + 2, len); memcpy(filename, Cmd + 2, len);
uint16_t keycount = 0; uint16_t keycount = 0;
size_t datalen = 0; size_t datalen = 0;
// TODO, a way of reallocating memory if file was larger // TODO, a way of reallocating memory if file was larger
keyBlock = calloc(4*200, sizeof(uint8_t)); keyBlock = calloc(4 * 200, sizeof(uint8_t));
if ( keyBlock == NULL ) { if (keyBlock == NULL) {
PrintAndLogDevice(WARNING, "error, cannot allocate memory "); PrintAndLogDevice(WARNING, "error, cannot allocate memory ");
return 1; return 1;
} }
int res = loadFileDICTIONARY(filename, "dic", keyBlock, &datalen, 4, &keycount ); int res = loadFileDICTIONARY(filename, "dic", keyBlock, &datalen, 4, &keycount);
if (res || keycount == 0) { if (res || keycount == 0) {
PrintAndLogEx(WARNING, "No keys found in file"); PrintAndLogEx(WARNING, "No keys found in file");
free(keyBlock); free(keyBlock);
@ -1728,7 +1728,7 @@ int CmdT55xxChkPwds(const char *Cmd) {
curr_password = bytes_to_num(keyBlock + 4 * c, 4); curr_password = bytes_to_num(keyBlock + 4 * c, 4);
PrintAndLogEx(INFO, "Testing %08X", curr_password); PrintAndLogEx(INFO, "Testing %08X", curr_password);
if (!AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, curr_password)) { if (!AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, curr_password)) {
continue; continue;
} }
@ -1776,7 +1776,7 @@ int CmdT55xxBruteForce(const char *Cmd) {
PrintAndLogEx(INFO, "Search password range [%08X -> %08X]", start_password, end_password); PrintAndLogEx(INFO, "Search password range [%08X -> %08X]", start_password, end_password);
while (!found) { while (!found) {
printf("."); printf(".");
fflush(stdout); fflush(stdout);
@ -1788,7 +1788,7 @@ int CmdT55xxBruteForce(const char *Cmd) {
if (curr == end_password) if (curr == end_password)
break; break;
curr++; curr++;
} }
@ -1806,12 +1806,12 @@ int CmdT55xxBruteForce(const char *Cmd) {
int tryOnePassword(uint32_t password) { int tryOnePassword(uint32_t password) {
PrintAndLogEx(INFO, "Trying password %08X", password); PrintAndLogEx(INFO, "Trying password %08X", password);
AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, password); AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, password);
if (getSignalProperties()->isnoise == false) if (getSignalProperties()->isnoise == false)
return 0; return 0;
if (tryDetectModulation()) if (tryDetectModulation())
return 1; return 1;
else else
@ -1834,12 +1834,12 @@ int CmdT55xxRecoverPW(const char *Cmd) {
while (bit < 32) { while (bit < 32) {
curr_password = orig_password ^ (1u << bit); curr_password = orig_password ^ (1u << bit);
found = tryOnePassword(curr_password); found = tryOnePassword(curr_password);
if ( found == 1) if (found == 1)
goto out; goto out;
bit++; bit++;
if (IsCancelled()) if (IsCancelled())
return 0; return 0;
} }
@ -1857,15 +1857,15 @@ int CmdT55xxRecoverPW(const char *Cmd) {
bit++; bit++;
continue; continue;
} }
found = tryOnePassword(curr_password); found = tryOnePassword(curr_password);
if ( found == 1 ) if (found == 1)
goto out; goto out;
bit++; bit++;
prev_password = curr_password; prev_password = curr_password;
if (IsCancelled()) if (IsCancelled())
return 0; return 0;
} }
@ -1881,13 +1881,13 @@ int CmdT55xxRecoverPW(const char *Cmd) {
continue; continue;
} }
found = tryOnePassword(curr_password); found = tryOnePassword(curr_password);
if ( found == 1 ) if (found == 1)
goto out; goto out;
bit++; bit++;
prev_password = curr_password; prev_password = curr_password;
if (IsCancelled()) if (IsCancelled())
return 0; return 0;
} }

View file

@ -679,14 +679,14 @@ int CmdSmartUpgrade(const char *Cmd) {
if (fsize < 0) { if (fsize < 0) {
PrintAndLogEx(FAILED, "Could not determine size of SHA-512 file"); PrintAndLogEx(FAILED, "Could not determine size of SHA-512 file");
fclose(f); fclose(f);
free(dump); free(dump);
return 1; return 1;
} }
if (fsize < 128) { if (fsize < 128) {
PrintAndLogEx(FAILED, "SHA-512 file too short"); PrintAndLogEx(FAILED, "SHA-512 file too short");
fclose(f); fclose(f);
free(dump); free(dump);
return 1; return 1;
} }
@ -700,20 +700,20 @@ int CmdSmartUpgrade(const char *Cmd) {
uint8_t hash1[64]; uint8_t hash1[64];
if (bytes_read != 128 || param_gethex(hashstring, 0, hash1, 128)) { if (bytes_read != 128 || param_gethex(hashstring, 0, hash1, 128)) {
PrintAndLogEx(FAILED, "Couldn't read SHA-512 file"); PrintAndLogEx(FAILED, "Couldn't read SHA-512 file");
free(dump); free(dump);
return 1; return 1;
} }
uint8_t hash2[64]; uint8_t hash2[64];
if (sha512hash(dump, firmware_size, hash2)) { if (sha512hash(dump, firmware_size, hash2)) {
PrintAndLogEx(FAILED, "Couldn't calculate SHA-512 of firmware"); PrintAndLogEx(FAILED, "Couldn't calculate SHA-512 of firmware");
free(dump); free(dump);
return 1; return 1;
} }
if (memcmp(hash1, hash2, 64)) { if (memcmp(hash1, hash2, 64)) {
PrintAndLogEx(FAILED, "Couldn't verify integrity of firmware file " _RED_("(wrong SHA-512 hash)")); PrintAndLogEx(FAILED, "Couldn't verify integrity of firmware file " _RED_("(wrong SHA-512 hash)"));
free(dump); free(dump);
return 1; return 1;
} }

View file

@ -417,16 +417,16 @@ int main(int argc, char **argv) {
infiles[0] = fopen(argv[2], "rb"); infiles[0] = fopen(argv[2], "rb");
if (infiles[0] == NULL) { if (infiles[0] == NULL) {
fprintf(stderr, "Error. Cannot open input file %s\n\n", argv[2]); fprintf(stderr, "Error. Cannot open input file %s\n\n", argv[2]);
free(infiles); free(infiles);
return (EXIT_FAILURE); return (EXIT_FAILURE);
} }
outfile = fopen(argv[3], "wb"); outfile = fopen(argv[3], "wb");
if (outfile == NULL) { if (outfile == NULL) {
fprintf(stderr, "Error. Cannot open output file %s\n\n", argv[3]); fprintf(stderr, "Error. Cannot open output file %s\n\n", argv[3]);
free(infiles); free(infiles);
return (EXIT_FAILURE); return (EXIT_FAILURE);
} }
int ret = zlib_decompress(infiles[0], outfile); int ret = zlib_decompress(infiles[0], outfile);
free(infiles); free(infiles);
return (ret); return (ret);
@ -466,13 +466,13 @@ int main(int argc, char **argv) {
if (outfile == NULL) { if (outfile == NULL) {
fprintf(stderr, "Error. Cannot open output file %s\n\n", argv[argc - 1]); fprintf(stderr, "Error. Cannot open output file %s\n\n", argv[argc - 1]);
free(infile_names); free(infile_names);
free(infiles); free(infiles);
return (EXIT_FAILURE); return (EXIT_FAILURE);
} }
if (generate_version_file) { if (generate_version_file) {
if (generate_fpga_version_info(infiles, infile_names, num_input_files, outfile)) { if (generate_fpga_version_info(infiles, infile_names, num_input_files, outfile)) {
free(infile_names); free(infile_names);
free(infiles); free(infiles);
return (EXIT_FAILURE); return (EXIT_FAILURE);
} }
} else { } else {

View file

@ -630,7 +630,7 @@ usage(void) {
"\t preset values\n" "\t preset values\n"
"\n" "\n"
"Copyright (C)\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" "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" "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
"Version " "Version "

View file

@ -242,9 +242,9 @@ void mrev(model_t *model) {
void mnovel(model_t *model) { void mnovel(model_t *model) {
/* remove name and check string from modified model */ /* remove name and check string from modified model */
/* previous classification no longer applies */ /* previous classification no longer applies */
model->name = NULL; model->name = NULL;
model->flags &= ~P_CLMASK; model->flags &= ~P_CLMASK;
pfree(&model->check); pfree(&model->check);
pfree(&model->magic); pfree(&model->magic);
} }

View file

@ -988,10 +988,10 @@ pcrc(const poly_t message, const poly_t divisor, const poly_t init, const poly_t
/* 0 <= ofs <= BMP_BIT, location of the first bit of the result */ /* 0 <= ofs <= BMP_BIT, location of the first bit of the result */
pshift(&result, result, 0UL, ofs, (init.length > max + divisor.length ? init.length - max - divisor.length : 0UL) + divisor.length + ofs, 0UL); pshift(&result, result, 0UL, ofs, (init.length > max + divisor.length ? init.length - max - divisor.length : 0UL) + divisor.length + ofs, 0UL);
} }
if ( result.bitmap != NULL ) if (result.bitmap != NULL)
psum(&result, xorout, 0UL); psum(&result, xorout, 0UL);
return (result); return (result);
} }

View file

@ -379,98 +379,98 @@ static const bmp_t b32[] = {
BMP_C(0x94000000) << (BMP_BIT - 32), /* 115 -- 8, 94 */ BMP_C(0x94000000) << (BMP_BIT - 32), /* 115 -- 8, 94 */
BMP_C(0x97000000) << (BMP_BIT - 32), /* 116 -- 8, 97 */ BMP_C(0x97000000) << (BMP_BIT - 32), /* 116 -- 8, 97 */
BMP_C(0x98000000) << (BMP_BIT - 32), /* 117 -- 6, 26 */ BMP_C(0x98000000) << (BMP_BIT - 32), /* 117 -- 6, 26 */
BMP_C(0x99000000) << (BMP_BIT - 32), /* 118 -- 8, 99 */ BMP_C(0x99000000) << (BMP_BIT - 32), /* 118 -- 8, 99 */
BMP_C(0x9b000000) << (BMP_BIT - 32), /* 119 -- 8, 9b */ BMP_C(0x9b000000) << (BMP_BIT - 32), /* 119 -- 8, 9b */
BMP_C(0x9c000000) << (BMP_BIT - 32), /* 120 -- 6, 27 */ BMP_C(0x9c000000) << (BMP_BIT - 32), /* 120 -- 6, 27 */
BMP_C(0x9d5e4de2) << (BMP_BIT - 32), /* 121 -- 31,4eaf26f1 */ BMP_C(0x9d5e4de2) << (BMP_BIT - 32), /* 121 -- 31,4eaf26f1 */
BMP_C(0x9e000000) << (BMP_BIT - 32), /* 122 -- 7, 4f */ BMP_C(0x9e000000) << (BMP_BIT - 32), /* 122 -- 7, 4f */
BMP_C(0x9ecf0000) << (BMP_BIT - 32), /* 123 -- 16, 9ecf */ BMP_C(0x9ecf0000) << (BMP_BIT - 32), /* 123 -- 16, 9ecf */
BMP_C(0xa0660000) << (BMP_BIT - 32), /* 124 -- 16, a066 */ BMP_C(0xa0660000) << (BMP_BIT - 32), /* 124 -- 16, a066 */
BMP_C(0xa0970000) << (BMP_BIT - 32), /* 125 -- 16, a097 */ BMP_C(0xa0970000) << (BMP_BIT - 32), /* 125 -- 16, a097 */
BMP_C(0xa1000000) << (BMP_BIT - 32), /* 126 -- 8, a1 */ BMP_C(0xa1000000) << (BMP_BIT - 32), /* 126 -- 8, a1 */
BMP_C(0xa3660000) << (BMP_BIT - 32), /* 127 -- 16, a366 */ BMP_C(0xa3660000) << (BMP_BIT - 32), /* 127 -- 16, a366 */
BMP_C(0xa6000000) << (BMP_BIT - 32), /* 128 -- 7, 53 */ BMP_C(0xa6000000) << (BMP_BIT - 32), /* 128 -- 7, 53 */
BMP_C(0xa7000000) << (BMP_BIT - 32), /* 129 -- 8, a7 */ BMP_C(0xa7000000) << (BMP_BIT - 32), /* 129 -- 8, a7 */
BMP_C(0xa8000000) << (BMP_BIT - 32), /* 130 -- 5, 15 */ BMP_C(0xa8000000) << (BMP_BIT - 32), /* 130 -- 5, 15 */
BMP_C(0xa8190000) << (BMP_BIT - 32), /* 131 -- 16, a819 */ BMP_C(0xa8190000) << (BMP_BIT - 32), /* 131 -- 16, a819 */
BMP_C(0xa833982b) << (BMP_BIT - 32), /* 132 -- 32,a833982b */ BMP_C(0xa833982b) << (BMP_BIT - 32), /* 132 -- 32,a833982b */
BMP_C(0xabcdef00) << (BMP_BIT - 32), /* 133 -- 24, abcdef */ BMP_C(0xabcdef00) << (BMP_BIT - 32), /* 133 -- 24, abcdef */
BMP_C(0xac000000) << (BMP_BIT - 32), /* 134 -- 8, ac */ BMP_C(0xac000000) << (BMP_BIT - 32), /* 134 -- 8, ac */
BMP_C(0xaee70000) << (BMP_BIT - 32), /* 135 -- 16, aee7 */ BMP_C(0xaee70000) << (BMP_BIT - 32), /* 135 -- 16, aee7 */
BMP_C(0xb0000000) << (BMP_BIT - 32), /* 136 -- 4, b */ BMP_C(0xb0000000) << (BMP_BIT - 32), /* 136 -- 4, b */
BMP_C(0xb0010000) << (BMP_BIT - 32), /* 137 -- 16, b001 */ BMP_C(0xb0010000) << (BMP_BIT - 32), /* 137 -- 16, b001 */
BMP_C(0xb2aa0000) << (BMP_BIT - 32), /* 138 -- 16, b2aa */ BMP_C(0xb2aa0000) << (BMP_BIT - 32), /* 138 -- 16, b2aa */
BMP_C(0xb3400000) << (BMP_BIT - 32), /* 139 -- 12, b34 */ BMP_C(0xb3400000) << (BMP_BIT - 32), /* 139 -- 12, b34 */
BMP_C(0xb42d8000) << (BMP_BIT - 32), /* 140 -- 17, 1685b */ BMP_C(0xb42d8000) << (BMP_BIT - 32), /* 140 -- 17, 1685b */
BMP_C(0xb4600000) << (BMP_BIT - 32), /* 141 -- 11, 5a3 */ BMP_C(0xb4600000) << (BMP_BIT - 32), /* 141 -- 11, 5a3 */
BMP_C(0xb4c80000) << (BMP_BIT - 32), /* 142 -- 16, b4c8 */ BMP_C(0xb4c80000) << (BMP_BIT - 32), /* 142 -- 16, b4c8 */
BMP_C(0xb4f3e600) << (BMP_BIT - 32), /* 143 -- 24, b4f3e6 */ BMP_C(0xb4f3e600) << (BMP_BIT - 32), /* 143 -- 24, b4f3e6 */
BMP_C(0xb704ce00) << (BMP_BIT - 32), /* 144 -- 24, b704ce */ BMP_C(0xb704ce00) << (BMP_BIT - 32), /* 144 -- 24, b704ce */
BMP_C(0xb798b438) << (BMP_BIT - 32), /* 145 -- 32,b798b438 */ BMP_C(0xb798b438) << (BMP_BIT - 32), /* 145 -- 32,b798b438 */
BMP_C(0xbb3d0000) << (BMP_BIT - 32), /* 146 -- 16, bb3d */ BMP_C(0xbb3d0000) << (BMP_BIT - 32), /* 146 -- 16, bb3d */
BMP_C(0xbc000000) << (BMP_BIT - 32), /* 147 -- 6,2f/ 8,bc */ BMP_C(0xbc000000) << (BMP_BIT - 32), /* 147 -- 6,2f/ 8,bc */
BMP_C(0xbd0be338) << (BMP_BIT - 32), /* 148 -- 32,bd0be338 */ BMP_C(0xbd0be338) << (BMP_BIT - 32), /* 148 -- 32,bd0be338 */
BMP_C(0xbdf40000) << (BMP_BIT - 32), /* 149 -- 16, bdf4 */ BMP_C(0xbdf40000) << (BMP_BIT - 32), /* 149 -- 16, bdf4 */
BMP_C(0xbf050000) << (BMP_BIT - 32), /* 150 -- 16, bf05 */ BMP_C(0xbf050000) << (BMP_BIT - 32), /* 150 -- 16, bf05 */
BMP_C(0xc0000000) << (BMP_BIT - 32), /* 151 -- 3, 6 */ BMP_C(0xc0000000) << (BMP_BIT - 32), /* 151 -- 3, 6 */
BMP_C(0xc2000000) << (BMP_BIT - 32), /* 152 -- 7, 61 */ BMP_C(0xc2000000) << (BMP_BIT - 32), /* 152 -- 7, 61 */
BMP_C(0xc25a5600) << (BMP_BIT - 32), /* 153 -- 24, c25a56 */ BMP_C(0xc25a5600) << (BMP_BIT - 32), /* 153 -- 24, c25a56 */
BMP_C(0xc2b70000) << (BMP_BIT - 32), /* 154 -- 16, c2b7 */ BMP_C(0xc2b70000) << (BMP_BIT - 32), /* 154 -- 16, c2b7 */
BMP_C(0xc2b80000) << (BMP_BIT - 32), /* 155 -- 14, 30ae */ BMP_C(0xc2b80000) << (BMP_BIT - 32), /* 155 -- 14, 30ae */
BMP_C(0xc4000000) << (BMP_BIT - 32), /* 156 -- 8, c4 */ BMP_C(0xc4000000) << (BMP_BIT - 32), /* 156 -- 8, c4 */
BMP_C(0xc6c60000) << (BMP_BIT - 32), /* 157 -- 16, c6c6 */ BMP_C(0xc6c60000) << (BMP_BIT - 32), /* 157 -- 16, c6c6 */
BMP_C(0xc7000000) << (BMP_BIT - 32), /* 158 -- 8, c7 */ BMP_C(0xc7000000) << (BMP_BIT - 32), /* 158 -- 8, c7 */
BMP_C(0xc704dd7b) << (BMP_BIT - 32), /* 159 -- 32,c704dd7b */ BMP_C(0xc704dd7b) << (BMP_BIT - 32), /* 159 -- 32,c704dd7b */
BMP_C(0xc8000000) << (BMP_BIT - 32), /* 160 -- 5, 19 */ BMP_C(0xc8000000) << (BMP_BIT - 32), /* 160 -- 5, 19 */
BMP_C(0xc8670000) << (BMP_BIT - 32), /* 161 -- 16, c867 */ BMP_C(0xc8670000) << (BMP_BIT - 32), /* 161 -- 16, c867 */
BMP_C(0xcbf43926) << (BMP_BIT - 32), /* 162 -- 32,cbf43926 */ BMP_C(0xcbf43926) << (BMP_BIT - 32), /* 162 -- 32,cbf43926 */
BMP_C(0xcde70300) << (BMP_BIT - 32), /* 163 -- 24, cde703 */ BMP_C(0xcde70300) << (BMP_BIT - 32), /* 163 -- 24, cde703 */
BMP_C(0xce3c0000) << (BMP_BIT - 32), /* 164 -- 16, ce3c */ BMP_C(0xce3c0000) << (BMP_BIT - 32), /* 164 -- 16, ce3c */
BMP_C(0xd0000000) << (BMP_BIT - 32), /* 165 -- 8, d0 */ BMP_C(0xd0000000) << (BMP_BIT - 32), /* 165 -- 8, d0 */
BMP_C(0xd02a0000) << (BMP_BIT - 32), /* 166 -- 15, 6815 */ BMP_C(0xd02a0000) << (BMP_BIT - 32), /* 166 -- 15, 6815 */
BMP_C(0xd0db0000) << (BMP_BIT - 32), /* 167 -- 16, d0db */ BMP_C(0xd0db0000) << (BMP_BIT - 32), /* 167 -- 16, d0db */
BMP_C(0xd3100000) << (BMP_BIT - 32), /* 168 -- 12, d31 */ BMP_C(0xd3100000) << (BMP_BIT - 32), /* 168 -- 12, d31 */
BMP_C(0xd3be9568) << (BMP_BIT - 32), /* 169 -- 30,34efa55a */ BMP_C(0xd3be9568) << (BMP_BIT - 32), /* 169 -- 30,34efa55a */
BMP_C(0xd4d00000) << (BMP_BIT - 32), /* 170 -- 12, d4d */ BMP_C(0xd4d00000) << (BMP_BIT - 32), /* 170 -- 12, d4d */
BMP_C(0xd5000000) << (BMP_BIT - 32), /* 171 -- 8, d5 */ BMP_C(0xd5000000) << (BMP_BIT - 32), /* 171 -- 8, d5 */
BMP_C(0xd64e0000) << (BMP_BIT - 32), /* 172 -- 16, d64e */ BMP_C(0xd64e0000) << (BMP_BIT - 32), /* 172 -- 16, d64e */
BMP_C(0xda000000) << (BMP_BIT - 32), /* 173 -- 8, da */ BMP_C(0xda000000) << (BMP_BIT - 32), /* 173 -- 8, da */
BMP_C(0xdaf00000) << (BMP_BIT - 32), /* 174 -- 12, daf */ BMP_C(0xdaf00000) << (BMP_BIT - 32), /* 174 -- 12, daf */
BMP_C(0xdebb20e3) << (BMP_BIT - 32), /* 175 -- 32,debb20e3 */ BMP_C(0xdebb20e3) << (BMP_BIT - 32), /* 175 -- 32,debb20e3 */
BMP_C(0xdf000000) << (BMP_BIT - 32), /* 176 -- 8, df */ BMP_C(0xdf000000) << (BMP_BIT - 32), /* 176 -- 8, df */
BMP_C(0xe0000000) << (BMP_BIT - 32), /* 177 -- 3, 7 */ BMP_C(0xe0000000) << (BMP_BIT - 32), /* 177 -- 3, 7 */
BMP_C(0xe3069283) << (BMP_BIT - 32), /* 178 -- 32,e3069283 */ BMP_C(0xe3069283) << (BMP_BIT - 32), /* 178 -- 32,e3069283 */
BMP_C(0xe3940000) << (BMP_BIT - 32), /* 179 -- 16, e394 */ BMP_C(0xe3940000) << (BMP_BIT - 32), /* 179 -- 16, e394 */
BMP_C(0xe5cc0000) << (BMP_BIT - 32), /* 180 -- 16, e5cc */ BMP_C(0xe5cc0000) << (BMP_BIT - 32), /* 180 -- 16, e5cc */
BMP_C(0xe7a80000) << (BMP_BIT - 32), /* 181 -- 13, 1cf5 */ BMP_C(0xe7a80000) << (BMP_BIT - 32), /* 181 -- 13, 1cf5 */
BMP_C(0xe8000000) << (BMP_BIT - 32), /* 182 -- 6, 3a */ BMP_C(0xe8000000) << (BMP_BIT - 32), /* 182 -- 6, 3a */
BMP_C(0xea000000) << (BMP_BIT - 32), /* 183 -- 7, 75 */ BMP_C(0xea000000) << (BMP_BIT - 32), /* 183 -- 7, 75 */
BMP_C(0xea820000) << (BMP_BIT - 32), /* 184 -- 16, ea82 */ BMP_C(0xea820000) << (BMP_BIT - 32), /* 184 -- 16, ea82 */
BMP_C(0xec000000) << (BMP_BIT - 32), /* 185 -- 6, 3b */ BMP_C(0xec000000) << (BMP_BIT - 32), /* 185 -- 6, 3b */
BMP_C(0xf0000000) << (BMP_BIT - 32), /* 186 -- 4, f */ BMP_C(0xf0000000) << (BMP_BIT - 32), /* 186 -- 4, f */
BMP_C(0xf0b80000) << (BMP_BIT - 32), /* 187 -- 16, f0b8 */ BMP_C(0xf0b80000) << (BMP_BIT - 32), /* 187 -- 16, f0b8 */
BMP_C(0xf1300000) << (BMP_BIT - 32), /* 188 -- 12, f13 */ BMP_C(0xf1300000) << (BMP_BIT - 32), /* 188 -- 12, f13 */
BMP_C(0xf4000000) << (BMP_BIT - 32), /* 189 -- 8, f4 */ BMP_C(0xf4000000) << (BMP_BIT - 32), /* 189 -- 8, f4 */
BMP_C(0xf4acfb13) << (BMP_BIT - 32), /* 190 -- 32,f4acfb13 */ BMP_C(0xf4acfb13) << (BMP_BIT - 32), /* 190 -- 32,f4acfb13 */
BMP_C(0xf5b00000) << (BMP_BIT - 32), /* 191 -- 12, f5b */ BMP_C(0xf5b00000) << (BMP_BIT - 32), /* 191 -- 12, f5b */
BMP_C(0xf6400000) << (BMP_BIT - 32), /* 192 -- 10, 3d9 */ BMP_C(0xf6400000) << (BMP_BIT - 32), /* 192 -- 10, 3d9 */
BMP_C(0xf7000000) << (BMP_BIT - 32), /* 193 -- 8, f7 */ BMP_C(0xf7000000) << (BMP_BIT - 32), /* 193 -- 8, f7 */
BMP_C(0xf8000000) << (BMP_BIT - 32), /* 194 -- 5, 1f */ BMP_C(0xf8000000) << (BMP_BIT - 32), /* 194 -- 5, 1f */
BMP_C(0xfc000000) << (BMP_BIT - 32), /* 195 -- 6, 3f */ BMP_C(0xfc000000) << (BMP_BIT - 32), /* 195 -- 6, 3f */
BMP_C(0xfc891918) << (BMP_BIT - 32), /* 196 -- 32,fc891918 */ BMP_C(0xfc891918) << (BMP_BIT - 32), /* 196 -- 32,fc891918 */
BMP_C(0xfd000000) << (BMP_BIT - 32), /* 197 -- 8, fd */ BMP_C(0xfd000000) << (BMP_BIT - 32), /* 197 -- 8, fd */
BMP_C(0xfe000000) << (BMP_BIT - 32), /* 198 -- 7, 7f */ BMP_C(0xfe000000) << (BMP_BIT - 32), /* 198 -- 7, 7f */
BMP_C(0xfedcba00) << (BMP_BIT - 32), /* 199 -- 24, fedcba */ BMP_C(0xfedcba00) << (BMP_BIT - 32), /* 199 -- 24, fedcba */
BMP_C(0xfee80000) << (BMP_BIT - 32), /* 200 -- 16, fee8 */ BMP_C(0xfee80000) << (BMP_BIT - 32), /* 200 -- 16, fee8 */
BMP_C(0xff000000) << (BMP_BIT - 32), /* 201 -- 8, ff */ BMP_C(0xff000000) << (BMP_BIT - 32), /* 201 -- 8, ff */
BMP_C(0xffc00000) << (BMP_BIT - 32), /* 202 -- 10, 3ff */ BMP_C(0xffc00000) << (BMP_BIT - 32), /* 202 -- 10, 3ff */
BMP_C(0xfff00000) << (BMP_BIT - 32), /* 203 -- 12, fff */ BMP_C(0xfff00000) << (BMP_BIT - 32), /* 203 -- 12, fff */
BMP_C(0xfffc0000) << (BMP_BIT - 32), /* 204 -- 14, 3fff */ BMP_C(0xfffc0000) << (BMP_BIT - 32), /* 204 -- 14, 3fff */
BMP_C(0xffff0000) << (BMP_BIT - 32), /* 205 -- 16, ffff */ BMP_C(0xffff0000) << (BMP_BIT - 32), /* 205 -- 16, ffff */
BMP_C(0xffffff00) << (BMP_BIT - 32), /* 206 -- 24, ffffff */ BMP_C(0xffffff00) << (BMP_BIT - 32), /* 206 -- 24, ffffff */
BMP_C(0xfffffffc) << (BMP_BIT - 32), /* 207 -- 30,3fffffff */ BMP_C(0xfffffffc) << (BMP_BIT - 32), /* 207 -- 30,3fffffff */
BMP_C(0xfffffffe) << (BMP_BIT - 32), /* 208 -- 31,7fffffff */ BMP_C(0xfffffffe) << (BMP_BIT - 32), /* 208 -- 31,7fffffff */
BMP_C(0xffffffff) << (BMP_BIT - 32), /* 209 -- 32,ffffffff */ BMP_C(0xffffffff) << (BMP_BIT - 32), /* 209 -- 32,ffffffff */
}; };
static const struct malias aliases[]; static const struct malias aliases[];
@ -479,297 +479,297 @@ static const struct malias aliases[];
* Sorted by left-justified polynomial for bsearch(). * Sorted by left-justified polynomial for bsearch().
*/ */
static const struct mpreset models[] = { static const struct mpreset models[] = {
{64UL, b64, b64a, P_LE | P_CONFIR, b64a, b64b, b64c, aliases + 130}, /* 0 */ {64UL, b64, b64a, P_LE | P_CONFIR, b64a, b64b, b64c, aliases + 130}, /* 0 */
{32UL, b32+ 0, 0, P_BE | P_CONFIR, 0, b32+148, 0, aliases+107}, /* 1 */ {32UL, b32 + 0, 0, P_BE | P_CONFIR, 0, b32 + 148, 0, aliases + 107}, /* 1 */
{40UL, b40, 0, P_BE | P_ACADEM, b40a, b40b, b40c, aliases + 115}, /* 2 */ {40UL, b40, 0, P_BE | P_ACADEM, b40a, b40b, b40c, aliases + 115}, /* 2 */
{24UL, b32+ 3, b32+ 76, P_LE | P_ATTEST, 0, b32+153, 0, aliases+ 77}, /* 3 */ {24UL, b32 + 3, b32 + 76, P_LE | P_ATTEST, 0, b32 + 153, 0, aliases + 77}, /* 3 */
{32UL, b32+ 8, 0, P_BE | P_ATTEST, b32+209, b32+ 92, b32+159, aliases+ 98}, /* 4 */ {32UL, b32 + 8, 0, P_BE | P_ATTEST, b32 + 209, b32 + 92, b32 + 159, aliases + 98}, /* 4 */
{32UL, b32+ 8, b32+209, P_BE | P_ATTEST, 0, b32+ 7, 0, aliases+104}, /* 5 */ {32UL, b32 + 8, b32 + 209, P_BE | P_ATTEST, 0, b32 + 7, 0, aliases + 104}, /* 5 */
{32UL, b32+ 8, b32+209, P_BE | P_ATTEST, b32+209, b32+196, b32+159, aliases+ 96}, /* 6 */ {32UL, b32 + 8, b32 + 209, P_BE | P_ATTEST, b32 + 209, b32 + 196, b32 + 159, aliases + 96}, /* 6 */
{32UL, b32+ 8, b32+209, P_LE | P_CONFIR, 0, b32+ 56, 0, aliases+103}, /* 7 */ {32UL, b32 + 8, b32 + 209, P_LE | P_CONFIR, 0, b32 + 56, 0, aliases + 103}, /* 7 */
{32UL, b32+ 8, b32+209, P_LE | P_ATTEST, b32+209, b32+162, b32+175, aliases+102}, /* 8 */ {32UL, b32 + 8, b32 + 209, P_LE | P_ATTEST, b32 + 209, b32 + 162, b32 + 175, aliases + 102}, /* 8 */
{16UL, b32 + 9, 0, P_BE | P_ATTEST, 0, b32 + 5, 0, aliases + 36}, /* 9 */ {16UL, b32 + 9, 0, P_BE | P_ATTEST, 0, b32 + 5, 0, aliases + 36}, /* 9 */
{16UL, b32 + 9, 0, P_BE | P_ATTEST, b32 + 1, b32 + 4, b32 + 9, aliases + 35}, /* 10 */ {16UL, b32 + 9, 0, P_BE | P_ATTEST, b32 + 1, b32 + 4, b32 + 9, aliases + 35}, /* 10 */
{ 8UL, b32+ 10, 0, P_BE | P_ATTEST, 0, b32+189, 0, aliases+158}, /* 11 */ { 8UL, b32 + 10, 0, P_BE | P_ATTEST, 0, b32 + 189, 0, aliases + 158}, /* 11 */
{ 8UL, b32+ 10, 0, P_BE | P_ACADEM, b32+ 75, b32+126, b32+134, aliases+147}, /* 12 */ { 8UL, b32 + 10, 0, P_BE | P_ACADEM, b32 + 75, b32 + 126, b32 + 134, aliases + 147}, /* 12 */
{ 8UL, b32+ 10, b32+201, P_LE | P_ACADEM, 0, b32+165, 0, aliases+156}, /* 13 */ { 8UL, b32 + 10, b32 + 201, P_LE | P_ACADEM, 0, b32 + 165, 0, aliases + 156}, /* 13 */
{16UL, b32+ 11, b32+205, P_LE | P_ATTEST, 0, b32+124, 0, aliases+ 58}, /* 14 */ {16UL, b32 + 11, b32 + 205, P_LE | P_ATTEST, 0, b32 + 124, 0, aliases + 58}, /* 14 */
{31UL, b32+ 12, b32+208, P_BE | P_CONFIR, b32+208, b32+ 26, b32+121, aliases+ 88}, /* 15 */ {31UL, b32 + 12, b32 + 208, P_BE | P_CONFIR, b32 + 208, b32 + 26, b32 + 121, aliases + 88}, /* 15 */
{ 6UL, b32 + 14, 0, P_LE | P_ACADEM, 0, b32 + 25, 0, aliases + 124}, /* 16 */ { 6UL, b32 + 14, 0, P_LE | P_ACADEM, 0, b32 + 25, 0, aliases + 124}, /* 16 */
{82UL, b82, 0, P_LE | P_ATTEST, 0, b82a, 0, aliases+161}, /* 17 */ {82UL, b82, 0, P_LE | P_ATTEST, 0, b82a, 0, aliases + 161}, /* 17 */
{16UL, b32 + 18, 0, P_BE | P_ATTEST, 0, b32 + 53, 0, aliases + 73}, /* 18 */ {16UL, b32 + 18, 0, P_BE | P_ATTEST, 0, b32 + 53, 0, aliases + 73}, /* 18 */
{16UL, b32+ 18, 0, P_BE | P_ACADEM, b32+205, b32+164, b32+ 29, aliases+ 42}, /* 19 */ {16UL, b32 + 18, 0, P_BE | P_ACADEM, b32 + 205, b32 + 164, b32 + 29, aliases + 42}, /* 19 */
{16UL, b32 + 18, 0, P_LE | P_ATTEST, 0, b32 + 38, 0, aliases + 50}, /* 20 */ {16UL, b32 + 18, 0, P_LE | P_ATTEST, 0, b32 + 38, 0, aliases + 50}, /* 20 */
{16UL, b32+ 18, b32+ 29, P_BE | P_ATTEST, 0, b32+180, 0, aliases+ 63}, /* 21 */ {16UL, b32 + 18, b32 + 29, P_BE | P_ATTEST, 0, b32 + 180, 0, aliases + 63}, /* 21 */
{16UL, b32 + 18, b32 + 108, P_LE | P_ATTEST, 0, b32 + 43, 0, aliases + 66}, /* 22 */ {16UL, b32 + 18, b32 + 108, P_LE | P_ATTEST, 0, b32 + 43, 0, aliases + 66}, /* 22 */
{16UL, b32+ 18, b32+138, P_LE | P_THIRDP, 0, b32+ 83, 0, aliases+ 62}, /* 23 */ {16UL, b32 + 18, b32 + 138, P_LE | P_THIRDP, 0, b32 + 83, 0, aliases + 62}, /* 23 */
{16UL, b32+ 18, b32+157, P_LE | P_ATTEST, 0, b32+150, 0, aliases+ 48}, /* 24 */ {16UL, b32 + 18, b32 + 157, P_LE | P_ATTEST, 0, b32 + 150, 0, aliases + 48}, /* 24 */
{16UL, b32+ 18, b32+205, P_BE | P_ATTEST, 0, b32+ 47, 0, aliases+ 44}, /* 25 */ {16UL, b32 + 18, b32 + 205, P_BE | P_ATTEST, 0, b32 + 47, 0, aliases + 44}, /* 25 */
{16UL, b32+ 18, b32+205, P_BE | P_ATTEST, b32+205, b32+172, b32+ 29, aliases+ 41}, /* 26 */ {16UL, b32 + 18, b32 + 205, P_BE | P_ATTEST, b32 + 205, b32 + 172, b32 + 29, aliases + 41}, /* 26 */
{16UL, b32+ 18, b32+205, P_LE | P_ATTEST, 0, b32+ 88, 0, aliases+ 56}, /* 27 */ {16UL, b32 + 18, b32 + 205, P_LE | P_ATTEST, 0, b32 + 88, 0, aliases + 56}, /* 27 */
{16UL, b32+ 18, b32+205, P_LE | P_ATTEST, b32+205, b32+114, b32+187, aliases+ 45}, /* 28 */ {16UL, b32 + 18, b32 + 205, P_LE | P_ATTEST, b32 + 205, b32 + 114, b32 + 187, aliases + 45}, /* 28 */
{ 7UL, b32+ 19, 0, P_BE | P_ACADEM, 0, b32+183, 0, aliases+134}, /* 29 */ { 7UL, b32 + 19, 0, P_BE | P_ACADEM, 0, b32 + 183, 0, aliases + 134}, /* 29 */
{ 6UL, b32+ 27, b32+195, P_BE | P_ACADEM, 0, b32+185, 0, aliases+122}, /* 30 */ { 6UL, b32 + 27, b32 + 195, P_BE | P_ACADEM, 0, b32 + 185, 0, aliases + 122}, /* 30 */
{ 8UL, b32 + 28, 0, P_BE | P_ACADEM, 0, b32 + 57, 0, aliases + 145}, /* 31 */ { 8UL, b32 + 28, 0, P_BE | P_ACADEM, 0, b32 + 57, 0, aliases + 145}, /* 31 */
{ 8UL, b32+ 28, b32+158, P_BE | P_ATTEST, 0, b32+118, 0, aliases+153}, /* 32 */ { 8UL, b32 + 28, b32 + 158, P_BE | P_ATTEST, 0, b32 + 118, 0, aliases + 153}, /* 32 */
{ 8UL, b32+ 28, b32+197, P_BE | P_ATTEST, 0, b32+ 95, 0, aliases+148}, /* 33 */ { 8UL, b32 + 28, b32 + 197, P_BE | P_ATTEST, 0, b32 + 95, 0, aliases + 148}, /* 33 */
{ 8UL, b32+ 28, b32+201, P_BE | P_ATTEST, b32+201, b32+ 70, b32+156, aliases+157}, /* 34 */ { 8UL, b32 + 28, b32 + 201, P_BE | P_ATTEST, b32 + 201, b32 + 70, b32 + 156, aliases + 157}, /* 34 */
{ 8UL, b32+ 28, b32+201, P_LE | P_ATTEST, 0, b32+116, 0, aliases+159}, /* 35 */ { 8UL, b32 + 28, b32 + 201, P_LE | P_ATTEST, 0, b32 + 116, 0, aliases + 159}, /* 35 */
{16UL, b32+ 30, b32+205, P_BE | P_ATTEST, b32+205, b32+131, b32+179, aliases+ 61}, /* 36 */ {16UL, b32 + 30, b32 + 205, P_BE | P_ATTEST, b32 + 205, b32 + 131, b32 + 179, aliases + 61}, /* 36 */
{32UL, b32+ 31, b32+209, P_LE | P_ATTEST, b32+209, b32+178, b32+145, aliases+101}, /* 37 */ {32UL, b32 + 31, b32 + 209, P_LE | P_ATTEST, b32 + 209, b32 + 178, b32 + 145, aliases + 101}, /* 37 */
{14UL, b32+ 35, 0, P_LE | P_ATTEST, 0, b32+ 36, 0, aliases+ 17}, /* 38 */ {14UL, b32 + 35, 0, P_LE | P_ATTEST, 0, b32 + 36, 0, aliases + 17}, /* 38 */
{ 5UL, b32+ 46, b32+194, P_LE | P_THIRDP, b32+194, b32+160, b32+ 49, aliases+120}, /* 39 */ { 5UL, b32 + 46, b32 + 194, P_LE | P_THIRDP, b32 + 194, b32 + 160, b32 + 49, aliases + 120}, /* 39 */
{ 8UL, b32+ 48, 0, P_BE | P_ATTEST, 0, b32+ 61, 0, aliases+155}, /* 40 */ { 8UL, b32 + 48, 0, P_BE | P_ATTEST, 0, b32 + 61, 0, aliases + 155}, /* 40 */
{ 8UL, b32+ 48, b32+201, P_BE | P_ATTEST, b32+201, b32+176, b32+ 63, aliases+139}, /* 41 */ { 8UL, b32 + 48, b32 + 201, P_BE | P_ATTEST, b32 + 201, b32 + 176, b32 + 63, aliases + 139}, /* 41 */
{ 4UL, b32+ 49, 0, P_LE | P_ACADEM, 0, b32+ 89, 0, aliases+112}, /* 42 */ { 4UL, b32 + 49, 0, P_LE | P_ACADEM, 0, b32 + 89, 0, aliases + 112}, /* 42 */
{ 4UL, b32+ 49, b32+186, P_BE | P_ACADEM, b32+186, b32+136, b32+ 33, aliases+113}, /* 43 */ { 4UL, b32 + 49, b32 + 186, P_BE | P_ACADEM, b32 + 186, b32 + 136, b32 + 33, aliases + 113}, /* 43 */
{ 8UL, b32+ 51, 0, P_LE | P_ATTEST, 0, b32+126, 0, aliases+152}, /* 44 */ { 8UL, b32 + 51, 0, P_LE | P_ATTEST, 0, b32 + 126, 0, aliases + 152}, /* 44 */
{ 8UL, b32+ 51, b32+201, P_BE | P_ATTEST, 0, b32+193, 0, aliases+154}, /* 45 */ { 8UL, b32 + 51, b32 + 201, P_BE | P_ATTEST, 0, b32 + 193, 0, aliases + 154}, /* 45 */
{24UL, b32+ 54, b32+206, P_BE | P_ACADEM, b32+206, b32+143, b32+ 21, aliases+ 80}, /* 46 */ {24UL, b32 + 54, b32 + 206, P_BE | P_ACADEM, b32 + 206, b32 + 143, b32 + 21, aliases + 80}, /* 46 */
{ 8UL, b32+ 59, 0, P_LE | P_ATTEST, 0, b32+ 22, 0, aliases+142}, /* 47 */ { 8UL, b32 + 59, 0, P_LE | P_ATTEST, 0, b32 + 22, 0, aliases + 142}, /* 47 */
{16UL, b32+ 60, 0, P_BE | P_CONFIR, b32+205, b32+154, b32+127, aliases+ 38}, /* 48 */ {16UL, b32 + 60, 0, P_BE | P_CONFIR, b32 + 205, b32 + 154, b32 + 127, aliases + 38}, /* 48 */
{16UL, b32+ 60, 0, P_LE | P_CONFIR, b32+205, b32+184, b32+ 86, aliases+ 37}, /* 49 */ {16UL, b32 + 60, 0, P_LE | P_CONFIR, b32 + 205, b32 + 184, b32 + 86, aliases + 37}, /* 49 */
{64UL, b64d, 0, P_BE | P_ACADEM, 0, b64e, 0, aliases+128}, /* 50 */ {64UL, b64d, 0, P_BE | P_ACADEM, 0, b64e, 0, aliases + 128}, /* 50 */
{64UL, b64d, b64a, P_BE | P_CONFIR, b64a, b64f, b64g, aliases+131}, /* 51 */ {64UL, b64d, b64a, P_BE | P_CONFIR, b64a, b64f, b64g, aliases + 131}, /* 51 */
{64UL, b64d, b64a, P_LE | P_ATTEST, b64a, b64h, b64i, aliases+132}, /* 52 */ {64UL, b64d, b64a, P_LE | P_ATTEST, b64a, b64h, b64i, aliases + 132}, /* 52 */
{ 5UL, b32+ 66, b32+ 66, P_BE | P_ATTEST, 0, 0, 0, aliases+117}, /* 53 */ { 5UL, b32 + 66, b32 + 66, P_BE | P_ATTEST, 0, 0, 0, aliases + 117}, /* 53 */
{ 8UL, b32+ 67, 0, P_BE | P_ACADEM, b32+201, b32+115, b32+ 74, aliases+146}, /* 54 */ { 8UL, b32 + 67, 0, P_BE | P_ACADEM, b32 + 201, b32 + 115, b32 + 74, aliases + 146}, /* 54 */
{16UL, b32+ 77, 0, P_BE | P_ATTEST, 0, b32+ 78, 0, aliases+ 59}, /* 55 */ {16UL, b32 + 77, 0, P_BE | P_ATTEST, 0, b32 + 78, 0, aliases + 59}, /* 55 */
{10UL, b32+ 79, 0, P_BE | P_ACADEM, b32+202, b32+ 68, b32+ 52, aliases+ 6}, /* 56 */ {10UL, b32 + 79, 0, P_BE | P_ACADEM, b32 + 202, b32 + 68, b32 + 52, aliases + 6}, /* 56 */
{24UL, b32+ 80, b32+133, P_BE | P_ATTEST, 0, b32+ 32, 0, aliases+ 79}, /* 57 */ {24UL, b32 + 80, b32 + 133, P_BE | P_ATTEST, 0, b32 + 32, 0, aliases + 79}, /* 57 */
{24UL, b32+ 80, b32+199, P_BE | P_ATTEST, 0, b32+ 94, 0, aliases+ 78}, /* 58 */ {24UL, b32 + 80, b32 + 199, P_BE | P_ATTEST, 0, b32 + 94, 0, aliases + 78}, /* 58 */
{ 3UL, b32+ 81, 0, P_BE | P_ACADEM, b32+177, b32+ 96, b32+ 62, aliases+ 85}, /* 59 */ { 3UL, b32 + 81, 0, P_BE | P_ACADEM, b32 + 177, b32 + 96, b32 + 62, aliases + 85}, /* 59 */
{ 3UL, b32+ 81, b32+177, P_LE | P_ACADEM, 0, b32+151, 0, aliases+ 86}, /* 60 */ { 3UL, b32 + 81, b32 + 177, P_LE | P_ACADEM, 0, b32 + 151, 0, aliases + 86}, /* 60 */
{11UL, b32+ 82, 0, P_BE | P_ACADEM, 0, b32+ 15, 0, aliases+ 10}, /* 61 */ {11UL, b32 + 82, 0, P_BE | P_ACADEM, 0, b32 + 15, 0, aliases + 10}, /* 61 */
{ 6UL, b32+ 84, 0, P_LE | P_ATTEST, 0, b32+117, 0, aliases+123}, /* 62 */ { 6UL, b32 + 84, 0, P_LE | P_ATTEST, 0, b32 + 117, 0, aliases + 123}, /* 62 */
{16UL, b32+ 87, 0, P_BE | P_THIRDP, 0, b32+149, 0, aliases+ 52}, /* 63 */ {16UL, b32 + 87, 0, P_BE | P_THIRDP, 0, b32 + 149, 0, aliases + 52}, /* 63 */
{11UL, b32+ 90, b32+ 6, P_BE | P_ATTEST, 0, b32+141, 0, aliases+ 9}, /* 64 */ {11UL, b32 + 90, b32 + 6, P_BE | P_ATTEST, 0, b32 + 141, 0, aliases + 9}, /* 64 */
{16UL, b32+ 91, 0, P_BE | P_ATTEST, 0, b32+ 37, 0, aliases+ 60}, /* 65 */ {16UL, b32 + 91, 0, P_BE | P_ATTEST, 0, b32 + 37, 0, aliases + 60}, /* 65 */
{24UL, b32+ 97, 0, P_BE | P_ACADEM, 0, b32+ 40, 0, aliases+ 82}, /* 66 */ {24UL, b32 + 97, 0, P_BE | P_ACADEM, 0, b32 + 40, 0, aliases + 82}, /* 66 */
{24UL, b32+ 97, b32+206, P_BE | P_ATTEST, b32+206, b32+ 34, b32+100, aliases+ 84}, /* 67 */ {24UL, b32 + 97, b32 + 206, P_BE | P_ATTEST, b32 + 206, b32 + 34, b32 + 100, aliases + 84}, /* 67 */
{16UL, b32+ 98, 0, P_BE | P_ATTEST, 0, b32+200, 0, aliases+ 67}, /* 68 */ {16UL, b32 + 98, 0, P_BE | P_ATTEST, 0, b32 + 200, 0, aliases + 67}, /* 68 */
{16UL, b32+ 98, 0, P_LE | P_CONFIR, 0, b32+146, 0, aliases+ 24}, /* 69 */ {16UL, b32 + 98, 0, P_LE | P_CONFIR, 0, b32 + 146, 0, aliases + 24}, /* 69 */
{16UL, b32+ 98, 0, P_LE | P_ATTEST, b32+205, b32+ 64, b32+137, aliases+ 55}, /* 70 */ {16UL, b32 + 98, 0, P_LE | P_ATTEST, b32 + 205, b32 + 64, b32 + 137, aliases + 55}, /* 70 */
{16UL, b32+ 98, b32+ 99, P_BE | P_ATTEST, 0, b32+123, 0, aliases+ 34}, /* 71 */ {16UL, b32 + 98, b32 + 99, P_BE | P_ATTEST, 0, b32 + 123, 0, aliases + 34}, /* 71 */
{16UL, b32+ 98, b32+205, P_BE | P_THIRDP, 0, b32+135, 0, aliases+ 32}, /* 72 */ {16UL, b32 + 98, b32 + 205, P_BE | P_THIRDP, 0, b32 + 135, 0, aliases + 32}, /* 72 */
{16UL, b32+ 98, b32+205, P_LE | P_ATTEST, 0, b32+ 71, 0, aliases+ 57}, /* 73 */ {16UL, b32 + 98, b32 + 205, P_LE | P_ATTEST, 0, b32 + 71, 0, aliases + 57}, /* 73 */
{16UL, b32+ 98, b32+205, P_LE | P_THIRDP, b32+205, b32+142, b32+137, aliases+ 68}, /* 74 */ {16UL, b32 + 98, b32 + 205, P_LE | P_THIRDP, b32 + 205, b32 + 142, b32 + 137, aliases + 68}, /* 74 */
{14UL, b32+101, 0, P_BE | P_ACADEM, b32+204, b32+155, b32+ 16, aliases+ 18}, /* 75 */ {14UL, b32 + 101, 0, P_BE | P_ACADEM, b32 + 204, b32 + 155, b32 + 16, aliases + 18}, /* 75 */
{30UL, b32+102, b32+207, P_BE | P_ACADEM, b32+207, b32+ 20, b32+169, aliases+ 87}, /* 76 */ {30UL, b32 + 102, b32 + 207, P_BE | P_ACADEM, b32 + 207, b32 + 20, b32 + 169, aliases + 87}, /* 76 */
{12UL, b32+103, 0, P_BE | P_ACADEM, 0, b32+191, 0, aliases+ 13}, /* 77 */ {12UL, b32 + 103, 0, P_BE | P_ACADEM, 0, b32 + 191, 0, aliases + 13}, /* 77 */
{12UL, b32+103, 0, P_BELE | P_ACADEM, 0, b32+174, 0, aliases+ 15}, /* 78 */ {12UL, b32 + 103, 0, P_BELE | P_ACADEM, 0, b32 + 174, 0, aliases + 15}, /* 78 */
{32UL, b32+104, 0, P_BE | P_ATTEST, 0, b32+ 50, 0, aliases+ 92}, /* 79 */ {32UL, b32 + 104, 0, P_BE | P_ATTEST, 0, b32 + 50, 0, aliases + 92}, /* 79 */
{21UL, b32+105, 0, P_BE | P_ACADEM, 0, b32+ 93, 0, aliases+ 75}, /* 80 */ {21UL, b32 + 105, 0, P_BE | P_ACADEM, 0, b32 + 93, 0, aliases + 75}, /* 80 */
{24UL, b32+106, 0, P_BE | P_ACADEM, 0, b32+163, 0, aliases+ 81}, /* 81 */ {24UL, b32 + 106, 0, P_BE | P_ACADEM, 0, b32 + 163, 0, aliases + 81}, /* 81 */
{24UL, b32+106, b32+144, P_BE | P_ATTEST, 0, b32+ 39, 0, aliases+ 83}, /* 82 */ {24UL, b32 + 106, b32 + 144, P_BE | P_ATTEST, 0, b32 + 39, 0, aliases + 83}, /* 82 */
{ 7UL, b32+109, 0, P_BE | P_ACADEM, 0, b32+152, 0, aliases+136}, /* 83 */ { 7UL, b32 + 109, 0, P_BE | P_ACADEM, 0, b32 + 152, 0, aliases + 136}, /* 83 */
{15UL, b32+110, 0, P_BE | P_ACADEM, 0, b32+ 13, 0, aliases+ 20}, /* 84 */ {15UL, b32 + 110, 0, P_BE | P_ACADEM, 0, b32 + 13, 0, aliases + 20}, /* 84 */
{16UL, b32+111, 0, P_BE | P_ATTEST, 0, b32+167, 0, aliases+ 64}, /* 85 */ {16UL, b32 + 111, 0, P_BE | P_ATTEST, 0, b32 + 167, 0, aliases + 64}, /* 85 */
{10UL, b32+112, 0, P_BE | P_ATTEST, 0, b32+ 85, 0, aliases+ 4}, /* 86 */ {10UL, b32 + 112, 0, P_BE | P_ATTEST, 0, b32 + 85, 0, aliases + 4}, /* 86 */
{ 8UL, b32+119, 0, P_BE | P_ACADEM, 0, b32+183, 0, aliases+150}, /* 87 */ { 8UL, b32 + 119, 0, P_BE | P_ACADEM, 0, b32 + 183, 0, aliases + 150}, /* 87 */
{ 8UL, b32+119, 0, P_LE | P_THIRDP, 0, b32+ 41, 0, aliases+160}, /* 88 */ { 8UL, b32 + 119, 0, P_LE | P_THIRDP, 0, b32 + 41, 0, aliases + 160}, /* 88 */
{ 8UL, b32+119, b32+201, P_BE | P_ACADEM, 0, b32+173, 0, aliases+141}, /* 89 */ { 8UL, b32 + 119, b32 + 201, P_BE | P_ACADEM, 0, b32 + 173, 0, aliases + 141}, /* 89 */
{ 6UL, b32+120, b32+195, P_BE | P_ATTEST, 0, b32+ 55, 0, aliases+121}, /* 90 */ { 6UL, b32 + 120, b32 + 195, P_BE | P_ATTEST, 0, b32 + 55, 0, aliases + 121}, /* 90 */
{ 7UL, b32+122, b32+198, P_LE | P_ACADEM, 0, b32+128, 0, aliases+135}, /* 91 */ { 7UL, b32 + 122, b32 + 198, P_LE | P_ACADEM, 0, b32 + 128, 0, aliases + 135}, /* 91 */
{16UL, b32+125, 0, P_BE | P_CONFIR, 0, b32+ 17, 0, aliases+ 65}, /* 92 */ {16UL, b32 + 125, 0, P_BE | P_CONFIR, 0, b32 + 17, 0, aliases + 65}, /* 92 */
{ 8UL, b32+129, 0, P_LE | P_ATTEST, 0, b32+ 42, 0, aliases+140}, /* 93 */ { 8UL, b32 + 129, 0, P_LE | P_ATTEST, 0, b32 + 42, 0, aliases + 140}, /* 93 */
{ 5UL, b32+130, 0, P_LE | P_ACADEM, 0, b32+ 58, 0, aliases+118}, /* 94 */ { 5UL, b32 + 130, 0, P_LE | P_ACADEM, 0, b32 + 58, 0, aliases + 118}, /* 94 */
{32UL, b32+132, b32+209, P_LE | P_CONFIR, b32+209, b32+107, b32+ 65, aliases+ 95}, /* 95 */ {32UL, b32 + 132, b32 + 209, P_LE | P_CONFIR, b32 + 209, b32 + 107, b32 + 65, aliases + 95}, /* 95 */
{17UL, b32+140, 0, P_BE | P_ACADEM, 0, b32+ 44, 0, aliases+ 74}, /* 96 */ {17UL, b32 + 140, 0, P_BE | P_ACADEM, 0, b32 + 44, 0, aliases + 74}, /* 96 */
{ 6UL, b32+147, 0, P_BE | P_ACADEM, b32+195, b32+ 72, b32+182, aliases+125}, /* 97 */ { 6UL, b32 + 147, 0, P_BE | P_ACADEM, b32 + 195, b32 + 72, b32 + 182, aliases + 125}, /* 97 */
{16UL, b32+161, b32+205, P_BE | P_ACADEM, 0, b32+ 73, 0, aliases+ 31}, /* 98 */ {16UL, b32 + 161, b32 + 205, P_BE | P_ACADEM, 0, b32 + 73, 0, aliases + 31}, /* 98 */
{15UL, b32+166, 0, P_BE | P_ATTEST, b32+ 2, b32+ 69, b32+166, aliases+ 21}, /* 99 */ {15UL, b32 + 166, 0, P_BE | P_ATTEST, b32 + 2, b32 + 69, b32 + 166, aliases + 21}, /* 99 */
{12UL, b32+168, 0, P_BE | P_ACADEM, b32+203, b32+139, b32+ 24, aliases+ 14}, /* 100 */ {12UL, b32 + 168, 0, P_BE | P_ACADEM, b32 + 203, b32 + 139, b32 + 24, aliases + 14}, /* 100 */
{ 8UL, b32+171, 0, P_BE | P_ACADEM, 0, b32+147, 0, aliases+143}, /* 101 */ { 8UL, b32 + 171, 0, P_BE | P_ACADEM, 0, b32 + 147, 0, aliases + 143}, /* 101 */
{13UL, b32+181, 0, P_BE | P_ATTEST, 0, b32+ 45, 0, aliases+ 16}, /* 102 */ {13UL, b32 + 181, 0, P_BE | P_ATTEST, 0, b32 + 45, 0, aliases + 16}, /* 102 */
{12UL, b32+188, b32+203, P_BE | P_ACADEM, 0, b32+170, 0, aliases+ 12}, /* 103 */ {12UL, b32 + 188, b32 + 203, P_BE | P_ACADEM, 0, b32 + 170, 0, aliases + 12}, /* 103 */
{32UL, b32+190, b32+209, P_LE | P_ATTEST, b32+209, b32+ 23, b32+113, aliases+ 93}, /* 104 */ {32UL, b32 + 190, b32 + 209, P_LE | P_ATTEST, b32 + 209, b32 + 23, b32 + 113, aliases + 93}, /* 104 */
{10UL, b32+192, b32+202, P_BE | P_ACADEM, 0, b32+112, 0, aliases+ 5}, /* 105 */ {10UL, b32 + 192, b32 + 202, P_BE | P_ACADEM, 0, b32 + 112, 0, aliases + 5}, /* 105 */
{ 0UL, 0, 0, P_BE | P_UNDFCL, 0, 0, 0, NULL }, /* terminating entry */ { 0UL, 0, 0, P_BE | P_UNDFCL, 0, 0, 0, NULL }, /* terminating entry */
}; };
# define NPRESETS 106 # define NPRESETS 106
/* List of names with pointers to models, pre-sorted for use with bsearch() */ /* List of names with pointers to models, pre-sorted for use with bsearch() */
static const struct malias aliases[] = { static const struct malias aliases[] = {
{"ARC", models+ 69}, /* 0 */ {"ARC", models + 69}, /* 0 */
{"B-CRC-32", models + 6}, /* 1 */ {"B-CRC-32", models + 6}, /* 1 */
{"CKSUM", models + 4}, /* 2 */ {"CKSUM", models + 4}, /* 2 */
{"CRC-10", models+ 86}, /* 3 */ {"CRC-10", models + 86}, /* 3 */
{"CRC-10/ATM", models+ 86}, /* 4 */ {"CRC-10/ATM", models + 86}, /* 4 */
{"CRC-10/CDMA2000", models+105}, /* 5 */ {"CRC-10/CDMA2000", models + 105}, /* 5 */
{"CRC-10/GSM", models+ 56}, /* 6 */ {"CRC-10/GSM", models + 56}, /* 6 */
{"CRC-10/I-610", models+ 86}, /* 7 */ {"CRC-10/I-610", models + 86}, /* 7 */
{"CRC-11", models+ 64}, /* 8 */ {"CRC-11", models + 64}, /* 8 */
{"CRC-11/FLEXRAY", models+ 64}, /* 9 */ {"CRC-11/FLEXRAY", models + 64}, /* 9 */
{"CRC-11/UMTS", models+ 61}, /* 10 */ {"CRC-11/UMTS", models + 61}, /* 10 */
{"CRC-12/3GPP", models+ 78}, /* 11 */ {"CRC-12/3GPP", models + 78}, /* 11 */
{"CRC-12/CDMA2000", models+103}, /* 12 */ {"CRC-12/CDMA2000", models + 103}, /* 12 */
{"CRC-12/DECT", models+ 77}, /* 13 */ {"CRC-12/DECT", models + 77}, /* 13 */
{"CRC-12/GSM", models+100}, /* 14 */ {"CRC-12/GSM", models + 100}, /* 14 */
{"CRC-12/UMTS", models+ 78}, /* 15 */ {"CRC-12/UMTS", models + 78}, /* 15 */
{"CRC-13/BBC", models+102}, /* 16 */ {"CRC-13/BBC", models + 102}, /* 16 */
{"CRC-14/DARC", models+ 38}, /* 17 */ {"CRC-14/DARC", models + 38}, /* 17 */
{"CRC-14/GSM", models+ 75}, /* 18 */ {"CRC-14/GSM", models + 75}, /* 18 */
{"CRC-15", models+ 84}, /* 19 */ {"CRC-15", models + 84}, /* 19 */
{"CRC-15/CAN", models+ 84}, /* 20 */ {"CRC-15/CAN", models + 84}, /* 20 */
{"CRC-15/MPT1327", models+ 99}, /* 21 */ {"CRC-15/MPT1327", models + 99}, /* 21 */
{"CRC-16", models+ 69}, /* 22 */ {"CRC-16", models + 69}, /* 22 */
{"CRC-16/ACORN", models + 18}, /* 23 */ {"CRC-16/ACORN", models + 18}, /* 23 */
{"CRC-16/ARC", models+ 69}, /* 24 */ {"CRC-16/ARC", models + 69}, /* 24 */
{"CRC-16/AUG-CCITT", models + 21}, /* 25 */ {"CRC-16/AUG-CCITT", models + 21}, /* 25 */
{"CRC-16/AUTOSAR", models + 25}, /* 26 */ {"CRC-16/AUTOSAR", models + 25}, /* 26 */
{"CRC-16/BUYPASS", models+ 68}, /* 27 */ {"CRC-16/BUYPASS", models + 68}, /* 27 */
{"CRC-16/CCITT", models + 20}, /* 28 */ {"CRC-16/CCITT", models + 20}, /* 28 */
{"CRC-16/CCITT-FALSE", models + 25}, /* 29 */ {"CRC-16/CCITT-FALSE", models + 25}, /* 29 */
{"CRC-16/CCITT-TRUE", models + 20}, /* 30 */ {"CRC-16/CCITT-TRUE", models + 20}, /* 30 */
{"CRC-16/CDMA2000", models+ 98}, /* 31 */ {"CRC-16/CDMA2000", models + 98}, /* 31 */
{"CRC-16/CMS", models+ 72}, /* 32 */ {"CRC-16/CMS", models + 72}, /* 32 */
{"CRC-16/DARC", models + 26}, /* 33 */ {"CRC-16/DARC", models + 26}, /* 33 */
{"CRC-16/DDS-110", models+ 71}, /* 34 */ {"CRC-16/DDS-110", models + 71}, /* 34 */
{"CRC-16/DECT-R", models + 10}, /* 35 */ {"CRC-16/DECT-R", models + 10}, /* 35 */
{"CRC-16/DECT-X", models + 9}, /* 36 */ {"CRC-16/DECT-X", models + 9}, /* 36 */
{"CRC-16/DNP", models+ 49}, /* 37 */ {"CRC-16/DNP", models + 49}, /* 37 */
{"CRC-16/EN-13757", models+ 48}, /* 38 */ {"CRC-16/EN-13757", models + 48}, /* 38 */
{"CRC-16/EPC", models + 26}, /* 39 */ {"CRC-16/EPC", models + 26}, /* 39 */
{"CRC-16/EPC-C1G2", models + 26}, /* 40 */ {"CRC-16/EPC-C1G2", models + 26}, /* 40 */
{"CRC-16/GENIBUS", models + 26}, /* 41 */ {"CRC-16/GENIBUS", models + 26}, /* 41 */
{"CRC-16/GSM", models + 19}, /* 42 */ {"CRC-16/GSM", models + 19}, /* 42 */
{"CRC-16/I-CODE", models + 26}, /* 43 */ {"CRC-16/I-CODE", models + 26}, /* 43 */
{"CRC-16/IBM-3740", models + 25}, /* 44 */ {"CRC-16/IBM-3740", models + 25}, /* 44 */
{"CRC-16/IBM-SDLC", models + 28}, /* 45 */ {"CRC-16/IBM-SDLC", models + 28}, /* 45 */
{"CRC-16/IEC-61158-2", models+ 36}, /* 46 */ {"CRC-16/IEC-61158-2", models + 36}, /* 46 */
{"CRC-16/ISO-HDLC", models + 28}, /* 47 */ {"CRC-16/ISO-HDLC", models + 28}, /* 47 */
{"CRC-16/ISO-IEC-14443-3-A", models + 24}, /* 48 */ {"CRC-16/ISO-IEC-14443-3-A", models + 24}, /* 48 */
{"CRC-16/ISO-IEC-14443-3-B", models + 28}, /* 49 */ {"CRC-16/ISO-IEC-14443-3-B", models + 28}, /* 49 */
{"CRC-16/KERMIT", models + 20}, /* 50 */ {"CRC-16/KERMIT", models + 20}, /* 50 */
{"CRC-16/LHA", models+ 69}, /* 51 */ {"CRC-16/LHA", models + 69}, /* 51 */
{"CRC-16/LJ1200", models+ 63}, /* 52 */ {"CRC-16/LJ1200", models + 63}, /* 52 */
{"CRC-16/LTE", models + 18}, /* 53 */ {"CRC-16/LTE", models + 18}, /* 53 */
{"CRC-16/MAXIM", models+ 70}, /* 54 */ {"CRC-16/MAXIM", models + 70}, /* 54 */
{"CRC-16/MAXIM-DOW", models+ 70}, /* 55 */ {"CRC-16/MAXIM-DOW", models + 70}, /* 55 */
{"CRC-16/MCRF4XX", models + 27}, /* 56 */ {"CRC-16/MCRF4XX", models + 27}, /* 56 */
{"CRC-16/MODBUS", models+ 73}, /* 57 */ {"CRC-16/MODBUS", models + 73}, /* 57 */
{"CRC-16/NRSC-5", models + 14}, /* 58 */ {"CRC-16/NRSC-5", models + 14}, /* 58 */
{"CRC-16/OPENSAFETY-A", models+ 55}, /* 59 */ {"CRC-16/OPENSAFETY-A", models + 55}, /* 59 */
{"CRC-16/OPENSAFETY-B", models+ 65}, /* 60 */ {"CRC-16/OPENSAFETY-B", models + 65}, /* 60 */
{"CRC-16/PROFIBUS", models+ 36}, /* 61 */ {"CRC-16/PROFIBUS", models + 36}, /* 61 */
{"CRC-16/RIELLO", models + 23}, /* 62 */ {"CRC-16/RIELLO", models + 23}, /* 62 */
{"CRC-16/SPI-FUJITSU", models + 21}, /* 63 */ {"CRC-16/SPI-FUJITSU", models + 21}, /* 63 */
{"CRC-16/T10-DIF", models+ 85}, /* 64 */ {"CRC-16/T10-DIF", models + 85}, /* 64 */
{"CRC-16/TELEDISK", models+ 92}, /* 65 */ {"CRC-16/TELEDISK", models + 92}, /* 65 */
{"CRC-16/TMS37157", models + 22}, /* 66 */ {"CRC-16/TMS37157", models + 22}, /* 66 */
{"CRC-16/UMTS", models+ 68}, /* 67 */ {"CRC-16/UMTS", models + 68}, /* 67 */
{"CRC-16/USB", models+ 74}, /* 68 */ {"CRC-16/USB", models + 74}, /* 68 */
{"CRC-16/V-41-LSB", models + 20}, /* 69 */ {"CRC-16/V-41-LSB", models + 20}, /* 69 */
{"CRC-16/V-41-MSB", models + 18}, /* 70 */ {"CRC-16/V-41-MSB", models + 18}, /* 70 */
{"CRC-16/VERIFONE", models+ 68}, /* 71 */ {"CRC-16/VERIFONE", models + 68}, /* 71 */
{"CRC-16/X-25", models + 28}, /* 72 */ {"CRC-16/X-25", models + 28}, /* 72 */
{"CRC-16/XMODEM", models + 18}, /* 73 */ {"CRC-16/XMODEM", models + 18}, /* 73 */
{"CRC-17/CAN-FD", models+ 96}, /* 74 */ {"CRC-17/CAN-FD", models + 96}, /* 74 */
{"CRC-21/CAN-FD", models+ 80}, /* 75 */ {"CRC-21/CAN-FD", models + 80}, /* 75 */
{"CRC-24", models+ 82}, /* 76 */ {"CRC-24", models + 82}, /* 76 */
{"CRC-24/BLE", models + 3}, /* 77 */ {"CRC-24/BLE", models + 3}, /* 77 */
{"CRC-24/FLEXRAY-A", models+ 58}, /* 78 */ {"CRC-24/FLEXRAY-A", models + 58}, /* 78 */
{"CRC-24/FLEXRAY-B", models+ 57}, /* 79 */ {"CRC-24/FLEXRAY-B", models + 57}, /* 79 */
{"CRC-24/INTERLAKEN", models+ 46}, /* 80 */ {"CRC-24/INTERLAKEN", models + 46}, /* 80 */
{"CRC-24/LTE-A", models+ 81}, /* 81 */ {"CRC-24/LTE-A", models + 81}, /* 81 */
{"CRC-24/LTE-B", models+ 66}, /* 82 */ {"CRC-24/LTE-B", models + 66}, /* 82 */
{"CRC-24/OPENPGP", models+ 82}, /* 83 */ {"CRC-24/OPENPGP", models + 82}, /* 83 */
{"CRC-24/OS-9", models+ 67}, /* 84 */ {"CRC-24/OS-9", models + 67}, /* 84 */
{"CRC-3/GSM", models+ 59}, /* 85 */ {"CRC-3/GSM", models + 59}, /* 85 */
{"CRC-3/ROHC", models+ 60}, /* 86 */ {"CRC-3/ROHC", models + 60}, /* 86 */
{"CRC-30/CDMA", models+ 76}, /* 87 */ {"CRC-30/CDMA", models + 76}, /* 87 */
{"CRC-31/PHILIPS", models + 15}, /* 88 */ {"CRC-31/PHILIPS", models + 15}, /* 88 */
{"CRC-32", models + 8}, /* 89 */ {"CRC-32", models + 8}, /* 89 */
{"CRC-32/AAL5", models + 6}, /* 90 */ {"CRC-32/AAL5", models + 6}, /* 90 */
{"CRC-32/ADCCP", models + 8}, /* 91 */ {"CRC-32/ADCCP", models + 8}, /* 91 */
{"CRC-32/AIXM", models+ 79}, /* 92 */ {"CRC-32/AIXM", models + 79}, /* 92 */
{"CRC-32/AUTOSAR", models+104}, /* 93 */ {"CRC-32/AUTOSAR", models + 104}, /* 93 */
{"CRC-32/BASE91-C", models+ 37}, /* 94 */ {"CRC-32/BASE91-C", models + 37}, /* 94 */
{"CRC-32/BASE91-D", models+ 95}, /* 95 */ {"CRC-32/BASE91-D", models + 95}, /* 95 */
{"CRC-32/BZIP2", models + 6}, /* 96 */ {"CRC-32/BZIP2", models + 6}, /* 96 */
{"CRC-32/CASTAGNOLI", models+ 37}, /* 97 */ {"CRC-32/CASTAGNOLI", models + 37}, /* 97 */
{"CRC-32/CKSUM", models + 4}, /* 98 */ {"CRC-32/CKSUM", models + 4}, /* 98 */
{"CRC-32/DECT-B", models + 6}, /* 99 */ {"CRC-32/DECT-B", models + 6}, /* 99 */
{"CRC-32/INTERLAKEN", models+ 37}, /* 100 */ {"CRC-32/INTERLAKEN", models + 37}, /* 100 */
{"CRC-32/ISCSI", models+ 37}, /* 101 */ {"CRC-32/ISCSI", models + 37}, /* 101 */
{"CRC-32/ISO-HDLC", models + 8}, /* 102 */ {"CRC-32/ISO-HDLC", models + 8}, /* 102 */
{"CRC-32/JAMCRC", models + 7}, /* 103 */ {"CRC-32/JAMCRC", models + 7}, /* 103 */
{"CRC-32/MPEG-2", models + 5}, /* 104 */ {"CRC-32/MPEG-2", models + 5}, /* 104 */
{"CRC-32/POSIX", models + 4}, /* 105 */ {"CRC-32/POSIX", models + 4}, /* 105 */
{"CRC-32/V-42", models + 8}, /* 106 */ {"CRC-32/V-42", models + 8}, /* 106 */
{"CRC-32/XFER", models + 1}, /* 107 */ {"CRC-32/XFER", models + 1}, /* 107 */
{"CRC-32/XZ", models + 8}, /* 108 */ {"CRC-32/XZ", models + 8}, /* 108 */
{"CRC-32C", models+ 37}, /* 109 */ {"CRC-32C", models + 37}, /* 109 */
{"CRC-32D", models+ 95}, /* 110 */ {"CRC-32D", models + 95}, /* 110 */
{"CRC-32Q", models+ 79}, /* 111 */ {"CRC-32Q", models + 79}, /* 111 */
{"CRC-4/G-704", models+ 42}, /* 112 */ {"CRC-4/G-704", models + 42}, /* 112 */
{"CRC-4/INTERLAKEN", models+ 43}, /* 113 */ {"CRC-4/INTERLAKEN", models + 43}, /* 113 */
{"CRC-4/ITU", models+ 42}, /* 114 */ {"CRC-4/ITU", models + 42}, /* 114 */
{"CRC-40/GSM", models + 2}, /* 115 */ {"CRC-40/GSM", models + 2}, /* 115 */
{"CRC-5/EPC", models+ 53}, /* 116 */ {"CRC-5/EPC", models + 53}, /* 116 */
{"CRC-5/EPC-C1G2", models+ 53}, /* 117 */ {"CRC-5/EPC-C1G2", models + 53}, /* 117 */
{"CRC-5/G-704", models+ 94}, /* 118 */ {"CRC-5/G-704", models + 94}, /* 118 */
{"CRC-5/ITU", models+ 94}, /* 119 */ {"CRC-5/ITU", models + 94}, /* 119 */
{"CRC-5/USB", models+ 39}, /* 120 */ {"CRC-5/USB", models + 39}, /* 120 */
{"CRC-6/CDMA2000-A", models+ 90}, /* 121 */ {"CRC-6/CDMA2000-A", models + 90}, /* 121 */
{"CRC-6/CDMA2000-B", models + 30}, /* 122 */ {"CRC-6/CDMA2000-B", models + 30}, /* 122 */
{"CRC-6/DARC", models+ 62}, /* 123 */ {"CRC-6/DARC", models + 62}, /* 123 */
{"CRC-6/G-704", models + 16}, /* 124 */ {"CRC-6/G-704", models + 16}, /* 124 */
{"CRC-6/GSM", models+ 97}, /* 125 */ {"CRC-6/GSM", models + 97}, /* 125 */
{"CRC-6/ITU", models + 16}, /* 126 */ {"CRC-6/ITU", models + 16}, /* 126 */
{"CRC-64", models+ 50}, /* 127 */ {"CRC-64", models + 50}, /* 127 */
{"CRC-64/ECMA-182", models+ 50}, /* 128 */ {"CRC-64/ECMA-182", models + 50}, /* 128 */
{"CRC-64/GO-ECMA", models+ 52}, /* 129 */ {"CRC-64/GO-ECMA", models + 52}, /* 129 */
{"CRC-64/GO-ISO", models + 0}, /* 130 */ {"CRC-64/GO-ISO", models + 0}, /* 130 */
{"CRC-64/WE", models+ 51}, /* 131 */ {"CRC-64/WE", models + 51}, /* 131 */
{"CRC-64/XZ", models+ 52}, /* 132 */ {"CRC-64/XZ", models + 52}, /* 132 */
{"CRC-7", models + 29}, /* 133 */ {"CRC-7", models + 29}, /* 133 */
{"CRC-7/MMC", models + 29}, /* 134 */ {"CRC-7/MMC", models + 29}, /* 134 */
{"CRC-7/ROHC", models+ 91}, /* 135 */ {"CRC-7/ROHC", models + 91}, /* 135 */
{"CRC-7/UMTS", models+ 83}, /* 136 */ {"CRC-7/UMTS", models + 83}, /* 136 */
{"CRC-8", models + 11}, /* 137 */ {"CRC-8", models + 11}, /* 137 */
{"CRC-8/AES", models+ 35}, /* 138 */ {"CRC-8/AES", models + 35}, /* 138 */
{"CRC-8/AUTOSAR", models+ 41}, /* 139 */ {"CRC-8/AUTOSAR", models + 41}, /* 139 */
{"CRC-8/BLUETOOTH", models+ 93}, /* 140 */ {"CRC-8/BLUETOOTH", models + 93}, /* 140 */
{"CRC-8/CDMA2000", models+ 89}, /* 141 */ {"CRC-8/CDMA2000", models + 89}, /* 141 */
{"CRC-8/DARC", models+ 47}, /* 142 */ {"CRC-8/DARC", models + 47}, /* 142 */
{"CRC-8/DVB-S2", models+101}, /* 143 */ {"CRC-8/DVB-S2", models + 101}, /* 143 */
{"CRC-8/EBU", models+ 35}, /* 144 */ {"CRC-8/EBU", models + 35}, /* 144 */
{"CRC-8/GSM-A", models + 31}, /* 145 */ {"CRC-8/GSM-A", models + 31}, /* 145 */
{"CRC-8/GSM-B", models+ 54}, /* 146 */ {"CRC-8/GSM-B", models + 54}, /* 146 */
{"CRC-8/I-432-1", models + 12}, /* 147 */ {"CRC-8/I-432-1", models + 12}, /* 147 */
{"CRC-8/I-CODE", models+ 33}, /* 148 */ {"CRC-8/I-CODE", models + 33}, /* 148 */
{"CRC-8/ITU", models + 12}, /* 149 */ {"CRC-8/ITU", models + 12}, /* 149 */
{"CRC-8/LTE", models+ 87}, /* 150 */ {"CRC-8/LTE", models + 87}, /* 150 */
{"CRC-8/MAXIM", models+ 44}, /* 151 */ {"CRC-8/MAXIM", models + 44}, /* 151 */
{"CRC-8/MAXIM-DOW", models+ 44}, /* 152 */ {"CRC-8/MAXIM-DOW", models + 44}, /* 152 */
{"CRC-8/MIFARE-MAD", models+ 32}, /* 153 */ {"CRC-8/MIFARE-MAD", models + 32}, /* 153 */
{"CRC-8/NRSC-5", models+ 45}, /* 154 */ {"CRC-8/NRSC-5", models + 45}, /* 154 */
{"CRC-8/OPENSAFETY", models+ 40}, /* 155 */ {"CRC-8/OPENSAFETY", models + 40}, /* 155 */
{"CRC-8/ROHC", models+ 13}, /* 156 */ {"CRC-8/ROHC", models + 13}, /* 156 */
{"CRC-8/SAE-J1850", models+ 34}, /* 157 */ {"CRC-8/SAE-J1850", models + 34}, /* 157 */
{"CRC-8/SMBUS", models+ 11}, /* 158 */ {"CRC-8/SMBUS", models + 11}, /* 158 */
{"CRC-8/TECH-3250", models+ 35}, /* 159 */ {"CRC-8/TECH-3250", models + 35}, /* 159 */
{"CRC-8/WCDMA", models+ 88}, /* 160 */ {"CRC-8/WCDMA", models + 88}, /* 160 */
{"CRC-82/DARC", models+ 17}, /* 161 */ {"CRC-82/DARC", models + 17}, /* 161 */
{"CRC-A", models+ 24}, /* 162 */ {"CRC-A", models + 24}, /* 162 */
{"CRC-B", models+ 28}, /* 163 */ {"CRC-B", models + 28}, /* 163 */
{"CRC-CCITT", models+ 20}, /* 164 */ {"CRC-CCITT", models + 20}, /* 164 */
{"CRC-IBM", models+ 69}, /* 165 */ {"CRC-IBM", models + 69}, /* 165 */
{"DOW-CRC", models+ 44}, /* 166 */ {"DOW-CRC", models + 44}, /* 166 */
{"JAMCRC", models+ 7}, /* 167 */ {"JAMCRC", models + 7}, /* 167 */
{"KERMIT", models+ 20}, /* 168 */ {"KERMIT", models + 20}, /* 168 */
{"MODBUS", models+ 73}, /* 169 */ {"MODBUS", models + 73}, /* 169 */
{"PKZIP", models+ 8}, /* 170 */ {"PKZIP", models + 8}, /* 170 */
{"R-CRC-16", models+ 10}, /* 171 */ {"R-CRC-16", models + 10}, /* 171 */
{"X-25", models+ 28}, /* 172 */ {"X-25", models + 28}, /* 172 */
{"X-CRC-12", models+ 77}, /* 173 */ {"X-CRC-12", models + 77}, /* 173 */
{"X-CRC-16", models+ 9}, /* 174 */ {"X-CRC-16", models + 9}, /* 174 */
{"XFER", models+ 1}, /* 175 */ {"XFER", models + 1}, /* 175 */
{"XMODEM", models+ 18}, /* 176 */ {"XMODEM", models + 18}, /* 176 */
{"ZMODEM", models+ 18}, /* 177 */ {"ZMODEM", models + 18}, /* 177 */
{NULL, NULL }, /* terminating entry */ {NULL, NULL}, /* terminating entry */
}; };
# define NALIASES 178 # define NALIASES 178

View file

@ -69,12 +69,12 @@ static int l_GetFromBigBuf(lua_State *L) {
startindex = luaL_checknumber(L, 1); startindex = luaL_checknumber(L, 1);
len = luaL_checknumber(L, 2); len = luaL_checknumber(L, 2);
} }
if ( len == 0 ) { if (len == 0) {
//signal error by returning Nil, errorstring //signal error by returning Nil, errorstring
lua_pushnil(L); lua_pushnil(L);
lua_pushstring(L, "You need to supply number of bytes larger than zero"); lua_pushstring(L, "You need to supply number of bytes larger than zero");
return 2; // two return values return 2; // two return values
} }
uint8_t *data = calloc(len, sizeof(uint8_t)); uint8_t *data = calloc(len, sizeof(uint8_t));
@ -125,13 +125,13 @@ static int l_GetFromFlashMem(lua_State *L) {
startindex = luaL_checknumber(L, 1); startindex = luaL_checknumber(L, 1);
len = luaL_checknumber(L, 2); len = luaL_checknumber(L, 2);
} }
if ( len == 0 ) { if (len == 0) {
//signal error by returning Nil, errorstring //signal error by returning Nil, errorstring
lua_pushnil(L); lua_pushnil(L);
lua_pushstring(L, "You need to supply number of bytes larger than zero"); lua_pushstring(L, "You need to supply number of bytes larger than zero");
return 2; // two return values return 2; // two return values
} }
uint8_t *data = calloc(len, sizeof(uint8_t)); uint8_t *data = calloc(len, sizeof(uint8_t));
if (!data) { if (!data) {

View file

@ -256,12 +256,12 @@ char *sprint_bin_break(const uint8_t *data, const size_t len, const uint8_t brea
sprintf(tmp++, "."); sprintf(tmp++, ".");
else else
sprintf(tmp++, "%u", data[in_index]); sprintf(tmp++, "%u", data[in_index]);
// check if a line break is needed and we have room to print it in our array // check if a line break is needed and we have room to print it in our array
if ((breaks > 0) && !((in_index + 1) % breaks) && (out_index + 1 != rowlen)) { if ((breaks > 0) && !((in_index + 1) % breaks) && (out_index + 1 != rowlen)) {
sprintf(tmp++, "%s", "\n"); sprintf(tmp++, "%s", "\n");
} }
in_index++; in_index++;
} }

View file

@ -489,21 +489,21 @@ int DetectStrongAskClock(uint8_t *dest, size_t size, int high, int low, int *clo
if (i == size) if (i == size)
return -1; return -1;
// clock, numoftimes, first idx // clock, numoftimes, first idx
uint16_t tmpclk[10][3] = { uint16_t tmpclk[10][3] = {
{8, 0, 0}, {8, 0, 0},
{16, 0, 0}, {16, 0, 0},
{32, 0, 0}, {32, 0, 0},
{40, 0, 0}, {40, 0, 0},
{50, 0, 0}, {50, 0, 0},
{64, 0, 0}, {64, 0, 0},
{100, 0, 0}, {100, 0, 0},
{128, 0, 0}, {128, 0, 0},
{256, 0, 0}, {256, 0, 0},
{384, 0, 0}, {384, 0, 0},
}; };
// loop through all samples (well, we don't want to go out-of-bounds) // loop through all samples (well, we don't want to go out-of-bounds)
while (i < size - 512) { while (i < size - 512) {
// measure from low to low // measure from low to low
@ -517,14 +517,14 @@ int DetectStrongAskClock(uint8_t *dest, size_t size, int high, int low, int *clo
minClk = i - startwave; minClk = i - startwave;
shortestWaveIdx = startwave; shortestWaveIdx = startwave;
} }
int foo = getClosestClock(minClk); int foo = getClosestClock(minClk);
if (foo > 0 ) { if (foo > 0) {
for (uint8_t i = 0; i < 10; i++) { for (uint8_t i = 0; i < 10; i++) {
if ( tmpclk[i][0] == foo ) { if (tmpclk[i][0] == foo) {
tmpclk[i][1]++; tmpclk[i][1]++;
if ( tmpclk[i][2] == 0) { if (tmpclk[i][2] == 0) {
tmpclk[i][2] = shortestWaveIdx; tmpclk[i][2] = shortestWaveIdx;
} }
break; break;
@ -538,17 +538,17 @@ int DetectStrongAskClock(uint8_t *dest, size_t size, int high, int low, int *clo
for (uint8_t i = 0; i < 10; i++) { for (uint8_t i = 0; i < 10; i++) {
if (g_debugMode == 2) { if (g_debugMode == 2) {
prnt("DEBUG, ASK, clocks %u | hits %u | idx %u" prnt("DEBUG, ASK, clocks %u | hits %u | idx %u"
, tmpclk[i][0] , tmpclk[i][0]
, tmpclk[i][1] , tmpclk[i][1]
, tmpclk[i][2] , tmpclk[i][2]
); );
} }
if ( max < tmpclk[i][1] ) { if (max < tmpclk[i][1]) {
*clock = tmpclk[i][0]; *clock = tmpclk[i][0];
shortestWaveIdx = tmpclk[i][2]; shortestWaveIdx = tmpclk[i][2];
max = tmpclk[i][1]; max = tmpclk[i][1];
} }
} }
if (*clock == 0) if (*clock == 0)
return -1; return -1;
@ -1517,10 +1517,10 @@ int askdemod_ext(uint8_t *bits, size_t *size, int *clk, int *invert, int maxErr,
if (g_debugMode == 2) prnt("DEBUG (askdemod_ext) just noise detected - aborting"); if (g_debugMode == 2) prnt("DEBUG (askdemod_ext) just noise detected - aborting");
return -2; return -2;
} }
int start = DetectASKClock(bits, *size, clk, maxErr); int start = DetectASKClock(bits, *size, clk, maxErr);
if (*clk == 0 || start < 0) return -3; if (*clk == 0 || start < 0) return -3;
if (*invert != 1) *invert = 0; if (*invert != 1) *invert = 0;
// amplify signal data. // amplify signal data.

View file

@ -5,7 +5,7 @@ CFLAGS += -std=c99 -D_ISOC99_SOURCE -I../../include -I../../common -I../../clien
LDFLAGS += LDFLAGS +=
OBJS = crypto1.o crapto1.o parity.o util_posix.o bucketsort.o OBJS = crypto1.o crapto1.o parity.o util_posix.o bucketsort.o
EXES = mfkey32 mfkey32v2 mfkey64 EXES = mfkey32 mfkey32v2 mfkey64
WINEXES = $(patsubst %, %.exe, $(EXES)) WINEXES = $(patsubst %, %.exe, $(EXES))
all: $(OBJS) $(EXES) all: $(OBJS) $(EXES)

View file

@ -4,7 +4,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "crapto1/crapto1.h" #include "crapto1/crapto1.h"
#include "util_posix.h" #include "util_posix.h"
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
struct Crypto1State *s, *t; struct Crypto1State *s, *t;

View file

@ -4,7 +4,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "crapto1/crapto1.h" #include "crapto1/crapto1.h"
#include "util_posix.h" #include "util_posix.h"
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
struct Crypto1State *s, *t; struct Crypto1State *s, *t;