]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
CHG: moved into header files.
authoriceman1001 <iceman@iuse.se>
Tue, 24 Jan 2017 23:35:11 +0000 (00:35 +0100)
committericeman1001 <iceman@iuse.se>
Tue, 24 Jan 2017 23:35:11 +0000 (00:35 +0100)
common/crc.h
common/crc16.h
common/crc32.c
common/crc32.h
common/desfire.h
common/parity.c
common/parity.h

index 56f0435794cc1460df09accdd899dde18340641b..22b703fe5be44f9eee48c30ef25621fffbe62afe 100644 (file)
@@ -9,9 +9,7 @@
 #ifndef __CRC_H
 #define __CRC_H
 
-#include <stdint.h>            //uint32+
-#include <stdbool.h>   //bool
-#include <stddef.h>
+#include "common.h"    //stdint, stddef, stdbool
 #include "util.h"      // reflect, bswap_16
 
 typedef struct crc {
index 3db2cd798b0e28a6f5085e91db3546a2d3c00677..645a5acfc09c36cb33dbe308243df138099572a1 100644 (file)
@@ -9,7 +9,7 @@
 #define __CRC16_H
 
 #include <stdint.h>
-#include "util.h"
+#include "util.h"   // SwapBits
 
 unsigned short update_crc16(unsigned short crc, unsigned char c);
 uint16_t crc16(uint8_t const *message, int length, uint16_t remainder, uint16_t polynomial);
index bdf7b230f8d8e6a2db73c65db2c22c5dee33fa3a..176c3c8f0e7aeab54c4754482c888775901748aa 100644 (file)
@@ -18,7 +18,7 @@ static void crc32_byte (uint32_t *crc, const uint8_t value) {
     }
 }
 
-void crc32 (const uint8_t *data, const size_t len, uint8_t *crc) {
+void crc32_ex (const uint8_t *data, const size_t len, uint8_t *crc) {
     uint32_t desfire_crc = CRC32_PRESET;
     for (size_t i = 0; i < len; i++) {
         crc32_byte (&desfire_crc, data[i]);
@@ -28,5 +28,5 @@ void crc32 (const uint8_t *data, const size_t len, uint8_t *crc) {
 }
 
 void crc32_append (uint8_t *data, const size_t len) {
-    crc32 (data, len, data + len);
+    crc32_ex (data, len, data + len);
 }
\ No newline at end of file
index 8876dc9646009a88e11dc123c0b57c6c15c0b476..a21b741e3ac0f559a989deb9906c215e58ed9a58 100644 (file)
 #include <stdint.h>
 #include <stddef.h>
 
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void crc32 (const uint8_t *data, const size_t len, uint8_t *crc);
+void crc32_ex(const uint8_t *data, const size_t len, uint8_t *crc);
 void crc32_append (uint8_t *data, const size_t len);
 
 #ifdef __cplusplus
index 423436383535c601610e72489aea0524a921c91d..a2b0599e949891557f14284e4d20332f961e05dc 100644 (file)
@@ -4,6 +4,7 @@
 #include <string.h>
 #include <stdarg.h>
 #include "aes.h"
+#include "mifare.h"
 
 #define MAX_CRYPTO_BLOCK_SIZE 16
 /* Mifare DESFire EV1 Application crypto operations */
index b783b1e962af49e5f9803c7a348aacd84c2f93ad..66fcc55867fd532dfc5af1caa1a115cc6403a593 100644 (file)
@@ -5,8 +5,7 @@
 //-----------------------------------------------------------------------------
 // parity functions
 //-----------------------------------------------------------------------------
-
-#include <stdint.h>
+#include <parity.h>
 
 const uint8_t OddByteParity[256] = {
   1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
@@ -45,5 +44,4 @@ const uint8_t EvenByteParity[256] = {
   1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
   0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0
 };
-       
 
index 79b8221dc5445293da85141b98a6e2623e6faf92..8e2f097c274e9bb32f50826cb16e202ab294c0b2 100644 (file)
@@ -9,24 +9,25 @@
 #ifndef __PARITY_H
 #define __PARITY_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <stdint.h>
 
 extern const uint8_t OddByteParity[256];
+extern const uint8_t EvenByteParity[256];
 
 static inline uint8_t oddparity8(uint8_t bt)
 {
        return OddByteParity[bt];
 }
 
-
-extern const uint8_t EvenByteParity[256];
-
 static inline uint8_t evenparity8(const uint8_t bt)
 {
        return EvenByteParity[bt];
 }
 
-
 static inline uint8_t evenparity32(uint32_t x) 
 {
        x ^= x >> 16;
@@ -34,5 +35,8 @@ static inline uint8_t evenparity32(uint32_t x)
        return EvenByteParity[x & 0xff];
 }
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* __PARITY_H */
Impressum, Datenschutz