mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
stricter warnings, wip
This commit is contained in:
parent
0cb21c89c3
commit
0e39cb8e34
11 changed files with 20 additions and 16 deletions
|
@ -15,7 +15,8 @@ ifeq ($(DEFSBEENHERE),)
|
||||||
$(error Can't find Makefile.defs)
|
$(error Can't find Makefile.defs)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS ?= -Wall -Werror -O3
|
CFLAGS ?= -Wall -Werror -O3 -Wchar-subscripts -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wunused -Wuninitialized -Wpointer-arith -Wredundant-decls -Winline -Wformat -Wformat-security -Winit-self -Wmissing-include-dirs -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wmissing-declarations
|
||||||
|
# -Wbad-function-cast -Wextra -Wswitch-enum -Wold-style-definition
|
||||||
CFLAGS += $(MYDEFS) $(MYCFLAGS) $(MYINCLUDES)
|
CFLAGS += $(MYDEFS) $(MYCFLAGS) $(MYINCLUDES)
|
||||||
|
|
||||||
vpath %.c $(MYSRCPATHS)
|
vpath %.c $(MYSRCPATHS)
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#define HMAC_POS_DATA 0x008
|
#define HMAC_POS_DATA 0x008
|
||||||
#define HMAC_POS_TAG 0x1B4
|
#define HMAC_POS_TAG 0x1B4
|
||||||
|
|
||||||
void nfc3d_amiibo_calc_seed(const uint8_t *dump, uint8_t *key) {
|
static void nfc3d_amiibo_calc_seed(const uint8_t *dump, uint8_t *key) {
|
||||||
memcpy(key + 0x00, dump + 0x029, 0x02);
|
memcpy(key + 0x00, dump + 0x029, 0x02);
|
||||||
memset(key + 0x02, 0x00, 0x0E);
|
memset(key + 0x02, 0x00, 0x0E);
|
||||||
memcpy(key + 0x10, dump + 0x1D4, 0x08);
|
memcpy(key + 0x10, dump + 0x1D4, 0x08);
|
||||||
|
@ -21,14 +21,14 @@ void nfc3d_amiibo_calc_seed(const uint8_t *dump, uint8_t *key) {
|
||||||
memcpy(key + 0x20, dump + 0x1E8, 0x20);
|
memcpy(key + 0x20, dump + 0x1E8, 0x20);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nfc3d_amiibo_keygen(const nfc3d_keygen_masterkeys *masterKeys, const uint8_t *dump, nfc3d_keygen_derivedkeys *derivedKeys) {
|
static void nfc3d_amiibo_keygen(const nfc3d_keygen_masterkeys *masterKeys, const uint8_t *dump, nfc3d_keygen_derivedkeys *derivedKeys) {
|
||||||
uint8_t seed[NFC3D_KEYGEN_SEED_SIZE];
|
uint8_t seed[NFC3D_KEYGEN_SEED_SIZE];
|
||||||
|
|
||||||
nfc3d_amiibo_calc_seed(dump, seed);
|
nfc3d_amiibo_calc_seed(dump, seed);
|
||||||
nfc3d_keygen(masterKeys, seed, derivedKeys);
|
nfc3d_keygen(masterKeys, seed, derivedKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nfc3d_amiibo_cipher(const nfc3d_keygen_derivedkeys *keys, const uint8_t *in, uint8_t *out) {
|
static void nfc3d_amiibo_cipher(const nfc3d_keygen_derivedkeys *keys, const uint8_t *in, uint8_t *out) {
|
||||||
mbedtls_aes_context aes;
|
mbedtls_aes_context aes;
|
||||||
size_t nc_off = 0;
|
size_t nc_off = 0;
|
||||||
unsigned char nonce_counter[16];
|
unsigned char nonce_counter[16];
|
||||||
|
@ -47,7 +47,7 @@ void nfc3d_amiibo_cipher(const nfc3d_keygen_derivedkeys *keys, const uint8_t *in
|
||||||
memcpy(out + 0x1D4, in + 0x1D4, 0x034);
|
memcpy(out + 0x1D4, in + 0x1D4, 0x034);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nfc3d_amiibo_tag_to_internal(const uint8_t *tag, uint8_t *intl) {
|
static void nfc3d_amiibo_tag_to_internal(const uint8_t *tag, uint8_t *intl) {
|
||||||
memcpy(intl + 0x000, tag + 0x008, 0x008);
|
memcpy(intl + 0x000, tag + 0x008, 0x008);
|
||||||
memcpy(intl + 0x008, tag + 0x080, 0x020);
|
memcpy(intl + 0x008, tag + 0x080, 0x020);
|
||||||
memcpy(intl + 0x028, tag + 0x010, 0x024);
|
memcpy(intl + 0x028, tag + 0x010, 0x024);
|
||||||
|
@ -57,7 +57,7 @@ void nfc3d_amiibo_tag_to_internal(const uint8_t *tag, uint8_t *intl) {
|
||||||
memcpy(intl + 0x1DC, tag + 0x054, 0x02C);
|
memcpy(intl + 0x1DC, tag + 0x054, 0x02C);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nfc3d_amiibo_internal_to_tag(const uint8_t *intl, uint8_t *tag) {
|
static void nfc3d_amiibo_internal_to_tag(const uint8_t *intl, uint8_t *tag) {
|
||||||
memcpy(tag + 0x008, intl + 0x000, 0x008);
|
memcpy(tag + 0x008, intl + 0x000, 0x008);
|
||||||
memcpy(tag + 0x080, intl + 0x008, 0x020);
|
memcpy(tag + 0x080, intl + 0x008, 0x020);
|
||||||
memcpy(tag + 0x010, intl + 0x028, 0x024);
|
memcpy(tag + 0x010, intl + 0x028, 0x024);
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
void nfc3d_keygen_prepare_seed(const nfc3d_keygen_masterkeys *baseKeys, const uint8_t *baseSeed, uint8_t *output, size_t *outputSize) {
|
static void nfc3d_keygen_prepare_seed(const nfc3d_keygen_masterkeys *baseKeys, const uint8_t *baseSeed, uint8_t *output, size_t *outputSize) {
|
||||||
assert(baseKeys != NULL);
|
assert(baseKeys != NULL);
|
||||||
assert(baseSeed != NULL);
|
assert(baseSeed != NULL);
|
||||||
assert(output != NULL);
|
assert(output != NULL);
|
||||||
|
|
|
@ -556,7 +556,7 @@ void SetSIMDInstr(SIMDExecInstr instr) {
|
||||||
bitslice_test_nonces_function_p = &bitslice_test_nonces_dispatch;
|
bitslice_test_nonces_function_p = &bitslice_test_nonces_dispatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SIMDExecInstr GetSIMDInstr() {
|
static SIMDExecInstr GetSIMDInstr(void) {
|
||||||
SIMDExecInstr instr = SIMD_NONE;
|
SIMDExecInstr instr = SIMD_NONE;
|
||||||
|
|
||||||
#if defined (__i386__) || defined (__x86_64__)
|
#if defined (__i386__) || defined (__x86_64__)
|
||||||
|
@ -578,7 +578,7 @@ static SIMDExecInstr GetSIMDInstr() {
|
||||||
return instr;
|
return instr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SIMDExecInstr GetSIMDInstrAuto() {
|
SIMDExecInstr GetSIMDInstrAuto(void) {
|
||||||
SIMDExecInstr instr = intSIMDInstr;
|
SIMDExecInstr instr = intSIMDInstr;
|
||||||
if (instr == SIMD_AUTO)
|
if (instr == SIMD_AUTO)
|
||||||
return GetSIMDInstr();
|
return GetSIMDInstr();
|
||||||
|
|
|
@ -433,7 +433,7 @@ static bool read_bench_data(statelist_t *test_candidates) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float brute_force_benchmark() {
|
float brute_force_benchmark(void) {
|
||||||
statelist_t test_candidates[NUM_BRUTE_FORCE_THREADS];
|
statelist_t test_candidates[NUM_BRUTE_FORCE_THREADS];
|
||||||
|
|
||||||
test_candidates[0].states[ODD_STATE] = malloc((TEST_BENCH_SIZE + 1) * sizeof(uint32_t));
|
test_candidates[0].states[ODD_STATE] = malloc((TEST_BENCH_SIZE + 1) * sizeof(uint32_t));
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
* it under the terms of the MIT license. See LICENSE for details.
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <jansson_private_config.h>
|
#include <jansson_private_config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#if HAVE_STDINT_H
|
#ifdef HAVE_STDINT_H
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ static int seed_from_timestamp_and_pid(uint32_t *seed) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t generate_seed() {
|
static uint32_t generate_seed(void) {
|
||||||
uint32_t seed = 0;
|
uint32_t seed = 0;
|
||||||
int done = 0;
|
int done = 0;
|
||||||
|
|
||||||
|
|
|
@ -197,7 +197,7 @@ static void buffreplace(LexState *ls, char from, char to) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if ANDROID
|
#if defined(ANDROID)
|
||||||
#define getlocaldecpoint() '.'
|
#define getlocaldecpoint() '.'
|
||||||
#elif !defined(getlocaledecpoint)
|
#elif !defined(getlocaledecpoint)
|
||||||
#define getlocaledecpoint() (localeconv()->decimal_point[0])
|
#define getlocaledecpoint() (localeconv()->decimal_point[0])
|
||||||
|
|
|
@ -30,7 +30,7 @@ void printMFUdumpEx(mfu_dump_t *card, uint16_t pages, uint8_t startpage);
|
||||||
int CmdHFMFUltra(const char *Cmd);
|
int CmdHFMFUltra(const char *Cmd);
|
||||||
|
|
||||||
uint32_t ul_ev1_pwdgenA(uint8_t *uid);
|
uint32_t ul_ev1_pwdgenA(uint8_t *uid);
|
||||||
uint32_t ul_ev1_pwdgenA(uint8_t *uid);
|
uint32_t ul_ev1_pwdgenB(uint8_t *uid);
|
||||||
uint32_t ul_ev1_pwdgenC(uint8_t *uid);
|
uint32_t ul_ev1_pwdgenC(uint8_t *uid);
|
||||||
uint32_t ul_ev1_pwdgenD(uint8_t *uid);
|
uint32_t ul_ev1_pwdgenD(uint8_t *uid);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#if !defined LOWMEM && defined __GNUC__
|
#if !defined LOWMEM && defined __GNUC__
|
||||||
static uint8_t filterlut[1 << 20];
|
static uint8_t filterlut[1 << 20];
|
||||||
static void __attribute__((constructor)) fill_lut() {
|
static void __attribute__((constructor)) fill_lut(void) {
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for (i = 0; i < 1 << 20; ++i)
|
for (i = 0; i < 1 << 20; ++i)
|
||||||
filterlut[i] = filter(i);
|
filterlut[i] = filter(i);
|
||||||
|
|
|
@ -82,6 +82,9 @@ local void slide_hash OF((deflate_state *s));
|
||||||
local void fill_window OF((deflate_state *s));
|
local void fill_window OF((deflate_state *s));
|
||||||
local block_state deflate_stored OF((deflate_state *s, int flush));
|
local block_state deflate_stored OF((deflate_state *s, int flush));
|
||||||
local block_state deflate_fast OF((deflate_state *s, int flush));
|
local block_state deflate_fast OF((deflate_state *s, int flush));
|
||||||
|
#ifdef ZLIB_PM3_TUNED
|
||||||
|
local uInt try_harder OF((deflate_state *s, uInt strstart, uInt lookahead, IPos hash_head));
|
||||||
|
#endif
|
||||||
#ifndef FASTEST
|
#ifndef FASTEST
|
||||||
local block_state deflate_slow OF((deflate_state *s, int flush));
|
local block_state deflate_slow OF((deflate_state *s, int flush));
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue