Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Commit

Permalink
upd: RevEng v1.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
iceman1001 committed Jul 29, 2018
1 parent 1dd01fd commit 513d0ac
Show file tree
Hide file tree
Showing 12 changed files with 431 additions and 420 deletions.
12 changes: 7 additions & 5 deletions client/cmdcrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,15 @@ int CmdCrc(const char *Cmd)
char *argv[MAX_ARGS];
int argc = split(Cmd2, argv);

if (argc == 3 && memcmp(argv[1],"-g",2)==0) {
if (argc == 3 && memcmp(argv[1], "-g", 2) == 0) {
CmdrevengSearch(argv[2]);
} else {
reveng_main(argc, argv);
}
for(int i = 0; i < argc; ++i) {
free(argv[i]);
}

return 0;
return 0;
}

//returns array of model names and the count of models returning
Expand Down Expand Up @@ -396,13 +395,16 @@ char *SwapEndianStr(const char *inStr, const size_t len, const uint8_t blockSize

// takes hex string in and searches for a matching result (hex string must include checksum)
int CmdrevengSearch(const char *Cmd){

#define NMODELS 103

char inHexStr[100] = {0x00};
int dataLen = param_getstr(Cmd, 0, inHexStr, sizeof(inHexStr));
if (dataLen < 4) return 0;

// these two arrays, must match preset size.
char *Models[102];
uint8_t width[102] = {0};
char *Models[NMODELS];
uint8_t width[NMODELS] = {0};
int count = 0;

uint8_t crcChars = 0;
Expand Down
2 changes: 0 additions & 2 deletions client/cmdcrc.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#include "ui.h"
#include "util.h"



extern int CmdCrc(const char *Cmd);

extern int CmdrevengSearch(const char *Cmd);
Expand Down
5 changes: 3 additions & 2 deletions client/cmdmain.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
//
// Modified 2018 iceman <iceman at iuse.se>
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
// at your option, any later version. See the LICENSE.txt file for the text of
// the license.
Expand Down Expand Up @@ -32,14 +33,14 @@ static command_t CommandTable[] = {
{"hf", CmdHF, 1, "{ High Frequency commands... }"},
{"hw", CmdHW, 1, "{ Hardware commands... }"},
{"lf", CmdLF, 1, "{ Low Frequency commands... }"},
{"reveng", CmdRev, 1, "{ Crc calculations from the software reveng 1.51... }"},
{"reveng", CmdRev, 1, "{ Crc calculations from the software reveng 1.53... }"},
{"script", CmdScript, 1, "{ Scripting commands }"},
{"trace", CmdTrace, 1, "{ Trace manipulation... }"},
#ifdef WITH_FLASH
{"mem", CmdFlashMem, 1, "{ RDV40, Flash Memory manipulation... }"},
#endif
#ifdef WITH_SMARTCARD
{"sc", CmdSmartcard, 1, "{ RDV40, Smart card ISO7816 commands... }"},
{"sc", CmdSmartcard, 1, "{ RDV40, Smart card ISO7816 commands... }"},
#endif
{"quit", CmdQuit, 1, ""},
{"exit", CmdQuit, 1, "Exit program"},
Expand Down
4 changes: 2 additions & 2 deletions client/reveng/bmpbit.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* bmpbit.c
* Greg Cook, 7/Feb/2017
* Greg Cook, 26/Jul/2018
*/

/* CRC RevEng: arbitrary-precision CRC calculator and algorithm finder
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
* Gregory Cook
*
* This file is part of CRC RevEng.
Expand Down
21 changes: 11 additions & 10 deletions client/reveng/cli.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* cli.c
* Greg Cook, 19/Feb/2017
* Greg Cook, 26/Jul/2018
*/

/* CRC RevEng: arbitrary-precision CRC calculator and algorithm finder
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
* Gregory Cook
*
* This file is part of CRC RevEng.
Expand All @@ -22,7 +22,8 @@
* along with CRC RevEng. If not, see <https://www.gnu.org/licenses/>.
*/

/* 2017-02-18: -G ignored if R_HAVEP
/* 2018-07-26: NOFORCE renamed ALWPCK
* 2017-02-18: -G ignored if R_HAVEP
* 2017-02-05: added -G
* 2016-06-27: -P sets width like -k
* 2015-04-03: added -z
Expand Down Expand Up @@ -135,7 +136,7 @@ int reveng_main(int argc, char *argv[]) {
mode = c;
break;
case 'F': /* F skip preset model check pass */
#ifndef NOFORCE
#ifndef ALWPCK
uflags |= C_NOPCK;
#endif
break;
Expand Down Expand Up @@ -507,7 +508,6 @@ void
uerror(const char *msg) {
/* Callback function to report fatal errors */
fprintf(stderr, "%s: %s\n", myname, msg);
return;
//exit(EXIT_FAILURE);
}

Expand Down Expand Up @@ -581,9 +581,8 @@ usage(void) {
fputs(myname, stderr);
fprintf(stderr,
"\t-cdDesvhu? [-bBfFGlLMrStVXyz]\n"
"\t\t[-a BITS] [-A OBITS] [-i INIT] [-k KPOLY] [-m MODEL]\n"
"\t\t[-p POLY] [-P RPOLY] [-q QPOLY] [-w WIDTH] [-x XOROUT]\n"
"\t\t[STRING...]\n"
"\t\t[-a BITS] [-A OBITS] [-i INIT] [-k KPOLY] [-m MODEL] [-p POLY]\n"
"\t\t[-p POLY] [-P RPOLY] [-q QPOLY] [-w WIDTH] [-x XOROUT] [STRING...]\n"
"Options:\n"
"\t-a BITS\t\tbits per character (1 to %d)\n"
"\t-A OBITS\tbits per output character (1 to %d)\n"
Expand Down Expand Up @@ -611,7 +610,8 @@ usage(void) {
"\t-c calculate CRCs\t\t-d dump algorithm parameters\n"
"\t-D list preset algorithms\t-e echo (and reformat) input\n"
"\t-s search for algorithm\t\t-v calculate reversed CRCs\n"
"\t-g search for alg given hex+crc\t-h | -u | -? show this help\n"
"\t-g search for alg given hex+crc\n"
"\t-h | -u | -? show this help\n"
"Common Use Examples:\n"
"\t reveng -g 01020304e3\n"
"\t Searches for a known/common crc preset that computes the crc\n"
Expand All @@ -625,7 +625,8 @@ usage(void) {
"\t Outputs a list of all known/common crc models with their\n"
"\t preset values\n"
"\n"
"Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 Gregory Cook\n"
"Copyright (C)\n"
"2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 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 "
Expand Down
8 changes: 4 additions & 4 deletions client/reveng/config.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* config.h
* Greg Cook, 7/Feb/2017
* Greg Cook, 26/Jul/2018
*/

/* CRC RevEng: arbitrary-precision CRC calculator and algorithm finder
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
* Gregory Cook
*
* This file is part of CRC RevEng.
Expand Down Expand Up @@ -52,10 +52,10 @@
/* #define BMPMACRO 1 */

/* Some enterprise users may wish to disable the -F switch to minimise CPU
* usage. To do this, define the macro NOFORCE.
* usage. To do this, define the macro ALWPCK.
*/

/* #define NOFORCE 1 */
/* #define ALWPCK 1 */

/* Define PRESETS to compile CRC RevEng with the preset models from the
* CRC Catalogue. This implies BMPMACRO and so makes the code platform-
Expand Down
4 changes: 2 additions & 2 deletions client/reveng/model.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* model.c
* Greg Cook, 19/Feb/2017
* Greg Cook, 26/Jul/2018
*/

/* CRC RevEng: arbitrary-precision CRC calculator and algorithm finder
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
* Gregory Cook
*
* This file is part of CRC RevEng.
Expand Down
12 changes: 7 additions & 5 deletions client/reveng/poly.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* poly.c
* Greg Cook, 7/Feb/2017
* Greg Cook, 26/Jul/2018
*/

/* CRC RevEng: arbitrary-precision CRC calculator and algorithm finder
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
* Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
* Gregory Cook
*
* This file is part of CRC RevEng.
Expand All @@ -22,7 +22,8 @@
* along with CRC RevEng. If not, see <https://www.gnu.org/licenses/>.
*/

/* 2016-06-27: pcmp() shortcut returns 0 when pointers identical
/* 2017-11-28: added braces, redundant statement skipped in prev()
* 2016-06-27: pcmp() shortcut returns 0 when pointers identical
* 2015-07-29: discard leading $, &, 0x from argument to strtop()
* 2015-04-03: added direct mode to strtop()
* 2014-01-11: added LOFS(), RNDUP()
Expand Down Expand Up @@ -807,9 +808,10 @@ prev(poly_t *poly) {
*poly->bitmap = rev(*poly->bitmap >> ofs, (int) poly->length) << ofs;
return;
}

/* claim remaining bits of last word (as we use public function pshift()) */
poly->length = fulllength;
}
/* claim remaining bits of last word (as we use public function pshift()) */
poly->length = fulllength;

/* reverse and swap words in the array, leaving it right-justified */
while(leftidx < rightidx) {
Expand Down
Loading

0 comments on commit 513d0ac

Please sign in to comment.