diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2024-04-08 16:31:30 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2024-04-10 08:36:19 +0200 |
commit | 7c80ebdcecd9bc047050a63d3b60dad43c2c0e45 (patch) | |
tree | 3ca6af68f7bd7be6795398bbfa2c352b963db352 | |
parent | 743130a7c75f046dc2dfc6f83b82639c9dae0a0f (diff) | |
download | barebox-7c80ebdcecd9.tar.gz barebox-7c80ebdcecd9.tar.xz |
bootm: replace CONFIG_BOOTM_FORCE_SIGNED_IMAGES with helper
In preparation for allowing even CONFIG_BOOTM_FORCE_SIGNED_IMAGES=n
configurations to force boot of only signed images, replace direct
use of IS_ENABLED(CONFIG_BOOTM_FORCE_SIGNED_IMAGES) with a helper that
queries a static variable that can be forced at runtime in a follow-up
commit.
No functional change.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.barebox.org/20240408143131.3630347-1-m.felsch@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | arch/arm/lib32/bootm.c | 2 | ||||
-rw-r--r-- | common/bootm.c | 11 | ||||
-rw-r--r-- | include/bootm.h | 2 |
3 files changed, 12 insertions, 3 deletions
diff --git a/arch/arm/lib32/bootm.c b/arch/arm/lib32/bootm.c index e814593dce..aeb873a3a7 100644 --- a/arch/arm/lib32/bootm.c +++ b/arch/arm/lib32/bootm.c @@ -294,7 +294,7 @@ static int __do_bootm_linux(struct image_data *data, unsigned long free_mem, } if (IS_ENABLED(CONFIG_BOOTM_OPTEE)) { - if (data->tee_file && !IS_ENABLED(CONFIG_BOOTM_FORCE_SIGNED_IMAGES)) { + if (data->tee_file && !bootm_signed_images_are_forced()) { ret = bootm_load_tee_from_file(data); if (ret) return ret; diff --git a/common/bootm.c b/common/bootm.c index a59fa35008..3cd4aa1528 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -87,6 +87,13 @@ static const char * const bootm_verify_names[] = { [BOOTM_VERIFY_SIGNATURE] = "signature", }; +static bool force_signed_images = IS_ENABLED(CONFIG_BOOTM_FORCE_SIGNED_IMAGES); + +bool bootm_signed_images_are_forced(void) +{ + return force_signed_images; +} + static int uimage_part_num(const char *partname) { if (!partname) @@ -694,7 +701,7 @@ int bootm_boot(struct bootm_data *bootm_data) goto err_out; } - if (IS_ENABLED(CONFIG_BOOTM_FORCE_SIGNED_IMAGES)) { + if (bootm_signed_images_are_forced()) { data->verify = BOOTM_VERIFY_SIGNATURE; /* @@ -985,7 +992,7 @@ static int bootm_init(void) globalvar_add_simple("bootm.initrd.loadaddr", NULL); } - if (IS_ENABLED(CONFIG_BOOTM_FORCE_SIGNED_IMAGES)) + if (bootm_signed_images_are_forced()) bootm_verify_mode = BOOTM_VERIFY_SIGNATURE; globalvar_add_simple_int("bootm.verbose", &bootm_verbosity, "%u"); diff --git a/include/bootm.h b/include/bootm.h index c69da85cdd..e4d59b566e 100644 --- a/include/bootm.h +++ b/include/bootm.h @@ -152,6 +152,8 @@ int bootm_get_os_size(struct image_data *data); enum bootm_verify bootm_get_verify_mode(void); void bootm_set_verify_mode(enum bootm_verify mode); +bool bootm_signed_images_are_forced(void); + #define UIMAGE_SOME_ADDRESS (UIMAGE_INVALID_ADDRESS - 1) void *booti_load_image(struct image_data *data, phys_addr_t *oftree); |