@@ -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 ;
@@ -246,19 +254,23 @@ bootutil_img_validate(struct boot_loader_state *state,
246
254
}
247
255
#endif
248
256
257
+ #if defined(MCUBOOT_SWAP_USING_OFFSET )
258
+ it .start_off = boot_get_state_secondary_offset (state , fap );
259
+ #endif
260
+
249
261
#if defined(MCUBOOT_SIGN_PURE )
250
262
/* If Pure type signature is expected then it has to be there */
263
+ #if defined(MCUBOOT_SWAP_USING_OFFSET )
264
+ rc = bootutil_check_for_pure (hdr , fap , it .start_off );
265
+ #else
251
266
rc = bootutil_check_for_pure (hdr , fap );
267
+ #endif
252
268
if (rc != 0 ) {
253
269
BOOT_LOG_DBG ("bootutil_img_validate: pure expected" );
254
270
goto out ;
255
271
}
256
272
#endif
257
273
258
- #if defined(MCUBOOT_SWAP_USING_OFFSET )
259
- it .start_off = boot_get_state_secondary_offset (state , fap );
260
- #endif
261
-
262
274
rc = bootutil_tlv_iter_begin (& it , hdr , fap , IMAGE_TLV_ANY , false);
263
275
if (rc ) {
264
276
BOOT_LOG_DBG ("bootutil_img_validate: TLV iteration failed %d" , rc );
0 commit comments