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

Allow to compile without Valgrind

This commit is contained in:
Dusan Klinec 2018-07-11 21:26:07 +02:00 committed by Pavol Rusnak
parent ff001a0f12
commit 957b8129bd
2 changed files with 10 additions and 0 deletions

View File

@ -23,7 +23,10 @@ CFLAGS += $(OPTFLAGS) \
-Wformat-security \
-Werror
VALGRIND ?= 1
CFLAGS += -I.
CFLAGS += -DVALGRIND=$(VALGRIND)
CFLAGS += -DUSE_ETHEREUM=1
CFLAGS += -DUSE_GRAPHENE=1
CFLAGS += -DUSE_NEM=1

View File

@ -31,8 +31,10 @@
#include <check.h>
#include "check_mem.h"
#if VALGRIND
#include <valgrind/valgrind.h>
#include <valgrind/memcheck.h>
#endif
#include "options.h"
@ -62,6 +64,7 @@
#include "rc4.h"
#include "nem.h"
#if VALGRIND
/*
* This is a clever trick to make Valgrind's Memcheck verify code
* is constant-time with respect to secret data.
@ -71,6 +74,10 @@
#define MARK_SECRET_DATA(addr, len) VALGRIND_MAKE_MEM_UNDEFINED(addr, len)
/* Call before secret data is freed or to mark non-secret data (public keys or signatures) */
#define UNMARK_SECRET_DATA(addr, len) VALGRIND_MAKE_MEM_DEFINED (addr, len)
#else
#define MARK_SECRET_DATA(addr, len)
#define UNMARK_SECRET_DATA(addr, len)
#endif
#define FROMHEX_MAXLEN 512