diff --git a/src/Makefile b/src/Makefile index 1e77905..3197710 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,4 +1,4 @@ -CCFLAGS = -std=c99 -O3 +CCFLAGS = -std=c99 -O3 -Wno-error=deprecated-declarations LDFLAGS = -lcrypto -I../include TARGET = pixiewps @@ -6,7 +6,7 @@ PREFIX = $(DESTDIR)/usr BINDIR = $(PREFIX)/bin all: - $(CC) $(CCFLAGS) -o $(TARGET) $(TARGET).c random_r.c $(LDFLAGS) + $(CC) $(CCFLAGS) -o $(TARGET) $(TARGET).c $(LDFLAGS) install: install -D $(TARGET) $(BINDIR)/$(TARGET) diff --git a/src/pixiewps.c b/src/pixiewps.c index 6eddd71..24073ca 100644 --- a/src/pixiewps.c +++ b/src/pixiewps.c @@ -47,9 +47,9 @@ #include #ifdef __MACH__ -#include +# include #else -#include +# include #endif /* __MACH__ */ #include "pixiewps.h" @@ -423,11 +423,11 @@ int main(int argc, char **argv) { srandom_r(print_seed + 1, buf); for (int i = 0; i < 4; i++) { random_r(buf, &res); -#ifdef __MACH__ - uint32_t be = OSSwapBigToHostInt32(res); -#else - uint32_t be = __be32_to_cpu(res); -#endif + #ifdef __MACH__ + uint32_t be = OSSwapBigToHostInt32(res); + #else + uint32_t be = __be32_to_cpu(res); + #endif memcpy(&(wps->e_s1[4 * i]), &be, 4); memcpy(wps->e_s2, wps->e_s1, WPS_SECRET_NONCE_LEN); /* E-S1 = E-S2 != E-Nonce */ } diff --git a/src/pixiewps.h b/src/pixiewps.h index b7b4f5c..78be226 100644 --- a/src/pixiewps.h +++ b/src/pixiewps.h @@ -37,8 +37,8 @@ * files in the program, then also delete it here. */ -#ifndef _PIXIEWPS_H -#define _PIXIEWPS_H +#ifndef PIXIEWPS_H +#define PIXIEWPS_H #define VERSION "1.1" #define MAX_MODE 4 @@ -155,18 +155,18 @@ void kdf(unsigned char *key, size_t key_len, unsigned char *res) { unsigned char *buffer = malloc(WPS_KDF_SALT_LEN + 4 * 2); for (i = 1; i < 4; i++) { -#ifdef __MACH__ - uint32_t be = OSSwapBigToHostInt32(i); -#else - uint32_t be = __be32_to_cpu(i); -#endif + #ifdef __MACH__ + uint32_t be = OSSwapBigToHostInt32(i); + #else + uint32_t be = __be32_to_cpu(i); + #endif memcpy(buffer, &be, 4); memcpy(buffer + 4, salt, WPS_KDF_SALT_LEN); -#ifdef __MACH__ - be = OSSwapBigToHostInt32(kdk_len); -#else - be = __be32_to_cpu(kdk_len); -#endif + #ifdef __MACH__ + be = OSSwapBigToHostInt32(kdk_len); + #else + be = __be32_to_cpu(kdk_len); + #endif memcpy(buffer + 4 + 36, &be, 4); hmac_sha256(key, WPS_HASH_LEN, buffer, WPS_KDF_SALT_LEN + 4 * 2, res + j); j += WPS_HASH_LEN; @@ -191,4 +191,4 @@ unsigned int wps_pin_valid(unsigned int pin) { return wps_pin_checksum(pin / 10) == (pin % 10); } -#endif /* _PIXIEWPS_H */ +#endif /* PIXIEWPS_H */ diff --git a/src/random_r.h b/src/random_r.h index 3c3dc0a..0431ddd 100644 --- a/src/random_r.h +++ b/src/random_r.h @@ -37,8 +37,8 @@ * files in the program, then also delete it here. */ -#ifndef _RANDOM_R_H -#define _RANDOM_R_H +#ifndef RANDOM_R_H +#define RANDOM_R_H #include @@ -57,4 +57,4 @@ int srandom_r(unsigned int seed, struct random_data *buf); int initstate_r(unsigned int seed, char *arg_state, size_t n, struct random_data *buf); int setstate_r(char *arg_state, struct random_data *buf); -#endif /* _RANDOM_R_H */ +#endif /* RANDOM_R_H */ diff --git a/src/utils.h b/src/utils.h index f2f7686..9dd6f92 100644 --- a/src/utils.h +++ b/src/utils.h @@ -37,8 +37,8 @@ * files in the program, then also delete it here. */ -#ifndef _UTILS_H -#define _UTILS_H +#ifndef UTILS_H +#define UTILS_H /* Converts an hex string to a byte array */ int hex_string_to_byte_array(char *in, unsigned char *out, int n_len) { @@ -106,4 +106,4 @@ void byte_array_print(unsigned char *buffer, unsigned int length) { } } -#endif /* _UTILS_H */ +#endif /* UTILS_H */