mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-17 05:03:07 +00:00
feat(crypto): Sanitize undefined behavior.
This commit is contained in:
parent
af0ae880a1
commit
d6fdadf673
@ -3,7 +3,7 @@ CC ?= clang
|
||||
LD ?= $(CC)
|
||||
SANFLAGS += -fsanitize=fuzzer
|
||||
else ifeq ($(ADDRESS_SANITIZER),1)
|
||||
SANFLAGS += -fsanitize=address
|
||||
SANFLAGS += -fsanitize=address,undefined
|
||||
endif
|
||||
|
||||
CC ?= gcc
|
||||
|
@ -688,6 +688,10 @@ groestl_big_init(sph_groestl_big_context *sc, unsigned out_size)
|
||||
static void
|
||||
groestl_big_core(sph_groestl_big_context *sc, const void *data, size_t len)
|
||||
{
|
||||
if (len == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned char *buf = NULL;
|
||||
size_t ptr = 0;
|
||||
DECL_STATE_BIG
|
||||
|
@ -283,6 +283,8 @@ static void sha3_process_block(uint64_t hash[25], const uint64_t *block, size_t
|
||||
*/
|
||||
void sha3_Update(SHA3_CTX *ctx, const unsigned char *msg, size_t size)
|
||||
{
|
||||
if (size == 0) return;
|
||||
|
||||
size_t idx = (size_t)ctx->rest;
|
||||
size_t block_size = (size_t)ctx->block_size;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
CC = gcc
|
||||
CFLAGS = -Wall -Wshadow -Wextra -Wpedantic -Werror -Wno-missing-braces -fPIC -fsanitize=address
|
||||
CFLAGS = -Wall -Wshadow -Wextra -Wpedantic -Werror -Wno-missing-braces -fPIC -fsanitize=address,undefined
|
||||
LIBS =
|
||||
INC = -I ../../../crypto -I ../.. -I .
|
||||
BASE = ../../../
|
||||
|
Loading…
Reference in New Issue
Block a user