Skip to content

Commit

Permalink
makefiles/suit: use OpenSSL to generate key
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Sep 11, 2024
1 parent 99285d3 commit a197a0f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion makefiles/suit.base.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,17 @@ SUIT_PUB_HDR_DIR = $(dir $(SUIT_PUB_HDR))
CFLAGS += -I$(SUIT_PUB_HDR_DIR)
BUILDDEPS += $(SUIT_PUB_HDR)

ifneq (,$(SUIT_SEC_PASSWORD))
OPENSSL_GENPKEY_ARGS += -aes-256-cbc
endif

# OpenSSL leaves an empty file if key generation fails - remove it manually
# see https://github.com/openssl/openssl/issues/25440
$(SUIT_SEC): | $(CLEAN)
$(Q)echo suit: generating key in $(SUIT_KEY_DIR)
$(Q)mkdir -p $(SUIT_KEY_DIR)
$(Q)$(RIOTBASE)/dist/tools/suit/gen_key.py $@ $(SUIT_SEC_PASSWORD)
-$(Q)openssl genpkey -algorithm ed25519 $(OPENSSL_GENPKEY_ARGS) -out $@
$(Q)if [ ! -s $@ ]; then rm $@; fi

%.pem.pub: %.pem
$(Q)openssl ec -inform pem -in $< -outform pem -pubout -out $@
Expand Down

0 comments on commit a197a0f

Please sign in to comment.