]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/mifareutil.c
fix: prevent hf mf mifare from always running twice
[proxmark3-svn] / armsrc / mifareutil.c
index e5ef6c19b112d7082fb1e333d39b3881d2fe5699..38ca934aa01687b542744965981e6eae886a6a1a 100644 (file)
@@ -9,13 +9,15 @@
 // Work with mifare cards.\r
 //-----------------------------------------------------------------------------\r
 \r
-#include <string.h>\r
 #include "mifareutil.h"\r
+\r
+#include <string.h>\r
+#include <stdbool.h>\r
+\r
 #include "proxmark3.h"\r
 #include "apps.h"\r
 #include "util.h"\r
 #include "parity.h"\r
-\r
 #include "iso14443crc.h"\r
 #include "iso14443a.h"\r
 #include "crapto1/crapto1.h"\r
@@ -585,6 +587,19 @@ uint8_t FirstBlockOfSector(uint8_t sectorNo)
                \r
 }\r
 \r
+uint8_t SectorTrailer(uint8_t blockNo)\r
+{\r
+       if (blockNo < 32*4) {\r
+               return (blockNo | 0x03);\r
+       } else {\r
+               return (blockNo | 0x0f);\r
+       }\r
+}\r
+\r
+bool IsSectorTrailer(uint8_t blockNo)\r
+{\r
+       return (blockNo == SectorTrailer(blockNo));\r
+}\r
 \r
 // work with emulator memory\r
 void emlSetMem(uint8_t *data, int blockNum, int blocksCount) {\r
Impressum, Datenschutz