2022-04-27 10:04:35 +00:00
|
|
|
CC = cc
|
2023-03-24 09:09:56 +00:00
|
|
|
|
|
|
|
CFLAGS = -Wall -Wshadow -Wextra -Wpedantic -Werror -Wno-missing-braces
|
|
|
|
CFLAGS += -fPIC
|
|
|
|
CFALGS += -fsanitize=address,undefined
|
|
|
|
CFLAGS += -DTREZOR_MODEL_T
|
|
|
|
CFLAGS += -DUSE_INSECURE_PRNG
|
2024-03-03 21:19:12 +00:00
|
|
|
CFLAGS += -DCONFIDENTIAL=""
|
2023-03-24 09:09:56 +00:00
|
|
|
|
2019-04-25 14:38:56 +00:00
|
|
|
LIBS =
|
2019-06-08 11:51:28 +00:00
|
|
|
INC = -I ../../../crypto -I ../.. -I .
|
|
|
|
BASE = ../../../
|
|
|
|
|
|
|
|
SRC = storage/tests/c/flash.c
|
|
|
|
SRC += storage/tests/c/common.c
|
2021-02-12 11:12:20 +00:00
|
|
|
SRC += storage/tests/c/random_delays.c
|
2023-06-30 10:12:55 +00:00
|
|
|
SRC += storage/tests/c/test_layout.c
|
2023-11-01 12:40:50 +00:00
|
|
|
SRC += storage/flash_area.c
|
2019-06-08 11:51:28 +00:00
|
|
|
SRC += storage/storage.c
|
2023-08-21 08:56:18 +00:00
|
|
|
SRC += storage/storage_utils.c
|
2019-06-08 11:51:28 +00:00
|
|
|
SRC += storage/norcow.c
|
|
|
|
SRC += crypto/pbkdf2.c
|
|
|
|
SRC += crypto/rand.c
|
|
|
|
SRC += crypto/chacha20poly1305/rfc7539.c
|
|
|
|
SRC += crypto/chacha20poly1305/chacha20poly1305.c
|
|
|
|
SRC += crypto/chacha20poly1305/poly1305-donna.c
|
|
|
|
SRC += crypto/chacha20poly1305/chacha_merged.c
|
|
|
|
SRC += crypto/hmac.c
|
|
|
|
SRC += crypto/sha2.c
|
|
|
|
SRC += crypto/memzero.c
|
|
|
|
|
|
|
|
OBJ = $(SRC:%.c=build/%.o)
|
2023-08-21 08:56:18 +00:00
|
|
|
OBJ_QW = $(SRC:%.c=build_qw/%.o)
|
2019-06-08 11:51:28 +00:00
|
|
|
|
2019-04-25 14:38:56 +00:00
|
|
|
OUT = libtrezor-storage.so
|
2023-08-21 08:56:18 +00:00
|
|
|
OUT_QW = libtrezor-storage-qw.so
|
2019-04-25 14:38:56 +00:00
|
|
|
|
|
|
|
$(OUT): $(OBJ)
|
2023-12-27 22:29:22 +00:00
|
|
|
$(CC) $(CFLAGS) -DFLASH_BIT_ACCESS -DFLASH_BLOCK_WORDS=1 $(LIBS) $(OBJ) -shared -o $(OUT)
|
2019-04-25 14:38:56 +00:00
|
|
|
|
2023-08-21 08:56:18 +00:00
|
|
|
$(OUT_QW): $(OBJ_QW)
|
2023-12-27 22:29:22 +00:00
|
|
|
$(CC) $(CFLAGS) -DFLASH_BLOCK_WORDS=4 $(LIBS) $(OBJ_QW) -shared -o $(OUT_QW)
|
2023-08-21 08:56:18 +00:00
|
|
|
|
2019-06-08 11:51:28 +00:00
|
|
|
build/crypto/chacha20poly1305/chacha_merged.o: $(BASE)crypto/chacha20poly1305/chacha_merged.c
|
|
|
|
mkdir -p $(@D)
|
2023-08-21 08:56:18 +00:00
|
|
|
|
|
|
|
$(CC) $(CFLAGS) $(INC) -c $< -o $@
|
|
|
|
build_qw/crypto/chacha20poly1305/chacha_merged.o: $(BASE)crypto/chacha20poly1305/chacha_merged.c
|
|
|
|
mkdir -p $(@D)
|
2019-06-08 11:51:28 +00:00
|
|
|
$(CC) $(CFLAGS) $(INC) -c $< -o $@
|
|
|
|
|
|
|
|
build/%.o: $(BASE)%.c $(BASE)%.h
|
|
|
|
mkdir -p $(@D)
|
2023-12-27 22:29:22 +00:00
|
|
|
$(CC) $(CFLAGS) -DFLASH_BIT_ACCESS -DFLASH_BLOCK_WORDS=1 $(INC) -c $< -o $@
|
2019-04-25 14:38:56 +00:00
|
|
|
|
2023-08-21 08:56:18 +00:00
|
|
|
build_qw/%.o: $(BASE)%.c $(BASE)%.h
|
|
|
|
mkdir -p $(@D)
|
2023-12-27 22:29:22 +00:00
|
|
|
$(CC) $(CFLAGS) -DFLASH_BLOCK_WORDS=4 $(INC) -c $< -o $@
|
2023-08-21 08:56:18 +00:00
|
|
|
|
2019-04-25 14:38:56 +00:00
|
|
|
clean:
|
2023-12-27 22:29:22 +00:00
|
|
|
rm -f $(OUT) $(OUT_QW) $(OBJ) $(OBJ_QW)
|