From f6e01a34931850973012854318ac25a8cf623f06 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 7 Oct 2016 00:14:02 +0200 Subject: [PATCH 1/1] Renamed the calccrc8 functions and command. --- client/cmdhflegic.c | 22 +++++++++------------- client/cmdhflegic.h | 6 ++---- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/client/cmdhflegic.c b/client/cmdhflegic.c index c2db8682..3ee6c5d5 100644 --- a/client/cmdhflegic.c +++ b/client/cmdhflegic.c @@ -13,10 +13,10 @@ static int CmdHelp(const char *Cmd); #define MAX_LENGTH 1024 -int usage_legic_calccrc8(void){ +int usage_legic_calccrc(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 c "); + PrintAndLog("Usage: hf legic crc [h] b u c "); PrintAndLog("Options:"); PrintAndLog(" h : this help"); PrintAndLog(" b : hex bytes"); @@ -24,8 +24,8 @@ int usage_legic_calccrc8(void){ PrintAndLog(" c : 8|16 bit crc size"); PrintAndLog(""); PrintAndLog("Samples:"); - PrintAndLog(" hf legic crc8 b deadbeef1122"); - PrintAndLog(" hf legic crc8 b deadbeef1122 u 9A c 16"); + PrintAndLog(" hf legic crc b deadbeef1122"); + PrintAndLog(" hf legic crc b deadbeef1122 u 9A c 16"); return 0; } int usage_legic_load(void){ @@ -687,6 +687,7 @@ int CmdLegicRfWrite(const char *Cmd) { return 0; } +/* int CmdLegicRfRawWrite(const char *Cmd) { PrintAndLog("############# DANGER !! #############"); PrintAndLog("# changing the DCF is irreversible #"); @@ -697,11 +698,9 @@ int CmdLegicRfRawWrite(const char *Cmd) { // } return 0; } +*/ -void static calc4(uint8_t *cmd, uint8_t len){ -} - -int CmdLegicCalcCrc8(const char *Cmd){ +int CmdLegicCalcCrc(const char *Cmd){ uint8_t *data = NULL; uint8_t cmdp = 0, uidcrc = 0, type=0; @@ -771,16 +770,13 @@ int CmdLegicCalcCrc8(const char *Cmd){ //Validations if (errors){ if (data) free(data); - return usage_legic_calccrc8(); + return usage_legic_calccrc(); } switch (type){ case 16: PrintAndLog("Legic crc16: %X", CRC16Legic(data, len, uidcrc)); break; - case 4: - calc4(data, 0); - break; default: PrintAndLog("Legic crc8: %X", CRC8Legic(data, len) ); break; @@ -1105,7 +1101,7 @@ static command_t CommandTable[] = { {"load", CmdLegicLoad, 0, " -- Restore samples"}, {"sim", CmdLegicRfSim, 0, "[phase drift [frame drift [req/resp drift]]] Start tag simulator (use after load or read)"}, {"write", CmdLegicRfWrite, 0, " -- Write sample buffer (user after load or read)"}, - {"crc8", CmdLegicCalcCrc8, 1, "Calculate Legic CRC8 over given hexbytes"}, + {"crc", CmdLegicCalcCrc, 1, "Calculate Legic CRC over given hexbytes"}, {"eload", CmdLegicELoad, 1, "Load binary dump to emulator memory"}, {"esave", CmdLegicESave, 1, "Save emulator memory to binary file"}, {NULL, NULL, 0, NULL} diff --git a/client/cmdhflegic.h b/client/cmdhflegic.h index 741766e9..e7a4c9cd 100644 --- a/client/cmdhflegic.h +++ b/client/cmdhflegic.h @@ -31,11 +31,9 @@ int CmdLegicLoad(const char *Cmd); int CmdLegicSave(const char *Cmd); int CmdLegicRfSim(const char *Cmd); int CmdLegicRfWrite(const char *Cmd); -int CmdLegicRfRawWrite(const char *Cmd); -int CmdLegicCalcCrc8(const char *Cmd); +int CmdLegicCalcCrc(const char *Cmd); int CmdLegicDump(const char *Cmd); int CmdLegicReader(const char *Cmd); - int CmdLegicELoad(const char *Cmd); int CmdLegicESave(const char *Cmd); @@ -45,7 +43,7 @@ int legic_get_type(legic_card_select_t *card); void legic_chk_iv(uint32_t *iv); void legic_seteml(uint8_t *src, uint32_t offset, uint32_t numofbytes); -int usage_legic_calccrc8(void); +int usage_legic_calccrc(void); int usage_legic_load(void); int usage_legic_rdmem(void); int usage_legic_sim(void); -- 2.39.5