Add possibility to have multiple trusted certificates

Today, only one certificate is shipped with infix, it is
selectable in menuconfig. It is also possible to add extra
certificates, useful when using infix as a submodule.
This commit is contained in:
Mattias Walström
2024-04-25 13:29:24 +02:00
parent 886132600a
commit a0804b15fe
6 changed files with 28 additions and 3 deletions
+21 -2
View File
@@ -18,7 +18,27 @@ endchoice
config SIGN_KEY config SIGN_KEY
string "Signing key" string "Signing key"
depends on SIGN_ENABLED depends on SIGN_ENABLED
default "${BR2_EXTERNAL_INFIX_PATH}/board/common/dev-key" if SIGN_SRC_DIR default "${BR2_EXTERNAL_INFIX_PATH}/board/common/signing-keys/development" if SIGN_SRC_DIR
menuconfig TRUSTED_KEYS
bool "Trusted keys for image"
depends on SIGN_ENABLED
help
Keys that will be accepted for this image
config TRUSTED_KEYS_DEVELOPMENT
bool "Development key"
depends on TRUSTED_KEYS
config TRUSTED_KEYS_DEVELOPMENT_PATH
string
depends on TRUSTED_KEYS_DEVELOPMENT
default "${BR2_EXTERNAL_INFIX_PATH}/board/common/signing-keys/development/infix.crt"
config TRUSTED_KEYS_EXTRA_PATH
string "Path to extra keys to include in image"
depends on TRUSTED_KEYS
menuconfig DISK_IMAGE menuconfig DISK_IMAGE
bool "Disk image" bool "Disk image"
@@ -140,4 +160,3 @@ config FIT_ARCH
config FIT_KERNEL_LOAD_ADDR config FIT_KERNEL_LOAD_ADDR
string "Kernel load address" string "Kernel load address"
depends on FIT_IMAGE depends on FIT_IMAGE
+3 -1
View File
@@ -1,11 +1,13 @@
ifeq ($(SIGN_ENABLED),y) ifeq ($(SIGN_ENABLED),y)
include $(BR2_EXTERNAL_INFIX_PATH)/board/common/uboot/uboot.mk include $(BR2_EXTERNAL_INFIX_PATH)/board/common/uboot/uboot.mk
TRUSTED_KEYS=$(TRUSTED_KEYS_DEVELOPMENT_PATH) $(TRUSTED_KEYS_EXTRA_PATH)
define RAUC_POST_BUILD_INSTALL_CERT define RAUC_POST_BUILD_INSTALL_CERT
@$(call IXMSG,"Installing signing cert for RAUC") @$(call IXMSG,"Installing signing cert for RAUC")
mkdir -p $(TARGET_DIR)/etc/rauc/keys mkdir -p $(TARGET_DIR)/etc/rauc/keys
$(foreach crt,$(shell ls $(SIGN_KEY)/*.crt), \ $(foreach crt,$(shell ls $(TRUSTED_KEYS)), \
cp $(crt) $(TARGET_DIR)/etc/rauc/keys/$(shell openssl x509 -hash -noout <$(crt)).0;) cp $(crt) $(TARGET_DIR)/etc/rauc/keys/$(shell openssl x509 -hash -noout <$(crt)).0;)
endef endef
RAUC_POST_BUILD_HOOKS += RAUC_POST_BUILD_INSTALL_CERT RAUC_POST_BUILD_HOOKS += RAUC_POST_BUILD_INSTALL_CERT
endif endif
+2
View File
@@ -156,3 +156,5 @@ DISK_IMAGE_BOOT_BIN=y
GNS3_APPLIANCE_RAM=512 GNS3_APPLIANCE_RAM=512
GNS3_APPLIANCE_IFNUM=10 GNS3_APPLIANCE_IFNUM=10
BR2_PER_PACKAGE_DIRECTORIES=y BR2_PER_PACKAGE_DIRECTORIES=y
TRUSTED_KEYS=y
TRUSTED_KEYS_DEVELOPMENT=y
+2
View File
@@ -157,3 +157,5 @@ BR2_PACKAGE_TETRIS=y
GNS3_APPLIANCE_RAM=512 GNS3_APPLIANCE_RAM=512
GNS3_APPLIANCE_IFNUM=10 GNS3_APPLIANCE_IFNUM=10
BR2_PER_PACKAGE_DIRECTORIES=y BR2_PER_PACKAGE_DIRECTORIES=y
TRUSTED_KEYS=y
TRUSTED_KEYS_DEVELOPMENT=y