diff --git a/src/config.h b/src/config.h index 3486f29..41ba711 100644 --- a/src/config.h +++ b/src/config.h @@ -22,8 +22,6 @@ #define ENDIANNESS_PORTABLE_CONVERSION #include "endianness.h" -typedef unsigned char uint8_t; - #include "mbedtls/md_internal.h" #include "mbedtls/sha256.h" diff --git a/src/pixiewps.c b/src/pixiewps.c index 7d7a2a2..25eed09 100644 --- a/src/pixiewps.c +++ b/src/pixiewps.c @@ -265,7 +265,7 @@ static void init_crack_jobs(struct global *wps, int mode) uint32_t curr = (mode == RTL819x) ? wps->start : 0; int32_t add = (mode == RTL819x) ? -SEEDS_PER_JOB_BLOCK : SEEDS_PER_JOB_BLOCK; for (i = 0; i < wps->jobs; i++) { - job_control.crack_jobs[i].start = (mode == -RTL819x) ? i + 1 : curr; + job_control.crack_jobs[i].start = (mode == -RTL819x) ? (uint32_t)i + 1 : curr; setup_thread(i); curr += add; } @@ -1482,12 +1482,12 @@ static int int_pow(int a, int exp) } /* return non-zero if pin half is correct, zero otherwise */ -static int check_pin_half(const uint8_t pinhalf[4], uint8_t *psk, const uint8_t *es, struct global *wps, const uint8_t *ehash) +static int check_pin_half(const char pinhalf[4], uint8_t *psk, const uint8_t *es, struct global *wps, const uint8_t *ehash) { uint8_t buffer[WPS_SECRET_NONCE_LEN + WPS_PSK_LEN + WPS_PKEY_LEN * 2]; uint8_t result[WPS_HASH_LEN]; - hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, pinhalf, 4, psk); + hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, (unsigned char *)pinhalf, 4, psk); memcpy(buffer, es, WPS_SECRET_NONCE_LEN); memcpy(buffer + WPS_SECRET_NONCE_LEN, psk, WPS_PSK_LEN); memcpy(buffer + WPS_SECRET_NONCE_LEN + WPS_PSK_LEN, wps->pke, WPS_PKEY_LEN); diff --git a/src/pixiewps.h b/src/pixiewps.h index 59a8260..80b3d02 100644 --- a/src/pixiewps.h +++ b/src/pixiewps.h @@ -87,7 +87,7 @@ const uint8_t rtl_rnd_seed[] = { }; struct global { - uint8_t pin[WPS_PIN_LEN + 1]; + char pin[WPS_PIN_LEN + 1]; uint8_t *pke; uint8_t *pkr; uint8_t *e_key; diff --git a/src/utils.h b/src/utils.h index 5dfd61e..559b93d 100644 --- a/src/utils.h +++ b/src/utils.h @@ -128,7 +128,7 @@ int get_int(char *in, int *out) unsigned int bit_revert(unsigned int v) { - int i; + size_t i; unsigned int lsb, n = 0; for (i = 0; i < sizeof(unsigned int) * 8; i++) { lsb = v & 1; @@ -241,7 +241,7 @@ unsigned long get_elapsed_ms(struct timeval *start, struct timeval *end) } /* Converts an unsigned integer to a char array without termination */ -static inline void uint_to_char_array(unsigned int num, unsigned int len, uint8_t *dst) +static inline void uint_to_char_array(unsigned int num, unsigned int len, char *dst) { unsigned int mul = 1; while (len--) {