From b8e461ff615047d6d2bff883167b187d0098de4d Mon Sep 17 00:00:00 2001 From: pwpiwi Date: Mon, 6 Mar 2017 19:22:35 +0100 Subject: [PATCH] Remove local armsrc/stdint.h and fix some other #includes --- armsrc/BigBuf.c | 1 + armsrc/Makefile | 3 --- armsrc/appmain.c | 10 ++++------ armsrc/apps.h | 1 + armsrc/des.c | 2 +- armsrc/epa.c | 4 ++++ armsrc/optimized_cipher.c | 3 +-- armsrc/pcf7931.c | 1 + armsrc/printf.c | 3 --- armsrc/stdint.h | 27 --------------------------- armsrc/string.h | 2 +- include/hitag2.h | 6 ++++++ include/hitagS.h | 6 ++---- 13 files changed, 22 insertions(+), 47 deletions(-) delete mode 100644 armsrc/stdint.h diff --git a/armsrc/BigBuf.c b/armsrc/BigBuf.c index 851cf390..a5fcea7d 100644 --- a/armsrc/BigBuf.c +++ b/armsrc/BigBuf.c @@ -13,6 +13,7 @@ #include "proxmark3.h" #include "apps.h" #include "string.h" +#include "util.h" // BigBuf is the large multi-purpose buffer, typically used to hold A/D samples or traces. // Also used to hold various smaller buffers and the Mifare Emulator Memory. diff --git a/armsrc/Makefile b/armsrc/Makefile index 04ae7a13..2fbad384 100644 --- a/armsrc/Makefile +++ b/armsrc/Makefile @@ -33,9 +33,6 @@ APP_CFLAGS += $(ZLIB_CFLAGS) # zlib includes: APP_CFLAGS += -I../zlib -# stdint.h provided locally until GCC 4.5 becomes C99 compliant -APP_CFLAGS += -I. - # Compile these in thumb mode (small size) THUMBSRC = start.c \ $(SRC_LCD) \ diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 03855172..f4c51e3d 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -10,20 +10,18 @@ // executes. //----------------------------------------------------------------------------- +#include + #include "usb_cdc.h" #include "cmd.h" - #include "proxmark3.h" #include "apps.h" #include "util.h" #include "printf.h" #include "string.h" - -#include - #include "legicrf.h" -#include -#include +#include "hitag2.h" +#include "hitagS.h" #include "lfsampling.h" #include "BigBuf.h" #include "mifareutil.h" diff --git a/armsrc/apps.h b/armsrc/apps.h index 8d51335b..ee638169 100644 --- a/armsrc/apps.h +++ b/armsrc/apps.h @@ -15,6 +15,7 @@ #include #include #include "common.h" +#include "usb_cmd.h" #include "hitag2.h" #include "hitagS.h" #include "mifare.h" diff --git a/armsrc/des.c b/armsrc/des.c index f1aa80da..9bfd1090 100644 --- a/armsrc/des.c +++ b/armsrc/des.c @@ -26,7 +26,7 @@ * */ #include -#include +#include "string.h" const uint8_t sbox[256] = { /* S-box 1 */ diff --git a/armsrc/epa.c b/armsrc/epa.c index 50c7d878..5e69ffa8 100644 --- a/armsrc/epa.c +++ b/armsrc/epa.c @@ -11,10 +11,14 @@ // functions, You need to do the setup before calling them! //----------------------------------------------------------------------------- +#include "apps.h" #include "iso14443a.h" #include "iso14443b.h" #include "epa.h" #include "cmd.h" +#include "fpgaloader.h" +#include "string.h" +#include "util.h" // Protocol and Parameter Selection Request for ISO 14443 type A cards // use regular (1x) speed in both directions diff --git a/armsrc/optimized_cipher.c b/armsrc/optimized_cipher.c index bfaf5088..005f473b 100644 --- a/armsrc/optimized_cipher.c +++ b/armsrc/optimized_cipher.c @@ -61,8 +61,7 @@ **/ #include "optimized_cipher.h" -#include -#include +#include #include #include diff --git a/armsrc/pcf7931.c b/armsrc/pcf7931.c index f9f33c53..e4ba1da5 100644 --- a/armsrc/pcf7931.c +++ b/armsrc/pcf7931.c @@ -2,6 +2,7 @@ #include "apps.h" #include "lfsampling.h" #include "pcf7931.h" +#include "util.h" #include "string.h" #define T0_PCF 8 //period for the pcf7931 in us diff --git a/armsrc/printf.c b/armsrc/printf.c index d5e61798..94ed809d 100644 --- a/armsrc/printf.c +++ b/armsrc/printf.c @@ -40,9 +40,6 @@ #include "util.h" #include "string.h" -typedef uint32_t uintmax_t; -typedef int32_t intmax_t; - typedef unsigned char u_char; typedef unsigned int u_int; typedef unsigned long u_long; diff --git a/armsrc/stdint.h b/armsrc/stdint.h deleted file mode 100644 index 78a0b051..00000000 --- a/armsrc/stdint.h +++ /dev/null @@ -1,27 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (C) 2010 Hector Martin "marcan" -// -// This code is licensed to you under the terms of the GNU GPL, version 2 or, -// at your option, any later version. See the LICENSE.txt file for the text of -// the license. -//----------------------------------------------------------------------------- -// Replacement stdint.h because GCC doesn't come with it yet (C99) -//----------------------------------------------------------------------------- - -#ifndef __STDINT_H -#define __STDINT_H - -typedef signed char int8_t; -typedef short int int16_t; -typedef int int32_t; -typedef long long int int64_t; - -typedef unsigned char uint8_t; -typedef unsigned short int uint16_t; -typedef unsigned int uint32_t; -typedef unsigned long long int uint64_t; - -typedef int intptr_t; -typedef unsigned int uintptr_t; - -#endif /* __STDINT_H */ diff --git a/armsrc/string.h b/armsrc/string.h index a9dbd826..07ac112f 100644 --- a/armsrc/string.h +++ b/armsrc/string.h @@ -13,7 +13,7 @@ #define __STRING_H #include -#include +#include "util.h" int strlen(const char *str); RAMFUNC void *memcpy(void *dest, const void *src, int len); diff --git a/include/hitag2.h b/include/hitag2.h index 00447623..66770d98 100644 --- a/include/hitag2.h +++ b/include/hitag2.h @@ -13,6 +13,12 @@ #ifndef _HITAG2_H_ #define _HITAG2_H_ +#ifdef _MSC_VER +#define PACKED +#else +#define PACKED __attribute__((packed)) +#endif + typedef enum { RHTSF_CHALLENGE = 01, RHTSF_KEY = 02, diff --git a/include/hitagS.h b/include/hitagS.h index 351ca86c..e447714b 100644 --- a/include/hitagS.h +++ b/include/hitagS.h @@ -10,13 +10,11 @@ //----------------------------------------------------------------------------- -#include -#include -#include - #ifndef _HITAGS_H_ #define _HITAGS_H_ +#include "hitag2.h" + typedef enum PROTO_STATE {READY=0,INIT,AUTHENTICATE,SELECTED,QUIET,TTF,FAIL} PSTATE; //protocol-state typedef enum TAG_STATE {NO_OP=0,READING_PAGE,WRITING_PAGE_ACK,WRITING_PAGE_DATA,WRITING_BLOCK_DATA} TSATE; //tag-state typedef enum SOF_TYPE {STANDARD=0,ADVANCED,FAST_ADVANCED,ONE,NO_BITS} stype; //number of start-of-frame bits -- 2.39.5