From 514ddaa2ff936ded76554a2ad97f6fe978c6f86e Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 29 Jul 2016 20:58:52 +0200 Subject: [PATCH] CHG: help text changes in cmdlfjablotron.c CHG: increase byte size to uint16_t in crc.c CRC16Legic --- client/cmdhflegic.c | 20 ++++++++++++-------- client/cmdlfjablotron.c | 4 ++-- common/crc.c | 4 ++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/client/cmdhflegic.c b/client/cmdhflegic.c index 838a41a2..ec870b90 100644 --- a/client/cmdhflegic.c +++ b/client/cmdhflegic.c @@ -14,32 +14,36 @@ static int CmdHelp(const char *Cmd); int usage_legic_calccrc8(void){ PrintAndLog("Calculates the legic crc8/crc16 on the input hexbytes."); PrintAndLog("There must be an even number of hexsymbols as input."); - PrintAndLog("Usage: hf legic crc8 [h] b u "); - PrintAndLog("Options :"); + PrintAndLog("Usage: hf legic crc8 [h] b u c "); + PrintAndLog("Options:"); PrintAndLog(" b : hex bytes"); PrintAndLog(" u : MCC hexbyte"); + PrintAndLog(" c : 8|16 bit crc size"); PrintAndLog(""); - PrintAndLog("Samples :"); + PrintAndLog("Samples:"); PrintAndLog(" hf legic crc8 b deadbeef1122"); - PrintAndLog(" hf legic crc8 b deadbeef1122 u 9A"); + PrintAndLog(" hf legic crc8 b deadbeef1122 u 9A c 16"); return 0; } int usage_legic_load(void){ PrintAndLog("It loads datasamples from the file `filename` to device memory"); PrintAndLog("Usage: hf legic load "); - PrintAndLog(" sample: hf legic load filename"); + PrintAndLog(""); + PrintAndLog("Samples:"); + PrintAndLog(" hf legic load filename"); return 0; } int usage_legic_read(void){ PrintAndLog("Read data from a legic tag."); PrintAndLog("Usage: hf legic read "); - PrintAndLog("Options :"); + PrintAndLog("Options:"); PrintAndLog(" : offset in data array to start download from"); PrintAndLog(" : number of bytes to download"); PrintAndLog(""); - PrintAndLog(" sample: hf legic read"); + PrintAndLog("Samples:"); + PrintAndLog(" hf legic read"); return 0; } @@ -621,7 +625,7 @@ int CmdLegicCalcCrc8(const char *Cmd){ break; } - free(data); + if (data != NULL) free(data); return 0; } diff --git a/client/cmdlfjablotron.c b/client/cmdlfjablotron.c index 3c5edd39..bbe39a52 100644 --- a/client/cmdlfjablotron.c +++ b/client/cmdlfjablotron.c @@ -18,7 +18,7 @@ int usage_lf_jablotron_clone(void){ PrintAndLog(" : jablotron card ID"); PrintAndLog(" : specify write to Q5 (t5555 instead of t55x7)"); PrintAndLog(""); - PrintAndLog("Sample: lf jablotron clone d 112233"); + PrintAndLog("Sample: lf jablotron clone 112233"); return 0; } @@ -31,7 +31,7 @@ int usage_lf_jablotron_sim(void) { PrintAndLog(" h : This help"); PrintAndLog(" : jablotron card ID"); PrintAndLog(""); - PrintAndLog("Sample: lf jablotron sim d 112233"); + PrintAndLog("Sample: lf jablotron sim 112233"); return 0; } diff --git a/common/crc.c b/common/crc.c index 311a676c..0425a4fd 100644 --- a/common/crc.c +++ b/common/crc.c @@ -99,8 +99,8 @@ uint32_t CRC8Legic(uint8_t *buff, size_t size) { uint32_t CRC16Legic(uint8_t *buff, size_t size, uint8_t uidcrc) { #define CRC16_POLY_LEGIC 0xB400 - //uint8_t initial = reflect(uidcrc, 8); - uint16_t initial = uidcrc; + uint16_t initial = reflect(uidcrc, 8); + //uint16_t initial = uidcrc; initial |= initial << 8; crc_t crc; crc_init_ref(&crc, 16, CRC16_POLY_LEGIC, initial, 0, TRUE, TRUE); -- 2.39.2