From 6880468862a498d359a0a6ed4bd9dd116a478fa9 Mon Sep 17 00:00:00 2001 From: jaseg Date: Mon, 9 Mar 2020 22:10:46 +0100 Subject: WIP cryptographic design --- controller/fw/Makefile | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'controller/fw/Makefile') diff --git a/controller/fw/Makefile b/controller/fw/Makefile index a7d690a..c678963 100644 --- a/controller/fw/Makefile +++ b/controller/fw/Makefile @@ -60,6 +60,10 @@ DSSS_FILTER_ORDER ?= 12 PAYLOAD_DATA_BIT ?= 64 TRANSMISSION_SYMBOLS ?= 32 +PRESIG_STORE_SIZE ?= 3 + +PRESIG_KEYFILE ?= presig_test_key.private +PRESIG_DBFILE ?= presig_test_db.sqlite3 CC := $(PREFIX)gcc CXX := $(PREFIX)g++ @@ -90,7 +94,7 @@ MUSL_DIR_ABS := $(abspath $(MUSL_DIR)) COMMON_CFLAGS += -I$(OPENCM3_DIR_ABS)/include -Imspdebug/util -Imspdebug/drivers -Ilevmarq COMMON_CFLAGS += -I$(CMSIS_DIR_ABS)/CMSIS/DSP/Include -I$(CMSIS_DIR_ABS)/CMSIS/Core/Include CFLAGS += -I$(abspath musl_include_shims) -COMMON_CFLAGS += -I$(BUILDDIR) -Isrc +COMMON_CFLAGS += -I$(BUILDDIR) -Isrc -Itinyaes COMMON_CFLAGS += -Os -std=gnu11 -g -DSTM32F4 CFLAGS += -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 @@ -107,6 +111,7 @@ COMMON_CFLAGS += -DDSSS_WAVELET_WIDTH=$(DSSS_WAVELET_WIDTH) COMMON_CFLAGS += -DDSSS_WAVELET_LUT_SIZE=$(DSSS_WAVELET_LUT_SIZE) COMMON_CFLAGS += -DPAYLOAD_DATA_BIT=$(PAYLOAD_DATA_BIT) COMMON_CFLAGS += -DTRANSMISSION_SYMBOLS=$(TRANSMISSION_SYMBOLS) +COMMON_CFLAGS += -DPRESIG_STORE_SIZE=$(PRESIG_STORE_SIZE) # for musl CFLAGS += -Dhidden= @@ -154,6 +159,14 @@ $(BUILDDIR)/generated/dsss_cwt_wavelet.c: | $(BUILDDIR)/generated $(BUILDDIR)/generated/dsss_butter_filter.h: | $(BUILDDIR)/generated $(PYTHON3) tools/butter_filter_gen.py -m dsss_filter $(DSSS_FILTER_FC) $(FMEAS_SAMPLING_RATE) $(DSSS_FILTER_ORDER) > $@ +.PRECIOUS: $(BUILDDIR)/generated/crypto_presig_data.c +$(BUILDDIR)/generated/crypto_presig_data.c: $(PRESIG_KEYFILE) tools/presig_gen.py | $(BUILDDIR)/generated + $(PYTHON3) tools/presig_gen.py $(PRESIG_KEYFILE) $(PRESIG_DBFILE) > $@ + +.PRECIOUS: $(PRESIG_KEYFILE) +$(PRESIG_KEYFILE): + $(PYTHON3) tools/presig_gen.py -g $@ + $(BUILDDIR)/generated: ; mkdir -p $@ OBJS := $(addprefix $(BUILDDIR)/,$(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o)) @@ -180,6 +193,11 @@ $(BUILDDIR)/tools/dsss_demod_test: tools/dsss_demod_test.c src/dsss_demod.c $(BU mkdir -p $(@D) $(HOST_CC) $(COMMON_CFLAGS) $(SIM_CFLAGS) -o $@ $^ +tools: $(BUILDDIR)/tools/crypto_test +$(BUILDDIR)/tools/crypto_test: tools/crypto_test.c src/crypto.c tinyaes/aes.c $(BUILDDIR)/generated/crypto_presig_data.c + mkdir -p $(@D) + $(HOST_CC) $(COMMON_CFLAGS) $(SIM_CFLAGS) -lsodium -o $@ $^ + $(BUILDDIR)/src/%.o: src/%.c mkdir -p $(@D) $(CC) $(COMMON_CFLAGS) $(CFLAGS) $(INT_CFLAGS) -o $@ -c $< -- cgit