Skip to content

Commit 2948421

Browse files
de-nordicnvlsianpu
authored andcommitted
[nrf noup] bootutil: Fixes from upstream review
fixup! [nrf noup] bootutil: PureEdDSA using ED25519 Signed-off-by: Dominik Ermel <[email protected]>
1 parent 6ea6a72 commit 2948421

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

boot/bootutil/src/image_validate.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ bootutil_get_img_security_cnt(struct image_header *hdr,
375375
#if defined(MCUBOOT_SIGN_PURE)
376376
/* Returns:
377377
* 0 -- found
378-
* 1 -- not found
378+
* 1 -- not found or found but not true
379379
* -1 -- failed for some reason
380380
*
381381
* Value of TLV does not matter, presence decides.
@@ -395,6 +395,14 @@ static int bootutil_check_for_pure(const struct image_header *hdr,
395395

396396
/* Search for the TLV */
397397
rc = bootutil_tlv_iter_next(&it, &off, &len, NULL);
398+
if (rc == 0 && len == 1) {
399+
bool val;
400+
401+
rc = LOAD_IMAGE_DATA(hdr, fap, off, &val, 1);
402+
if (rc == 0) {
403+
rc = !val;
404+
}
405+
}
398406

399407
return rc;
400408
}
@@ -730,7 +738,7 @@ bootutil_img_validate(struct enc_key_data *enc_state, int image_index,
730738
}
731739
#elif defined(MCUBOOT_SIGN_PURE)
732740
/* This returns true on EQ, rc is err on non-0 */
733-
rc = !FIH_EQ(valid_signature, FIH_SUCCESS);
741+
rc = FIH_NOT_EQ(valid_signature, FIH_SUCCESS);
734742
#endif
735743
#ifdef EXPECTED_SIG_TLV
736744
FIH_SET(fih_rc, valid_signature);

0 commit comments

Comments
 (0)