From: Merlokbr@gmail.com Date: Tue, 17 Jul 2012 11:41:56 +0000 (+0000) Subject: `hf mf sniff` added CRC_14443_A check X-Git-Tag: v1.0.0~159 X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/8b6a93df9152de16e16fd4158775954228245613 `hf mf sniff` added CRC_14443_A check --- diff --git a/client/mifarehost.c b/client/mifarehost.c index fc29e10e..70d2413a 100644 --- a/client/mifarehost.c +++ b/client/mifarehost.c @@ -419,7 +419,13 @@ int mfTraceDecode(uint8_t *data_src, int len, bool wantSaveToEmlFile) { switch (traceState) { case TRACE_IDLE: - // TODO: check packet crc16! + // check packet crc16! + if ((len >= 4) && (!CheckCrc14443(CRC_14443_A, data, len))) { + PrintAndLog("dec> CRC ERROR!!!"); + AddLogLine(logHexFileName, "dec> ", "CRC ERROR!!!"); + traceState = TRACE_ERROR; // do not decrypt the next commands + return 1; + } // AUTHENTICATION if ((len ==4) && ((data[0] == 0x60) || (data[0] == 0x61))) { diff --git a/client/mifarehost.h b/client/mifarehost.h index 64fc9339..d74f3f0e 100644 --- a/client/mifarehost.h +++ b/client/mifarehost.h @@ -19,6 +19,7 @@ #include "util.h" #include "nonce2key/nonce2key.h" #include "nonce2key/crapto1.h" +#include "iso14443crc.h" #define MEM_CHUNK 1000000 #define NESTED_SECTOR_RETRY 10