Add macro to get TLVs offset from header
TLV offset was determined by manually adding the header and image
size in many places; this makes the addition into a macro receiving
a image_header to ease future changes.
Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/boot/bootutil/src/encrypted.c b/boot/bootutil/src/encrypted.c
index d8f7d6b..9edff51 100644
--- a/boot/bootutil/src/encrypted.c
+++ b/boot/bootutil/src/encrypted.c
@@ -242,7 +242,7 @@
return 1;
}
- off = hdr->ih_img_size + hdr->ih_hdr_size;
+ off = BOOT_TLV_OFF(hdr);
rc = flash_area_read(fap, off, &info, sizeof(info));
if (rc) {