@@ -125,14 +125,22 @@ BOOT_LOG_MODULE_DECLARE(mcuboot);
125
125
*
126
126
* Value of TLV does not matter, presence decides.
127
127
*/
128
- static int bootutil_check_for_pure (const struct image_header * hdr ,
129
- const struct flash_area * fap )
128
+ #if defined(MCUBOOT_SWAP_USING_OFFSET )
129
+ static int bootutil_check_for_pure (const struct image_header * hdr , const struct flash_area * fap ,
130
+ uint32_t start_off )
131
+ #else
132
+ static int bootutil_check_for_pure (const struct image_header * hdr , const struct flash_area * fap )
133
+ #endif
130
134
{
131
135
struct image_tlv_iter it ;
132
136
uint32_t off ;
133
137
uint16_t len ;
134
138
int32_t rc ;
135
139
140
+ #if defined(MCUBOOT_SWAP_USING_OFFSET )
141
+ it .start_off = start_off ;
142
+ #endif
143
+
136
144
rc = bootutil_tlv_iter_begin (& it , hdr , fap , IMAGE_TLV_SIG_PURE , false);
137
145
if (rc ) {
138
146
return -1 ;
@@ -249,19 +257,23 @@ bootutil_img_validate(struct boot_loader_state *state,
249
257
}
250
258
#endif
251
259
260
+ #if defined(MCUBOOT_SWAP_USING_OFFSET )
261
+ it .start_off = boot_get_state_secondary_offset (state , fap );
262
+ #endif
263
+
252
264
#if defined(MCUBOOT_SIGN_PURE )
253
265
/* If Pure type signature is expected then it has to be there */
266
+ #if defined(MCUBOOT_SWAP_USING_OFFSET )
267
+ rc = bootutil_check_for_pure (hdr , fap , it .start_off );
268
+ #else
254
269
rc = bootutil_check_for_pure (hdr , fap );
270
+ #endif
255
271
if (rc != 0 ) {
256
272
BOOT_LOG_DBG ("bootutil_img_validate: pure expected" );
257
273
goto out ;
258
274
}
259
275
#endif
260
276
261
- #if defined(MCUBOOT_SWAP_USING_OFFSET )
262
- it .start_off = boot_get_state_secondary_offset (state , fap );
263
- #endif
264
-
265
277
rc = bootutil_tlv_iter_begin (& it , hdr , fap , IMAGE_TLV_ANY , false);
266
278
if (rc ) {
267
279
BOOT_LOG_DBG ("bootutil_img_validate: TLV iteration failed %d" , rc );
0 commit comments