From: iceman1001 Date: Tue, 24 Jan 2017 23:35:11 +0000 (+0100) Subject: CHG: moved into header files. X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/e36b07efc45a3052cebd0b133f90aab4cc278ec3 CHG: moved into header files. --- diff --git a/common/crc.h b/common/crc.h index 56f04357..22b703fe 100644 --- a/common/crc.h +++ b/common/crc.h @@ -9,9 +9,7 @@ #ifndef __CRC_H #define __CRC_H -#include //uint32+ -#include //bool -#include +#include "common.h" //stdint, stddef, stdbool #include "util.h" // reflect, bswap_16 typedef struct crc { diff --git a/common/crc16.h b/common/crc16.h index 3db2cd79..645a5acf 100644 --- a/common/crc16.h +++ b/common/crc16.h @@ -9,7 +9,7 @@ #define __CRC16_H #include -#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); diff --git a/common/crc32.c b/common/crc32.c index bdf7b230..176c3c8f 100644 --- a/common/crc32.c +++ b/common/crc32.c @@ -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 diff --git a/common/crc32.h b/common/crc32.h index 8876dc96..a21b741e 100644 --- a/common/crc32.h +++ b/common/crc32.h @@ -12,12 +12,11 @@ #include #include - #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 diff --git a/common/desfire.h b/common/desfire.h index 42343638..a2b0599e 100644 --- a/common/desfire.h +++ b/common/desfire.h @@ -4,6 +4,7 @@ #include #include #include "aes.h" +#include "mifare.h" #define MAX_CRYPTO_BLOCK_SIZE 16 /* Mifare DESFire EV1 Application crypto operations */ diff --git a/common/parity.c b/common/parity.c index b783b1e9..66fcc558 100644 --- a/common/parity.c +++ b/common/parity.c @@ -5,8 +5,7 @@ //----------------------------------------------------------------------------- // parity functions //----------------------------------------------------------------------------- - -#include +#include 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 }; - diff --git a/common/parity.h b/common/parity.h index 79b8221d..8e2f097c 100644 --- a/common/parity.h +++ b/common/parity.h @@ -9,24 +9,25 @@ #ifndef __PARITY_H #define __PARITY_H +#ifdef __cplusplus +extern "C" { +#endif + #include 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 */