1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 12:28:09 +00:00

feat(crypto): remove -Wstrict-prototypes issues in zkp_context.c

This commit is contained in:
Christian Reitter 2022-09-19 13:27:25 +02:00 committed by Andrew Kozlik
parent 61d93d0539
commit d2737308c4
2 changed files with 5 additions and 14 deletions

View File

@ -7,9 +7,6 @@ ifneq ($(CLANG_VERSION),)
$(if $(shell [ $(CLANG_VERSION_MAJOR) -ge 13 ] && echo "OK"), \ $(if $(shell [ $(CLANG_VERSION_MAJOR) -ge 13 ] && echo "OK"), \
$(eval CLANG_AT_LEAST_13 := true), \ $(eval CLANG_AT_LEAST_13 := true), \
$(eval CLANG_AT_LEAST_13 := false)) $(eval CLANG_AT_LEAST_13 := false))
$(if $(shell [ $(CLANG_VERSION_MAJOR) -ge 15 ] && echo "OK"), \
$(eval CLANG_AT_LEAST_15 := true), \
$(eval CLANG_AT_LEAST_15 := false))
endif endif
ifeq ($(FUZZER),1) ifeq ($(FUZZER),1)
@ -73,12 +70,6 @@ ZKP_PATH = ../vendor/secp256k1-zkp
# this is specific for 64-bit builds # this is specific for 64-bit builds
CFLAGS += -DSECP256K1_CONTEXT_SIZE=208 CFLAGS += -DSECP256K1_CONTEXT_SIZE=208
# TODO remove this workaround once possible
ifeq ($(CLANG_AT_LEAST_15),true)
$(warning "warning: suppressing clang-15 `-Wstrict-prototypes` compiler warning for `zkp_context.c` as workaround")
zkp_context.o: CFLAGS += -Wno-strict-prototypes
endif
VALGRIND ?= 1 VALGRIND ?= 1
ifeq ($(VALGRIND),1) ifeq ($(VALGRIND),1)
CFLAGS += -DVALGRIND CFLAGS += -DVALGRIND

View File

@ -51,7 +51,7 @@ int secp256k1_context_writable_randomize(secp256k1_context *context_writable) {
bool zkp_context_is_initialized(void) { return context != NULL; } bool zkp_context_is_initialized(void) { return context != NULL; }
// returns 0 on success // returns 0 on success
int zkp_context_init() { int zkp_context_init(void) {
assert(context == NULL); assert(context == NULL);
const unsigned int context_flags = const unsigned int context_flags =
@ -78,7 +78,7 @@ int zkp_context_init() {
return 0; return 0;
} }
void zkp_context_destroy() { void zkp_context_destroy(void) {
assert(context != NULL); assert(context != NULL);
secp256k1_context_preallocated_destroy(context); secp256k1_context_preallocated_destroy(context);
@ -87,14 +87,14 @@ void zkp_context_destroy() {
context = NULL; context = NULL;
} }
const secp256k1_context *zkp_context_get_read_only() { const secp256k1_context *zkp_context_get_read_only(void) {
assert(context != NULL); assert(context != NULL);
return context; return context;
} }
// returns NULL if context cannot be acquired // returns NULL if context cannot be acquired
secp256k1_context *zkp_context_acquire_writable() { secp256k1_context *zkp_context_acquire_writable(void) {
assert(context != NULL); assert(context != NULL);
// We don't expect the context to be used by multiple threads // We don't expect the context to be used by multiple threads
@ -105,7 +105,7 @@ secp256k1_context *zkp_context_acquire_writable() {
return context; return context;
} }
void zkp_context_release_writable() { void zkp_context_release_writable(void) {
assert(context != NULL); assert(context != NULL);
atomic_flag_clear(&locked); atomic_flag_clear(&locked);