From 10b2b290d30c43717880b344c0f49e77ffc83928 Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Thu, 16 Nov 2023 09:18:38 +0100 Subject: [PATCH 1/2] wolfBoot_get_blob_type: fix return type --- include/wolfboot/wolfboot.h | 2 +- src/libwolfboot.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/wolfboot/wolfboot.h b/include/wolfboot/wolfboot.h index b46bcd4d5..20d48ab0e 100644 --- a/include/wolfboot/wolfboot.h +++ b/include/wolfboot/wolfboot.h @@ -271,7 +271,7 @@ void wolfBoot_update_trigger(void); void wolfBoot_success(void); uint32_t wolfBoot_image_size(uint8_t *image); uint32_t wolfBoot_get_blob_version(uint8_t *blob); -uint32_t wolfBoot_get_blob_type(uint8_t *blob); +uint16_t wolfBoot_get_blob_type(uint8_t *blob); uint32_t wolfBoot_get_blob_diffbase_version(uint8_t *blob); /* Get partition ID from manifest header */ diff --git a/src/libwolfboot.c b/src/libwolfboot.c index f73c4c699..9d9c5490f 100644 --- a/src/libwolfboot.c +++ b/src/libwolfboot.c @@ -1075,9 +1075,9 @@ uint32_t wolfBoot_get_blob_version(uint8_t *blob) * * @return The type of the blob, or 0 if the blob is invalid. */ -uint32_t wolfBoot_get_blob_type(uint8_t *blob) +uint16_t wolfBoot_get_blob_type(uint8_t *blob) { - uint32_t *volatile type_field = NULL; + uint16_t *volatile type_field = NULL; uint32_t *magic = NULL; uint8_t *img_bin = blob; #if defined(EXT_ENCRYPTED) && defined(MMU) From 23894d31c6c2c7c17885545566353d996d17bbd1 Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Fri, 17 Nov 2023 15:15:18 +0100 Subject: [PATCH 2/2] Adjust mock in unit tests: fixed image_type field --- tools/unit-tests/unit-image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/unit-tests/unit-image.c b/tools/unit-tests/unit-image.c index e1dac0e5d..2fb9f7be2 100644 --- a/tools/unit-tests/unit-image.c +++ b/tools/unit-tests/unit-image.c @@ -236,7 +236,7 @@ static uint16_t _find_header(uint8_t *haystack, uint16_t type, uint8_t **ptr) return 0; } -uint32_t wolfBoot_get_blob_type(uint8_t *addr) +uint16_t wolfBoot_get_blob_type(uint8_t *addr) { return HDR_IMG_TYPE_APP; }