2020-02-26 14:48:24 +01:00
|
|
|
#
|
|
|
|
# path to suit-tool
|
2020-06-29 15:42:47 +02:00
|
|
|
SUIT_TOOL ?= $(RIOTBASE)/dist/tools/suit/suit-manifest-generator/bin/suit-tool
|
2020-02-26 14:48:24 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# SUIT encryption keys
|
|
|
|
#
|
|
|
|
|
|
|
|
# Specify key to use.
|
|
|
|
# Will use $(SUIT_KEY_DIR)/$(SUIT_KEY).pem as combined private/public key
|
|
|
|
# files.
|
|
|
|
SUIT_KEY ?= default
|
2022-06-02 00:02:26 +02:00
|
|
|
XDG_DATA_HOME ?= $(HOME)/.local/share
|
2020-02-26 14:48:24 +01:00
|
|
|
|
|
|
|
ifeq (1, $(RIOT_CI_BUILD))
|
|
|
|
SUIT_KEY_DIR ?= $(BINDIR)
|
|
|
|
else
|
2022-06-02 00:02:26 +02:00
|
|
|
SUIT_KEY_DIR ?= $(XDG_DATA_HOME)/RIOT/keys
|
2020-02-26 14:48:24 +01:00
|
|
|
endif
|
|
|
|
|
2022-05-24 01:13:02 +02:00
|
|
|
# Enable user to encrypt private key with a password
|
|
|
|
ifneq (,$(SUIT_SEC_PASSWORD))
|
|
|
|
SUIT_TOOL_ARGS += -p $(SUIT_SEC_PASSWORD)
|
|
|
|
endif
|
|
|
|
|
2020-02-26 14:48:24 +01:00
|
|
|
SUIT_SEC ?= $(SUIT_KEY_DIR)/$(SUIT_KEY).pem
|
|
|
|
|
|
|
|
SUIT_PUB_HDR = $(BINDIR)/riotbuild/public_key.h
|
|
|
|
SUIT_PUB_HDR_DIR = $(dir $(SUIT_PUB_HDR))
|
|
|
|
CFLAGS += -I$(SUIT_PUB_HDR_DIR)
|
|
|
|
BUILDDEPS += $(SUIT_PUB_HDR)
|
|
|
|
|
|
|
|
$(SUIT_SEC): $(CLEAN)
|
2021-08-16 11:23:50 +02:00
|
|
|
$(Q)echo suit: generating key in $(SUIT_KEY_DIR)
|
|
|
|
$(Q)mkdir -p $(SUIT_KEY_DIR)
|
2022-05-24 01:13:02 +02:00
|
|
|
$(Q)$(RIOTBASE)/dist/tools/suit/gen_key.py $(SUIT_SEC) $(SUIT_SEC_PASSWORD)
|
2020-02-26 14:48:24 +01:00
|
|
|
|
|
|
|
# set FORCE so switching between keys using "SUIT_KEY=foo make ..."
|
|
|
|
# triggers a rebuild even if the new key would otherwise not (because the other
|
|
|
|
# key's mtime is too far back).
|
|
|
|
$(SUIT_PUB_HDR): $(SUIT_SEC) FORCE | $(CLEAN)
|
2021-08-16 11:23:50 +02:00
|
|
|
$(Q)mkdir -p $(SUIT_PUB_HDR_DIR)
|
2022-05-24 01:13:02 +02:00
|
|
|
$(Q)$(SUIT_TOOL) pubkey $(SUIT_TOOL_ARGS) -f header -k $(SUIT_SEC) \
|
2020-02-26 14:48:24 +01:00
|
|
|
| '$(LAZYSPONGE)' $(LAZYSPONGE_FLAGS) '$@'
|
|
|
|
|
|
|
|
suit/genkey: $(SUIT_SEC)
|