]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - common/iso14443crc.c
chg: minor spelling change from MIFARE_ULEV1_VERS -> MIFARE_ULEV1_VERSION
[proxmark3-svn] / common / iso14443crc.c
index b5ffc92d7a46614dec7b7bd2b427937aabb7f2ac..851546ae239df0d728ecd73bf0367fae1c82e0fe 100644 (file)
@@ -6,7 +6,7 @@
 // ISO14443 CRC calculation code.
 //-----------------------------------------------------------------------------
 
-#include "iso14443crc.h"
+#include "../common/iso14443crc.h"
 
 static unsigned short UpdateCrc14443(unsigned char ch, unsigned short *lpwCrc)
 {
@@ -18,7 +18,7 @@ static unsigned short UpdateCrc14443(unsigned char ch, unsigned short *lpwCrc)
 }
 
 void ComputeCrc14443(int CrcType,
-                     unsigned char *Data, int Length,
+                     const unsigned char *Data, int Length,
                      unsigned char *TransmitFirst,
                      unsigned char *TransmitSecond)
 {
@@ -37,3 +37,12 @@ void ComputeCrc14443(int CrcType,
     *TransmitSecond = (unsigned char) ((wCrc >> 8) & 0xFF);
     return;
 }
+
+int CheckCrc14443(int CrcType, const unsigned char *Data, int Length) {
+       unsigned char b1;
+       unsigned char b2;
+       if (Length < 3) return 0;
+       ComputeCrc14443(CrcType, Data, Length - 2, &b1, &b2);
+       if ((b1 == Data[Length - 2]) && (b2 == Data[Length - 1])) return 1;
+       return 0;
+}
Impressum, Datenschutz