Merge remote-tracking branch 'upstream/master' into hf_mf_sim

This commit is contained in:
vratiskol 2019-04-03 01:48:46 +02:00
commit 1c77185fb9
50 changed files with 1182 additions and 863 deletions

View file

@ -282,8 +282,7 @@ ifeq "$(SUPPORTS_AVX512)" "True"
endif
BINS = proxmark3 flasher fpga_compress
WINBINS = $(patsubst %, %.exe, $(BINS))
CLEAN = $(BINS) $(WINBINS) $(COREOBJS) $(CMDOBJS) $(OBJCOBJS) $(ZLIBOBJS) $(QTGUIOBJS) $(MULTIARCHOBJS) $(OBJDIR)/*.o *.moc.cpp ui/ui_overlays.h lualibs/usb_cmd.lua lualibs/mf_default_keys.lua
CLEAN = $(BINS) $(COREOBJS) $(CMDOBJS) $(OBJCOBJS) $(ZLIBOBJS) $(QTGUIOBJS) $(MULTIARCHOBJS) $(OBJDIR)/*.o *.moc.cpp ui/ui_overlays.h lualibs/usb_cmd.lua lualibs/mf_default_keys.lua
# need to assign dependancies to build these first...
all: lua_build jansson_build mbedtls_build cbor_build $(BINS)
@ -347,28 +346,28 @@ cbor_build:
print-%: ; @echo $* = $($*)
$(OBJDIR)/%_NOSIMD.o : %.c $(OBJDIR)/%_NOSIMD.d
$(CC) $(DEPFLAGS) $(CFLAGS) $(HARD_SWITCH_NOSIMD) -c -o $@ $<
$(POSTCOMPILE:%.d=%_NOSIMD.d)
$(CC) $(DEPFLAGS:%.Td=%_NOSIMD.Td) $(CFLAGS) $(HARD_SWITCH_NOSIMD) -c -o $@ $<
$(MV) -f $(OBJDIR)/$*_NOSIMD.Td $(OBJDIR)/$*_NOSIMD.d
$(OBJDIR)/%_MMX.o : %.c $(OBJDIR)/%_MMX.d
$(CC) $(DEPFLAGS) $(CFLAGS) $(HARD_SWITCH_MMX) -c -o $@ $<
$(POSTCOMPILE:%.d=%_MMX.d)
$(CC) $(DEPFLAGS:%.Td=%_MMX.Td) $(CFLAGS) $(HARD_SWITCH_MMX) -c -o $@ $<
$(MV) -f $(OBJDIR)/$*_MMX.Td $(OBJDIR)/$*_MMX.d
$(OBJDIR)/%_SSE2.o : %.c $(OBJDIR)/%_SSE2.d
$(CC) $(DEPFLAGS) $(CFLAGS) $(HARD_SWITCH_SSE2) -c -o $@ $<
$(POSTCOMPILE:%.d=%_SSE2.d)
$(CC) $(DEPFLAGS:%.Td=%_SSE2.Td) $(CFLAGS) $(HARD_SWITCH_SSE2) -c -o $@ $<
$(MV) -f $(OBJDIR)/$*_SSE2.Td $(OBJDIR)/$*_SSE2.d
$(OBJDIR)/%_AVX.o : %.c $(OBJDIR)/%_AVX.d
$(CC) $(DEPFLAGS) $(CFLAGS) $(HARD_SWITCH_AVX) -c -o $@ $<
$(POSTCOMPILE:%.d=%_AVX.d)
$(CC) $(DEPFLAGS:%.Td=%_AVX.Td) $(CFLAGS) $(HARD_SWITCH_AVX) -c -o $@ $<
$(MV) -f $(OBJDIR)/$*_AVX.Td $(OBJDIR)/$*_AVX.d
$(OBJDIR)/%_AVX2.o : %.c $(OBJDIR)/%_AVX2.d
$(CC) $(DEPFLAGS) $(CFLAGS) $(HARD_SWITCH_AVX2) -c -o $@ $<
$(POSTCOMPILE:%.d=%_AVX2.d)
$(CC) $(DEPFLAGS:%.Td=%_AVX2.Td) $(CFLAGS) $(HARD_SWITCH_AVX2) -c -o $@ $<
$(MV) -f $(OBJDIR)/$*_AVX2.Td $(OBJDIR)/$*_AVX2.d
$(OBJDIR)/%_AVX512.o : %.c $(OBJDIR)/%_AVX512.d
$(CC) $(DEPFLAGS) $(CFLAGS) $(HARD_SWITCH_AVX512) -c -o $@ $<
$(POSTCOMPILE:%.d=%_AVX512.d)
$(CC) $(DEPFLAGS:%.Td=%_AVX512.Td) $(CFLAGS) $(HARD_SWITCH_AVX512) -c -o $@ $<
$(MV) -f $(OBJDIR)/$*_AVX512.Td $(OBJDIR)/$*_AVX512.d
%.o: %.c
$(OBJDIR)/%.o : %.c $(OBJDIR)/%.d

View file

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

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};
sscanf(Cmd, "%i %i %i %i %c", &clk, &invert, &maxErr, &maxLen, &amp);
if (!maxLen) maxLen = BIGBUF_SIZE;
if (invert != 0 && invert != 1) {
@ -486,17 +486,17 @@ int ASKDemod_ext(const char *Cmd, bool verbose, bool emSearch, uint8_t askType,
if (amp == 'a') {
askAmp(bits, BitLen);
}
size_t ststart = 0, stend = 0;
// if (*stCheck)
bool st = DetectST(bits, &BitLen, &foundclk, &ststart, &stend);
if ( clk == 0 ) {
if ( foundclk == 32 || foundclk == 64 ) {
if (clk == 0) {
if (foundclk == 32 || foundclk == 64) {
clk = foundclk;
}
}
if (st) {
*stCheck = st;
CursorCPos = ststart;
@ -615,12 +615,15 @@ int Cmdmandecoderaw(const char *Cmd) {
return 1;
}
//by marshmellow
//biphase decode
//take 01 or 10 = 0 and 11 or 00 = 1
//takes 2 arguments "offset" default = 0 if 1 it will shift the decode by one bit
// and "invert" default = 0 if 1 it will invert output
// the argument offset allows us to manually shift if the output is incorrect - [EDIT: now auto detects]
/*
* @author marshmellow
* biphase decode
* decodes 01 or 10 -> ZERO
* 11 or 00 -> ONE
* param offset adjust start position
* param invert invert output
* param masxErr maximum tolerated errors
*/
int CmdBiphaseDecodeRaw(const char *Cmd) {
size_t size = 0;
int offset = 0, invert = 0, maxErr = 20, errCnt = 0;
@ -1095,9 +1098,9 @@ int CmdFSKrawdemod(const char *Cmd) {
//attempt to psk1 demod graph buffer
int PSKDemod(const char *Cmd, bool verbose) {
int invert = 0, clk = 0, maxErr = 100;
sscanf(Cmd, "%i %i %i", &clk, &invert, &maxErr);
if (clk == 1) {
invert = 1;
clk = 0;
@ -1112,9 +1115,9 @@ int PSKDemod(const char *Cmd, bool verbose) {
uint8_t bits[MAX_GRAPH_TRACE_LEN] = {0};
size_t bitlen = getFromGraphBuf(bits);
if (bitlen == 0)
if (bitlen == 0)
return 0;
int startIdx = 0;
int errCnt = pskRawDemod_ext(bits, &bitlen, &clk, &invert, &startIdx);
if (errCnt > maxErr) {
@ -1317,7 +1320,7 @@ int CmdRawDemod(const char *Cmd) {
void setClockGrid(int clk, int offset) {
g_DemodStartIdx = offset;
g_DemodClock = clk;
if ( clk == 0 && offset == 0)
if (clk == 0 && offset == 0)
PrintAndLogEx(DEBUG, "DEBUG: (setClockGrid) clear settings");
else
PrintAndLogEx(DEBUG, "DEBUG: (setClockGrid) demodoffset %d, clk %d", offset, clk);

View file

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

View file

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

View file

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

View file

@ -169,7 +169,7 @@ int CmdLegicInfo(const char *Cmd) {
int crc = 0, wrp = 0, wrc = 0;
uint8_t stamp_len = 0;
uint16_t datalen = 0;
char token_type[5] = {0, 0, 0, 0, 0};
char token_type[6] = {0, 0, 0, 0, 0, 0};
int dcf = 0;
int bIsSegmented = 0;
@ -1282,7 +1282,7 @@ int CmdLegicWipe(const char *Cmd) {
}
}
PrintAndLogEx(SUCCESS, "ok\n");
free(data);
free(data);
return 0;
}

View file

@ -423,7 +423,7 @@ int CmdVersion(const char *Cmd) {
#else
PrintAndLogEx(NORMAL, "\n\e[34m [ Proxmark3 RFID instrument ]\e[0m\n");
#endif
char s[50] = {0};
char s[60] = {0};
#if defined(WITH_FLASH) || defined(WITH_SMARTCARD) || defined(WITH_FPC)
strncat(s, "build for RDV40 with ", sizeof(s) - strlen(s) - 1);
#endif
@ -434,7 +434,11 @@ int CmdVersion(const char *Cmd) {
strncat(s, "smartcard; ", sizeof(s) - strlen(s) - 1);
#endif
#ifdef WITH_FPC
#ifdef WITH_FPC_HOST
strncat(s, "fpc-host; ", sizeof(s) - strlen(s) - 1);
#else
strncat(s, "fpc; ", sizeof(s) - strlen(s) - 1);
#endif
#endif
PrintAndLogEx(NORMAL, "\n [ CLIENT ]");
PrintAndLogEx(NORMAL, " client: iceman %s \n", s);

View file

@ -839,7 +839,7 @@ bool CheckChipType(bool getDeviceData) {
//check for t55xx chip...
if (tryDetectP1(true)) {
PrintAndLogEx(SUCCESS, "\nChipset detection : " _GREEN_("Atmel T55xx") " found");
PrintAndLogEx(SUCCESS, "\nChipset detection : " _GREEN_("T55xx") " found");
PrintAndLogEx(SUCCESS, "Try " _YELLOW_("`lf t55xx`")" commands");
retval = true;
goto out;

View file

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

View file

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

View file

@ -41,8 +41,8 @@ int usage_lf_keri_sim(void) {
// find KERI preamble in already demoded data
int detectKeri(uint8_t *dest, size_t *size, bool *invert) {
uint8_t preamble[] = {1,1,1,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
uint8_t preamble_i[] = {0,0,0,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0};
uint8_t preamble[] = {1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
uint8_t preamble_i[] = {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0};
// sanity check.
if (*size < sizeof(preamble) + 100) return -1;
@ -159,10 +159,10 @@ int CmdKeriClone(const char *Cmd) {
// MSB is ONE
internalid |= 0x80000000;
// 3 LSB is ONE
uint64_t data = ((uint64_t)internalid << 3) + 7;
PrintAndLogEx(INFO, "Preparing to clone KERI to T55x7 with Internal Id: %" PRIx64, internalid );
PrintAndLogEx(INFO, "Preparing to clone KERI to T55x7 with Internal Id: %" PRIx64, internalid);
//
blocks[1] = data >> 32;

View file

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

View file

@ -19,15 +19,15 @@ void Set_t55xx_Config(t55xx_conf_block_t conf) {
}
int usage_t55xx_config() {
PrintAndLogEx(NORMAL, "Usage: lf t55xx config [d <demodulation>] [i 1] [o <offset>] [Q5]");
PrintAndLogEx(NORMAL, "Usage: lf t55xx config [d <demodulation>] [i [0/1]] [o <offset>] [Q5 [0/1]] [ST [0/1]]");
PrintAndLogEx(NORMAL, "Options:");
PrintAndLogEx(NORMAL, " h - This help");
PrintAndLogEx(NORMAL, " b <8|16|32|40|50|64|100|128> - Set bitrate");
PrintAndLogEx(NORMAL, " d <FSK|FSK1|FSK1a|FSK2|FSK2a|ASK|PSK1|PSK2|NRZ|BI|BIa> - Set demodulation FSK / ASK / PSK / NRZ / Biphase / Biphase A");
PrintAndLogEx(NORMAL, " i [1] - Invert data signal, defaults to normal");
PrintAndLogEx(NORMAL, " i [0/1] - Set/reset data signal inversion");
PrintAndLogEx(NORMAL, " o [offset] - Set offset, where data should start decode in bitstream");
PrintAndLogEx(NORMAL, " Q5 - Set as Q5(T5555) chip instead of T55x7");
PrintAndLogEx(NORMAL, " ST - Set Sequence Terminator on");
PrintAndLogEx(NORMAL, " Q5 [0/1] - Set/reset as Q5(T5555) chip instead of T55x7");
PrintAndLogEx(NORMAL, " ST [0/1] - Set/reset Sequence Terminator on");
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf t55xx config d FSK - FSK demodulation");
@ -81,13 +81,19 @@ int usage_t55xx_trace() {
return 0;
}
int usage_t55xx_info() {
PrintAndLogEx(NORMAL, "Usage: lf t55xx info [1]");
PrintAndLogEx(NORMAL, "Usage: lf t55xx info [1] [d <data> [q]]");
PrintAndLogEx(NORMAL, "Options:");
PrintAndLogEx(NORMAL, " 1 - if set, use Graphbuffer otherwise read data from tag.");
PrintAndLogEx(NORMAL, " (default) - read data from tag.");
PrintAndLogEx(NORMAL, " 1 - if set, use Graphbuffer instead of reading tag.");
PrintAndLogEx(NORMAL, " d <data> - 4 bytes of data (8 hex characters)");
PrintAndLogEx(NORMAL, " if set, use these data instead of reading tag.");
PrintAndLogEx(NORMAL, " q - if set, provided data are interpreted as Q5 config.");
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf t55xx info");
PrintAndLogEx(NORMAL, " lf t55xx info 1");
PrintAndLogEx(NORMAL, " lf t55xx info d 00083040");
PrintAndLogEx(NORMAL, " lf t55xx info d 6001805A q");
PrintAndLogEx(NORMAL, "");
return 0;
}
@ -144,8 +150,8 @@ int usage_t55xx_wakup() {
int usage_t55xx_chk() {
PrintAndLogEx(NORMAL, "This command uses a dictionary attack");
PrintAndLogEx(NORMAL, "press " _YELLOW_("'enter'") " to cancel the command");
PrintAndLogEx(NORMAL, "WARNING: this may brick non-password protected chips!");
PrintAndLogEx(NORMAL, "Try to reading block 7 before\n");
PrintAndLogEx(NORMAL, "WARNING: this may brick non-password protected chips!");
PrintAndLogEx(NORMAL, "Try to reading block 7 before\n");
PrintAndLogEx(NORMAL, "Usage: lf t55xx chk [h] <m> [i <*.dic>]");
PrintAndLogEx(NORMAL, "Options:");
PrintAndLogEx(NORMAL, " h - this help");
@ -161,8 +167,8 @@ int usage_t55xx_chk() {
int usage_t55xx_bruteforce() {
PrintAndLogEx(NORMAL, "This command uses bruteforce to scan a number range");
PrintAndLogEx(NORMAL, "press " _YELLOW_("'enter'") " to cancel the command");
PrintAndLogEx(NORMAL, "WARNING: this may brick non-password protected chips!");
PrintAndLogEx(NORMAL, "Try to reading block 7 before\n");
PrintAndLogEx(NORMAL, "WARNING: this may brick non-password protected chips!");
PrintAndLogEx(NORMAL, "Try to reading block 7 before\n");
PrintAndLogEx(NORMAL, "Usage: lf t55xx bruteforce [h] <start password> <end password>");
PrintAndLogEx(NORMAL, " password must be 4 bytes (8 hex symbols)");
PrintAndLogEx(NORMAL, "Options:");
@ -177,9 +183,9 @@ int usage_t55xx_bruteforce() {
}
int usage_t55xx_recoverpw() {
PrintAndLogEx(NORMAL, "This command uses a few tricks to try to recover mangled password");
PrintAndLogEx(NORMAL, "press " _YELLOW_("'enter'") " to cancel the command");
PrintAndLogEx(NORMAL, "press " _YELLOW_("'enter'") " to cancel the command");
PrintAndLogEx(NORMAL, "WARNING: this may brick non-password protected chips!");
PrintAndLogEx(NORMAL, "Try to reading block 7 before\n");
PrintAndLogEx(NORMAL, "Try to reading block 7 before\n");
PrintAndLogEx(NORMAL, "Usage: lf t55xx recoverpw [password]");
PrintAndLogEx(NORMAL, " password must be 4 bytes (8 hex symbols)");
PrintAndLogEx(NORMAL, " default password is 51243648, used by many cloners");
@ -300,8 +306,13 @@ int CmdT55xxSetConfig(const char *Cmd) {
}
break;
case 'i':
config.inverted = param_getchar(Cmd, cmdp + 1) == '1';
cmdp += 2;
if ((param_getchar(Cmd, cmdp + 1) == '0') || (param_getchar(Cmd, cmdp + 1) == '1')) {
config.inverted = param_getchar(Cmd, cmdp + 1) == '1';
cmdp += 2;
} else {
config.inverted = true;
cmdp += 1;
}
break;
case 'o':
errors |= param_getdec(Cmd, cmdp + 1, &offset);
@ -310,12 +321,22 @@ int CmdT55xxSetConfig(const char *Cmd) {
cmdp += 2;
break;
case 'q':
config.Q5 = true;
cmdp++;
if ((param_getchar(Cmd, cmdp + 1) == '0') || (param_getchar(Cmd, cmdp + 1) == '1')) {
config.Q5 = param_getchar(Cmd, cmdp + 1) == '1';
cmdp += 2;
} else {
config.Q5 = true;
cmdp += 1;
}
break;
case 's':
config.ST = true;
cmdp++;
if ((param_getchar(Cmd, cmdp + 1) == '0') || (param_getchar(Cmd, cmdp + 1) == '1')) {
config.ST = param_getchar(Cmd, cmdp + 1) == '1';
cmdp += 2;
} else {
config.ST = true;
cmdp += 1;
}
break;
default:
PrintAndLogEx(WARNING, "Unknown parameter '%c'", param_getchar(Cmd, cmdp));
@ -1058,7 +1079,7 @@ int CmdT55xxWriteBlock(const char *Cmd) {
c.arg[2] = password;
c.d.asBytes[0] |= 0x1;
}
clearCommandBuffer();
SendCommand(&c);
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
@ -1079,7 +1100,7 @@ int CmdT55xxReadTrace(const char *Cmd) {
// sanity check.
if (!SanityOfflineCheck(false)) return 1;
if (!AquireData(T55x7_PAGE1, REGULAR_READ_MODE_BLOCK, pwdmode, password))
if (!AquireData(T55x7_PAGE1, T55x7_TRACE_BLOCK1, pwdmode, password))
return 1;
}
@ -1251,7 +1272,72 @@ void printT5555Trace(t5555_tracedata_t data, uint8_t repeat) {
*/
}
//need to add Q5 info...
static void printT5x7KnownBlock0(uint32_t b0) {
char s[40];
memset(s, 0, sizeof(s));
switch (b0) {
case T55X7_DEFAULT_CONFIG_BLOCK:
snprintf(s, sizeof(s) - strlen(s), "T55x7 Default ");
break;
case T55X7_RAW_CONFIG_BLOCK:
snprintf(s + strlen(s), sizeof(s) - strlen(s), "T55x7 Raw ");
break;
case T55X7_EM_UNIQUE_CONFIG_BLOCK:
snprintf(s + strlen(s), sizeof(s) - strlen(s), "EM Unique ");
break;
/*
case T55X7_EM_PAXTON_CONFIG_BLOCK:
snprintf(s + strlen(s), sizeof(s)-strlen(s), "EM Paxton ");
break;
*/
case T55X7_FDXB_CONFIG_BLOCK:
snprintf(s + strlen(s), sizeof(s) - strlen(s), "FDXB ");
break;
case T55X7_HID_26_CONFIG_BLOCK:
snprintf(s + strlen(s), sizeof(s) - strlen(s), "HID 26b ");
break;
case T55X7_PYRAMID_CONFIG_BLOCK:
snprintf(s + strlen(s), sizeof(s) - strlen(s), "Pyramid ");
break;
case T55X7_INDALA_64_CONFIG_BLOCK:
snprintf(s + strlen(s), sizeof(s) - strlen(s), "Indala 64");
break;
case T55X7_INDALA_224_CONFIG_BLOCK:
snprintf(s + strlen(s), sizeof(s) - strlen(s), "Indala 224 ");
break;
case T55X7_GUARDPROXII_CONFIG_BLOCK:
snprintf(s + strlen(s), sizeof(s) - strlen(s), "Guard Prox II ");
break;
case T55X7_VIKING_CONFIG_BLOCK:
snprintf(s + strlen(s), sizeof(s) - strlen(s), "Viking ");
break;
case T55X7_NORALYS_CONFIG_BLOCK:
snprintf(s + strlen(s), sizeof(s) - strlen(s), "Noralys ");
break;
case T55X7_IOPROX_CONFIG_BLOCK:
snprintf(s + strlen(s), sizeof(s) - strlen(s), "IO Prox ");
break;
case T55X7_PRESCO_CONFIG_BLOCK:
snprintf(s + strlen(s), sizeof(s) - strlen(s), "Presco ");
break;
case T55X7_NEDAP_64_CONFIG_BLOCK:
snprintf(s + strlen(s), sizeof(s) - strlen(s), "Nedap 64 ");
break;
case T55X7_NEDAP_128_CONFIG_BLOCK:
snprintf(s + strlen(s), sizeof(s) - strlen(s), "Nedap 128 ");
break;
default:
break;
}
if (strlen(s) > 0) {
PrintAndLogEx(NORMAL, " Known T55x7 Config block found : " _YELLOW_("%s"), s);
PrintAndLogEx(NORMAL, "-------------------------------------------------------------");
}
}
int CmdT55xxInfo(const char *Cmd) {
/*
Page 0 Block 0 Configuration data.
@ -1259,82 +1345,133 @@ int CmdT55xxInfo(const char *Cmd) {
Extended mode
*/
bool pwdmode = false;
bool frombuff = false;
bool gotdata = false;
bool dataasq5 = false;
uint32_t password = 0;
char cmdp = tolower(param_getchar(Cmd, 0));
uint32_t block0 = 0;
uint8_t cmdp = 0;
if (strlen(Cmd) > 1 || cmdp == 'h') return usage_t55xx_info();
while (param_getchar(Cmd, cmdp) != 0x00) {
switch (tolower(param_getchar(Cmd, cmdp))) {
case 'h':
return usage_t55xx_info();
case 'd':
block0 = param_get32ex(Cmd, cmdp + 1, 0, 16);
gotdata = true;
cmdp += 2;
break;
case '1':
frombuff = true;
cmdp += 2;
break;
case 'q':
dataasq5 = true;
cmdp += 2;
break;
default:
PrintAndLogEx(WARNING, "Unknown parameter '%c'", param_getchar(Cmd, cmdp));
return usage_t55xx_info();
}
}
if (strlen(Cmd) == 0) {
if (gotdata && frombuff)
return usage_t55xx_info();
if (dataasq5 && !gotdata)
return usage_t55xx_info();
if (!frombuff && !gotdata) {
// sanity check.
if (!SanityOfflineCheck(false)) return 1;
if (!AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, pwdmode, password))
return 1;
}
if (!gotdata) {
if (!DecodeT55xxBlock()) return 1;
if (!DecodeT55xxBlock()) return 1;
// too little space to start with
if (DemodBufferLen < 32 + config.offset) return 1;
// too little space to start with
if (DemodBufferLen < 32) return 1;
//
//PrintAndLogEx(NORMAL, "Offset+32 ==%d\n DemodLen == %d", config.offset + 32, DemodBufferLen);
uint8_t si = config.offset;
uint32_t block0 = PackBits(si, 32, DemodBuffer);
uint32_t safer = PackBits(si, 4, DemodBuffer);
si += 4;
uint32_t resv = PackBits(si, 7, DemodBuffer);
si += 7;
uint32_t dbr = PackBits(si, 3, DemodBuffer);
si += 3;
uint32_t extend = PackBits(si, 1, DemodBuffer);
si += 1;
uint32_t datamod = PackBits(si, 5, DemodBuffer);
si += 5;
uint32_t pskcf = PackBits(si, 2, DemodBuffer);
si += 2;
uint32_t aor = PackBits(si, 1, DemodBuffer);
si += 1;
uint32_t otp = PackBits(si, 1, DemodBuffer);
si += 1;
uint32_t maxblk = PackBits(si, 3, DemodBuffer);
si += 3;
uint32_t pwd = PackBits(si, 1, DemodBuffer);
si += 1;
uint32_t sst = PackBits(si, 1, DemodBuffer);
si += 1;
uint32_t fw = PackBits(si, 1, DemodBuffer);
si += 1;
uint32_t inv = PackBits(si, 1, DemodBuffer);
si += 1;
uint32_t por = PackBits(si, 1, DemodBuffer);
si += 1;
if (config.Q5)
PrintAndLogEx(NORMAL, _RED_("* **Warning ***") " Config Info read off a Q5 will not display as expected");
//PrintAndLogEx(NORMAL, "Offset+32 ==%d\n DemodLen == %d", config.offset + 32, DemodBufferLen);
block0 = PackBits(config.offset, 32, DemodBuffer);
}
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "-- T55x7 Configuration & Tag Information --------------------");
PrintAndLogEx(NORMAL, "-------------------------------------------------------------");
PrintAndLogEx(NORMAL, " Safer key : %s", GetSaferStr(safer));
PrintAndLogEx(NORMAL, " reserved : %d", resv);
PrintAndLogEx(NORMAL, " Data bit rate : %s", GetBitRateStr(dbr, extend));
PrintAndLogEx(NORMAL, " eXtended mode : %s", (extend) ? _YELLOW_("Yes - Warning") : "No");
PrintAndLogEx(NORMAL, " Modulation : %s", GetModulationStr(datamod));
PrintAndLogEx(NORMAL, " PSK clock frequency : %d", pskcf);
PrintAndLogEx(NORMAL, " AOR - Answer on Request : %s", (aor) ? _GREEN_("Yes") : "No");
PrintAndLogEx(NORMAL, " OTP - One Time Pad : %s", (otp) ? _YELLOW_("Yes - Warning") : "No");
PrintAndLogEx(NORMAL, " Max block : %d", maxblk);
PrintAndLogEx(NORMAL, " Password mode : %s", (pwd) ? _GREEN_("Yes") : "No");
PrintAndLogEx(NORMAL, " Sequence Start Terminator : %s", (sst) ? _GREEN_("Yes") : "No");
PrintAndLogEx(NORMAL, " Fast Write : %s", (fw) ? _GREEN_("Yes") : "No");
PrintAndLogEx(NORMAL, " Inverse data : %s", (inv) ? _GREEN_("Yes") : "No");
PrintAndLogEx(NORMAL, " POR-Delay : %s", (por) ? _GREEN_("Yes") : "No");
if (((!gotdata) && config.Q5) || (gotdata && dataasq5)) {
uint32_t header = (block0 >> (32 - 12)) & 0xFFF;
uint32_t ps = (block0 >> (32 - 13)) & 0x01;
uint32_t fw = (block0 >> (32 - 14)) & 0x01;
uint32_t dbr = (block0 >> (32 - 20)) & 0x3F;
uint32_t aor = (block0 >> (32 - 21)) & 0x01;
uint32_t pwd = (block0 >> (32 - 22)) & 0x01;
uint32_t pskcf = (block0 >> (32 - 24)) & 0x03;
uint32_t inv = (block0 >> (32 - 25)) & 0x01;
uint32_t datamod = (block0 >> (32 - 28)) & 0x07;
uint32_t maxblk = (block0 >> (32 - 31)) & 0x07;
uint32_t st = (block0 >> (32 - 32)) & 0x01;
PrintAndLogEx(NORMAL, "-- Q5 Configuration & Tag Information -----------------------");
PrintAndLogEx(NORMAL, "-------------------------------------------------------------");
PrintAndLogEx(NORMAL, " Header : 0x%03X%s", header, (header != 0x600) ? _RED_(" - Warning") : "");
PrintAndLogEx(NORMAL, " Page select : %d", ps);
PrintAndLogEx(NORMAL, " Fast Write : %s", (fw) ? _GREEN_("Yes") : "No");
PrintAndLogEx(NORMAL, " Data bit rate : %s", GetBitRateStr(dbr, 1));
PrintAndLogEx(NORMAL, " AOR - Answer on Request : %s", (aor) ? _GREEN_("Yes") : "No");
PrintAndLogEx(NORMAL, " Password mode : %s", (pwd) ? _GREEN_("Yes") : "No");
PrintAndLogEx(NORMAL, " PSK clock frequency : %s", GetPskCfStr(pskcf, 1));
PrintAndLogEx(NORMAL, " Inverse data : %s", (inv) ? _GREEN_("Yes") : "No");
PrintAndLogEx(NORMAL, " Modulation : %s", GetQ5ModulationStr(datamod));
PrintAndLogEx(NORMAL, " Max block : %d", maxblk);
PrintAndLogEx(NORMAL, " Sequence Terminator : %s", (st) ? _GREEN_("Yes") : "No");
} else {
uint32_t safer = (block0 >> (32 - 4)) & 0x0F;
uint32_t extend = (block0 >> (32 - 15)) & 0x01;
uint32_t resv, dbr;
if (extend) {
resv = (block0 >> (32 - 8)) & 0x0F;
dbr = (block0 >> (32 - 14)) & 0x3F;
} else {
resv = (block0 >> (32 - 11)) & 0x7F;
dbr = (block0 >> (32 - 14)) & 0x07;
}
uint32_t datamod = (block0 >> (32 - 20)) & 0x1F;
uint32_t pskcf = (block0 >> (32 - 22)) & 0x03;
uint32_t aor = (block0 >> (32 - 23)) & 0x01;
uint32_t otp = (block0 >> (32 - 24)) & 0x01;
uint32_t maxblk = (block0 >> (32 - 27)) & 0x07;
uint32_t pwd = (block0 >> (32 - 28)) & 0x01;
uint32_t sst = (block0 >> (32 - 29)) & 0x01;
uint32_t fw = (block0 >> (32 - 30)) & 0x01;
uint32_t inv = (block0 >> (32 - 31)) & 0x01;
uint32_t por = (block0 >> (32 - 32)) & 0x01;
PrintAndLogEx(NORMAL, "-- T55x7 Configuration & Tag Information --------------------");
PrintAndLogEx(NORMAL, "-------------------------------------------------------------");
PrintAndLogEx(NORMAL, " Safer key : %s", GetSaferStr(safer));
PrintAndLogEx(NORMAL, " reserved : %d", resv);
PrintAndLogEx(NORMAL, " Data bit rate : %s", GetBitRateStr(dbr, extend));
PrintAndLogEx(NORMAL, " eXtended mode : %s", (extend) ? _YELLOW_("Yes - Warning") : "No");
PrintAndLogEx(NORMAL, " Modulation : %s", GetModulationStr(datamod, extend));
PrintAndLogEx(NORMAL, " PSK clock frequency : %s", GetPskCfStr(pskcf, 0));
PrintAndLogEx(NORMAL, " AOR - Answer on Request : %s", (aor) ? _GREEN_("Yes") : "No");
PrintAndLogEx(NORMAL, " OTP - One Time Pad : %s", (otp) ? ((extend) ? _YELLOW_("Yes - Warning") : _RED_("Yes - Warning")) : "No");
PrintAndLogEx(NORMAL, " Max block : %d", maxblk);
PrintAndLogEx(NORMAL, " Password mode : %s", (pwd) ? _GREEN_("Yes") : "No");
PrintAndLogEx(NORMAL, " Sequence %-12s : %s", (extend) ? "Start Marker" : "Terminator", (sst) ? _GREEN_("Yes") : "No");
PrintAndLogEx(NORMAL, " Fast Write : %s", (fw) ? ((extend) ? _GREEN_("Yes") : _RED_("Yes - Warning")) : "No");
PrintAndLogEx(NORMAL, " Inverse data : %s", (inv) ? ((extend) ? _GREEN_("Yes") : _RED_("Yes - Warning")) : "No");
PrintAndLogEx(NORMAL, " POR-Delay : %s", (por) ? _GREEN_("Yes") : "No");
}
PrintAndLogEx(NORMAL, "-------------------------------------------------------------");
PrintAndLogEx(NORMAL, " Raw Data - Page 0");
PrintAndLogEx(NORMAL, " Block 0 : 0x%08X %s", block0, sprint_bin(DemodBuffer + config.offset, 32));
if (gotdata)
PrintAndLogEx(NORMAL, " Block 0 : 0x%08X", block0);
else
PrintAndLogEx(NORMAL, " Block 0 : 0x%08X %s", block0, sprint_bin(DemodBuffer + config.offset, 32));
PrintAndLogEx(NORMAL, "-------------------------------------------------------------");
if (((!gotdata) && (!config.Q5)) || (gotdata && (!dataasq5)))
printT5x7KnownBlock0(block0);
return 0;
}
@ -1369,7 +1506,7 @@ bool AquireData(uint8_t page, uint8_t block, bool pwdmode, uint32_t password) {
// bit1 = page to read from
// arg1: which block to read
// arg2: password
uint8_t arg0 = ( page << 1 | (pwdmode) );
uint8_t arg0 = (page << 1 | (pwdmode));
UsbCommand c = {CMD_T55XX_READ_BLOCK, {arg0, block, password}};
clearCommandBuffer();
SendCommand(&c);
@ -1383,6 +1520,32 @@ bool AquireData(uint8_t page, uint8_t block, bool pwdmode, uint32_t password) {
return !getSignalProperties()->isnoise;
}
char *GetPskCfStr(uint32_t id, bool q5) {
static char buf[25];
char *retStr = buf;
switch (id) {
case 0:
snprintf(retStr, sizeof(buf), "%u - RF/2", id);
break;
case 1:
snprintf(retStr, sizeof(buf), "%u - RF/4", id);
break;
case 2:
snprintf(retStr, sizeof(buf), "%u - RF/8", id);
break;
case 3:
if (q5)
snprintf(retStr, sizeof(buf), "%u - RF/8", id);
else
snprintf(retStr, sizeof(buf), "%u - " _RED_("(Unknown)"), id);
break;
default:
snprintf(retStr, sizeof(buf), "%u - " _RED_("(Unknown)"), id);
break;
}
return buf;
}
char *GetBitRateStr(uint32_t id, bool xmode) {
static char buf[25];
@ -1416,7 +1579,7 @@ char *GetBitRateStr(uint32_t id, bool xmode) {
snprintf(retStr, sizeof(buf), "%u - RF/128", id);
break;
default:
snprintf(retStr, sizeof(buf), "%u - (Unknown)", id);
snprintf(retStr, sizeof(buf), "%u - " _RED_("(Unknown)"), id);
break;
}
}
@ -1438,7 +1601,7 @@ char *GetSaferStr(uint32_t id) {
return buf;
}
char *GetModulationStr(uint32_t id) {
char *GetModulationStr(uint32_t id, bool xmode) {
static char buf[60];
char *retStr = buf;
@ -1462,10 +1625,10 @@ char *GetModulationStr(uint32_t id) {
snprintf(retStr, sizeof(buf), "%u - FSK 2 RF/8 RF/10", id);
break;
case 6:
snprintf(retStr, sizeof(buf), "%u - FSK 1a RF/5 RF/8", id);
snprintf(retStr, sizeof(buf), "%u - %s RF/5 RF/8", id, (xmode) ? "FSK 1a" : _YELLOW_("FSK 1a"));
break;
case 7:
snprintf(retStr, sizeof(buf), "%u - FSK 2a RF/10 RF/8", id);
snprintf(retStr, sizeof(buf), "%u - %s RF/10 RF/8", id, (xmode) ? "FSK 2a" : _YELLOW_("FSK 2a"));
break;
case 8:
snprintf(retStr, sizeof(buf), "%u - Manchester", id);
@ -1473,14 +1636,44 @@ char *GetModulationStr(uint32_t id) {
case 16:
snprintf(retStr, sizeof(buf), "%u - Biphase", id);
break;
case 0x18:
snprintf(retStr, sizeof(buf), "%u - Biphase a - AKA Conditional Dephase Encoding(CDP)", id);
break;
case 17:
snprintf(retStr, sizeof(buf), "%u - Reserved", id);
case 24:
snprintf(retStr, sizeof(buf), "%u - %s", id, (xmode) ? "Biphase a - AKA Conditional Dephase Encoding(CDP)" : _YELLOW_("Reserved"));
break;
default:
snprintf(retStr, sizeof(buf), "0x%02X (Unknown)", id);
snprintf(retStr, sizeof(buf), "0x%02X " _RED_("(Unknown)"), id);
break;
}
return buf;
}
char *GetQ5ModulationStr(uint32_t id) {
static char buf[60];
char *retStr = buf;
switch (id) {
case 0:
snprintf(retStr, sizeof(buf), "%u - Manchester", id);
break;
case 1:
snprintf(retStr, sizeof(buf), "%u - PSK 1 phase change when input changes", id);
break;
case 2:
snprintf(retStr, sizeof(buf), "%u - PSK 2 phase change on bitclk if input high", id);
break;
case 3:
snprintf(retStr, sizeof(buf), "%u - PSK 3 phase change on rising edge of input", id);
break;
case 4:
snprintf(retStr, sizeof(buf), "%u - FSK 1a RF/5 RF/8", id);
break;
case 5:
snprintf(retStr, sizeof(buf), "%u - FSK 2a RF/10 RF/8", id);
break;
case 6:
snprintf(retStr, sizeof(buf), "%u - Biphase", id);
break;
case 7:
snprintf(retStr, sizeof(buf), "%u - NRZ / Direct", id);
break;
}
return buf;
@ -1539,7 +1732,7 @@ char *GetSelectedModulationStr(uint8_t id) {
snprintf(retStr, sizeof(buf), "BIPHASEa - (CDP)");
break;
default:
snprintf(retStr, sizeof(buf), "(Unknown)");
snprintf(retStr, sizeof(buf), _RED_("(Unknown)"));
break;
}
return buf;
@ -1637,7 +1830,7 @@ int CmdT55xxChkPwds(const char *Cmd) {
bool found = false;
uint8_t timeout = 0;
uint8_t *keyBlock = NULL;
char cmdp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) == 0 || cmdp == 'h') return usage_t55xx_chk();
@ -1676,7 +1869,7 @@ int CmdT55xxChkPwds(const char *Cmd) {
found = tryDetectModulation();
if (found) {
PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08") " ]", resp.arg[1]);
PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08") " ]", resp.arg[1]);
} else {
PrintAndLogEx(WARNING, "Check pwd failed");
}
@ -1688,22 +1881,22 @@ int CmdT55xxChkPwds(const char *Cmd) {
}
if (cmdp == 'i') {
int len = strlen(Cmd + 2);
if (len > FILE_PATH_SIZE) len = FILE_PATH_SIZE;
memcpy(filename, Cmd + 2, len);
uint16_t keycount = 0;
size_t datalen = 0;
// TODO, a way of reallocating memory if file was larger
keyBlock = calloc(4*200, sizeof(uint8_t));
if ( keyBlock == NULL ) {
keyBlock = calloc(4 * 200, sizeof(uint8_t));
if (keyBlock == NULL) {
PrintAndLogDevice(WARNING, "error, cannot allocate memory ");
return 1;
}
int res = loadFileDICTIONARY(filename, "dic", keyBlock, &datalen, 4, &keycount );
int res = loadFileDICTIONARY(filename, "dic", keyBlock, &datalen, 4, &keycount);
if (res || keycount == 0) {
PrintAndLogEx(WARNING, "No keys found in file");
free(keyBlock);
@ -1728,7 +1921,7 @@ int CmdT55xxChkPwds(const char *Cmd) {
curr_password = bytes_to_num(keyBlock + 4 * c, 4);
PrintAndLogEx(INFO, "Testing %08X", curr_password);
if (!AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, curr_password)) {
continue;
}
@ -1776,7 +1969,7 @@ int CmdT55xxBruteForce(const char *Cmd) {
PrintAndLogEx(INFO, "Search password range [%08X -> %08X]", start_password, end_password);
while (!found) {
printf(".");
fflush(stdout);
@ -1788,7 +1981,7 @@ int CmdT55xxBruteForce(const char *Cmd) {
if (curr == end_password)
break;
curr++;
}
@ -1806,12 +1999,12 @@ int CmdT55xxBruteForce(const char *Cmd) {
int tryOnePassword(uint32_t password) {
PrintAndLogEx(INFO, "Trying password %08X", password);
AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, password);
if (getSignalProperties()->isnoise == false)
return 0;
if (tryDetectModulation())
return 1;
else
@ -1834,12 +2027,12 @@ int CmdT55xxRecoverPW(const char *Cmd) {
while (bit < 32) {
curr_password = orig_password ^ (1u << bit);
found = tryOnePassword(curr_password);
if ( found == 1)
if (found == 1)
goto out;
bit++;
if (IsCancelled())
if (IsCancelled())
return 0;
}
@ -1857,15 +2050,15 @@ int CmdT55xxRecoverPW(const char *Cmd) {
bit++;
continue;
}
found = tryOnePassword(curr_password);
if ( found == 1 )
goto out;
if (found == 1)
goto out;
bit++;
prev_password = curr_password;
if (IsCancelled())
if (IsCancelled())
return 0;
}
@ -1881,13 +2074,13 @@ int CmdT55xxRecoverPW(const char *Cmd) {
continue;
}
found = tryOnePassword(curr_password);
if ( found == 1 )
if (found == 1)
goto out;
bit++;
prev_password = curr_password;
if (IsCancelled())
if (IsCancelled())
return 0;
}
@ -1914,7 +2107,7 @@ bool tryDetectP1(bool getData) {
bool st = true;
if (getData) {
if (!AquireData(T55x7_PAGE1, 1, false, 0))
if (!AquireData(T55x7_PAGE1, T55x7_TRACE_BLOCK1, false, 0))
return false;
}
@ -2043,7 +2236,7 @@ int CmdT55xxDetectPage1(const char *Cmd) {
if (errors) return usage_t55xx_detectP1();
if (!useGB) {
if (!AquireData(T55x7_PAGE1, 1, usepwd, password))
if (!AquireData(T55x7_PAGE1, T55x7_TRACE_BLOCK1, usepwd, password))
return false;
}
bool success = tryDetectP1(false);

View file

@ -29,6 +29,8 @@
#define T55x7_CONFIGURATION_BLOCK 0x00
#define T55x7_TRACE_BLOCK1 0x01
#define T55x7_TRACE_BLOCK2 0x02
#define T55x7_PAGE0 0x00
#define T55x7_PAGE1 0x01
#define T55x7_PWD 0x00000010
@ -147,9 +149,11 @@ extern int CmdT55xxDetect(const char *Cmd);
extern int CmdResetRead(const char *Cmd);
extern int CmdT55xxWipe(const char *Cmd);
char *GetPskCfStr(uint32_t id, bool q5);
char *GetBitRateStr(uint32_t id, bool xmode);
char *GetSaferStr(uint32_t id);
char *GetModulationStr(uint32_t id);
char *GetQ5ModulationStr(uint32_t id);
char *GetModulationStr(uint32_t id, bool xmode);
char *GetModelStrFromCID(uint32_t cid);
char *GetSelectedModulationStr(uint8_t id);
uint32_t PackBits(uint8_t start, uint8_t len, uint8_t *bitstream);

View file

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

View file

@ -194,7 +194,7 @@ static void UsbCommandReceived(UsbCommand *c) {
/*
bool hookUpPM3() {
bool ret = false;
sp = uart_open( comport );
sp = uart_open( comport, speed );
if (sp == INVALID_SERIAL_PORT) {
PrintAndLogEx(WARNING, "Reconnect failed, retrying... (reason: invalid serial port)\n");
@ -298,17 +298,17 @@ __attribute__((force_align_arg_pointer))
return NULL;
}
bool OpenProxmark(void *port, bool wait_for_port, int timeout, bool flash_mode) {
bool OpenProxmark(void *port, bool wait_for_port, int timeout, bool flash_mode, uint32_t speed) {
char *portname = (char *)port;
if (!wait_for_port) {
sp = uart_open(portname);
sp = uart_open(portname, speed);
} else {
PrintAndLogEx(SUCCESS, "Waiting for Proxmark to appear on " _YELLOW_("%s"), portname);
fflush(stdout);
int openCount = 0;
do {
sp = uart_open(portname);
sp = uart_open(portname, speed);
msleep(500);
printf(".");
fflush(stdout);

View file

@ -54,7 +54,8 @@ void *uart_receiver(void *targ);
void SendCommand(UsbCommand *c);
void clearCommandBuffer();
bool OpenProxmark(void *port, bool wait_for_port, int timeout, bool flash_mode);
#define FLASHMODE_SPEED 460800
bool OpenProxmark(void *port, bool wait_for_port, int timeout, bool flash_mode, uint32_t speed);
void CloseProxmark(void);
bool WaitForResponseTimeoutW(uint32_t cmd, UsbCommand *response, size_t ms_timeout, bool show_warning);

View file

@ -318,8 +318,10 @@ static int enter_bootloader(char *serial_port_name) {
}
msleep(100);
CloseProxmark();
// Let time to OS to make the port disappear
msleep(1000);
bool opened = OpenProxmark(serial_port_name, true, 60, true);
bool opened = OpenProxmark(serial_port_name, true, 60, true, FLASHMODE_SPEED);
if (opened) {
fprintf(stdout, " " _GREEN_("Found") "\n");
return 0;

View file

@ -81,7 +81,7 @@ int main(int argc, char **argv) {
char *serial_port_name = argv[1];
if (!OpenProxmark(serial_port_name, true, 60, true)) {
if (!OpenProxmark(serial_port_name, true, 60, true, FLASHMODE_SPEED)) {
fprintf(stderr, "Could not find Proxmark on " _RED_("%s") ".\n\n", serial_port_name);
return -1;
} else {

View file

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

View file

@ -259,6 +259,9 @@ int main(int argc, char *argv[]) {
bool addLuaExec = false;
char *script_cmds_file = NULL;
char *script_cmd = NULL;
char *lastarg = NULL;
char *port = NULL;
uint32_t speed = 0;
/* initialize history */
using_history();
@ -272,7 +275,9 @@ int main(int argc, char *argv[]) {
return 1;
}
for (int i = 1; i < argc; i++) {
uint32_t i = 1;
port = argv[i++];
for (; i < argc; i++) {
// helptext
if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-help") == 0) {
@ -291,29 +296,58 @@ int main(int argc, char *argv[]) {
if (strcmp(argv[i], "-f") == 0 || strcmp(argv[i], "-flush") == 0) {
SetFlushAfterWrite(true);
PrintAndLogEx(INFO, "Output will be flushed after every print.\n");
continue;
}
// set baudrate
if (strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "-baud") == 0) {
uint32_t tmpspeed = strtoul(argv[i + 1], NULL, 10);
if ((tmpspeed == ULONG_MAX) || (tmpspeed == 0)) {
PrintAndLogEx(WARNING, "ERROR: invalid baudrate: %s %s\n", argv[i], argv[i + 1]);
return 1;
}
speed = tmpspeed;
i++;
continue;
}
// wait for comport
if (strcmp(argv[i], "-w") == 0 || strcmp(argv[i], "-wait") == 0) {
waitCOMPort = true;
continue;
}
// execute pm3 command
if (strcmp(argv[i], "-c") == 0 || strcmp(argv[i], "-command") == 0) {
executeCommand = true;
continue;
}
// execute lua script
if (strcmp(argv[i], "-l") == 0 || strcmp(argv[i], "-lua") == 0) {
executeCommand = true;
addLuaExec = true;
continue;
}
if (i < argc - 1) {
// We got an unknown parameter
PrintAndLogEx(WARNING, "WARNING: ignoring invalid parameter: %s\n", argv[i]);
}
if (i == argc - 1) {
// We got presumably a command or a filename
lastarg = argv[argc - 1];
}
}
if (speed == 0)
speed = 460800;
// If the user passed the filename of the 'script' to execute, get it from last parameter
if (argc > 2 && argv[argc - 1] && argv[argc - 1][0] != '-') {
if (lastarg) {
if (executeCommand) {
script_cmd = argv[argc - 1];
script_cmd = lastarg;
while (script_cmd[strlen(script_cmd) - 1] == ' ')
script_cmd[strlen(script_cmd) - 1] = 0x00;
@ -336,7 +370,7 @@ int main(int argc, char *argv[]) {
PrintAndLogEx(SUCCESS, "execute command from commandline: %s\n", script_cmd);
}
} else {
script_cmds_file = argv[argc - 1];
script_cmds_file = lastarg;
}
}
@ -358,7 +392,7 @@ int main(int argc, char *argv[]) {
set_my_executable_path();
// try to open USB connection to Proxmark
usb_present = OpenProxmark(argv[1], waitCOMPort, 20, false);
usb_present = OpenProxmark(port, waitCOMPort, 20, false, speed);
#ifdef HAVE_GUI

View file

@ -630,7 +630,7 @@ usage(void) {
"\t preset values\n"
"\n"
"Copyright (C)\n"
"2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Gregory Cook\n"
"2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Gregory Cook\n"
"This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
"Version "

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 */
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);
return (result);
}

View file

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

View file

@ -69,12 +69,12 @@ static int l_GetFromBigBuf(lua_State *L) {
startindex = luaL_checknumber(L, 1);
len = luaL_checknumber(L, 2);
}
if ( len == 0 ) {
if (len == 0) {
//signal error by returning Nil, errorstring
lua_pushnil(L);
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));
@ -125,13 +125,13 @@ static int l_GetFromFlashMem(lua_State *L) {
startindex = luaL_checknumber(L, 1);
len = luaL_checknumber(L, 2);
}
if ( len == 0 ) {
if (len == 0) {
//signal error by returning Nil, errorstring
lua_pushnil(L);
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));
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++, ".");
else
sprintf(tmp++, "%u", data[in_index]);
// 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)) {
sprintf(tmp++, "%s", "\n");
}
in_index++;
}