Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions boot/bootutil/include/bootutil/crypto/ecdsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ static int bootutil_ecdsa_parse_public_key(bootutil_ecdsa_context *ctx,
}
#endif /* !MCUBOOT_BUILTIN_KEY */

#if !defined(CONFIG_NRF_BOOT_SIGNATURE_USING_ITS)
#if !defined(CONFIG_NCS_BOOT_SIGNATURE_USING_ITS)
/* Verify the signature against the provided hash. The signature gets parsed from
* the encoding first, then PSA Crypto has a dedicated API for ECDSA verification
*/
Expand All @@ -492,7 +492,7 @@ static inline int bootutil_ecdsa_verify(bootutil_ecdsa_context *ctx,
return (int) psa_verify_hash(ctx->key_id, PSA_ALG_ECDSA(ctx->required_algorithm),
hash, hlen, reformatted_signature, 2*ctx->curve_byte_count);
}
#else /* !CONFIG_NRF_BOOT_SIGNATURE_USING_ITS */
#else /* !CONFIG_NCS_BOOT_SIGNATURE_USING_ITS */

static const psa_key_id_t builtin_key_ids[] = {
0x40022100,
Expand Down Expand Up @@ -539,7 +539,7 @@ static inline int bootutil_ecdsa_verify(bootutil_ecdsa_context *ctx,
return status == PSA_SUCCESS ? 0 : 2;
}

#endif /* !CONFIG_NRF_BOOT_SIGNATURE_USING_ITS */
#endif /* !CONFIG_NCS_BOOT_SIGNATURE_USING_ITS */

#elif defined(MCUBOOT_USE_MBED_TLS)

Expand Down
38 changes: 19 additions & 19 deletions boot/bootutil/src/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@

#ifdef __ZEPHYR__
#include <zephyr/sys/reboot.h>
#if defined(CONFIG_NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_WAIT_MS)
#if defined(CONFIG_NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_WAIT_MS)
#include <zephyr/kernel.h>
#endif /* CONFIG_NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_WAIT_MS */
#endif /* CONFIG_NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_WAIT_MS */
#endif

#if defined(CONFIG_SOC_NRF5340_CPUAPP) && defined(PM_CPUNET_B0N_ADDRESS) && defined(CONFIG_PCD_APP)
Expand Down Expand Up @@ -916,10 +916,10 @@ boot_image_check(struct boot_loader_state *state, struct image_header *hdr,
}
#endif

for (int i = 1; i <= CONFIG_NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT; i++ ) {
#if CONFIG_NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT > 1
BOOT_LOG_DBG("Image validation attempt %d/%d", i, CONFIG_NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT);
#endif /* CONFIG_NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT > 1 */
for (int i = 1; i <= CONFIG_NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT; i++ ) {
#if CONFIG_NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT > 1
BOOT_LOG_DBG("Image validation attempt %d/%d", i, CONFIG_NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT);
#endif /* CONFIG_NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT > 1 */

#if defined(MCUBOOT_SWAP_USING_OFFSET) && defined(MCUBOOT_SERIAL_RECOVERY)
FIH_CALL(bootutil_img_validate, fih_rc, state, hdr, fap, tmpbuf, BOOT_TMPBUF_SZ,
Expand All @@ -930,25 +930,25 @@ boot_image_check(struct boot_loader_state *state, struct image_header *hdr,
#endif

if (FIH_EQ(fih_rc, FIH_SUCCESS)) {
#if CONFIG_NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT > 1
BOOT_LOG_DBG("Image validation attempt %d/%d success", i, CONFIG_NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT);
#endif /* CONFIG_NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT > 1 */
#if CONFIG_NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT > 1
BOOT_LOG_DBG("Image validation attempt %d/%d success", i, CONFIG_NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT);
#endif /* CONFIG_NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT > 1 */
break;
} else {
#if CONFIG_NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT > 1
#if CONFIG_NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT > 1
BOOT_LOG_WRN("Image validation attempt %d/%d failure: %d",
i,
CONFIG_NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT, fih_rc);
#endif /* CONFIG_NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT > 1 */
CONFIG_NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT, fih_rc);
#endif /* CONFIG_NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT > 1 */

if (i < CONFIG_NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT) {
#if defined(CONFIG_NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_WAIT_MS)
#if CONFIG_NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT > 1
if (i < CONFIG_NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT) {
#if defined(CONFIG_NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_WAIT_MS)
#if CONFIG_NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT > 1
BOOT_LOG_DBG("Waiting %d ms before next attempt",
CONFIG_NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_WAIT_MS);
#endif /* CONFIG_NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT > 1 */
k_busy_wait(CONFIG_NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_WAIT_MS * 1000);
#endif /* CONFIG_NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_WAIT_MS */
CONFIG_NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_WAIT_MS);
#endif /* CONFIG_NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT > 1 */
k_busy_wait(CONFIG_NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_WAIT_MS * 1000);
#endif /* CONFIG_NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_WAIT_MS */
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions boot/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -422,14 +422,14 @@ config BOOT_KMU_KEYS_REVOCATION
help
Enabling KMU key revocation backend.

config NRF_BOOT_SIGNATURE_USING_ITS
config NCS_BOOT_SIGNATURE_USING_ITS
bool "Use ITS stored keys for signature verification"
depends on NRF_SECURITY
help
MCUboot will use keys provisioned to the internal trusted storage for signature
verification instead of compiling in key data from a file.

if !BOOT_SIGNATURE_USING_KMU && !NRF_BOOT_SIGNATURE_USING_ITS
if !BOOT_SIGNATURE_USING_KMU && !NCS_BOOT_SIGNATURE_USING_ITS

config BOOT_SIGNATURE_KEY_FILE
string "PEM key file"
Expand Down Expand Up @@ -1308,7 +1308,7 @@ config MCUBOOT_VERIFY_IMG_ADDRESS
also be useful when BOOT_DIRECT_XIP is enabled, to ensure that the image
linked at the correct address is loaded.

config NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT
config NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT
int "Number of image validation attempts"
default 1
help
Expand All @@ -1317,9 +1317,9 @@ config NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT
This can prevent erasing an image when initial validation fails.
Wait time is controlled by MCUBOOT_IMG_VALIDATE_ATTEMPT_WAIT_MS.

config NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_WAIT_MS
config NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_WAIT_MS
int "Time between image validation attempts"
depends on NRF_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT > 1
depends on NCS_MCUBOOT_IMG_VALIDATE_ATTEMPT_COUNT > 1
default 5000
help
Time between image validation attempts, in milliseconds.
Expand Down
2 changes: 1 addition & 1 deletion boot/zephyr/include/mcuboot_config/mcuboot_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
#define MCUBOOT_HW_KEY
#endif

#ifdef CONFIG_NRF_BOOT_SIGNATURE_USING_ITS
#ifdef CONFIG_NCS_BOOT_SIGNATURE_USING_ITS
#define MCUBOOT_BUILTIN_KEY
#endif

Expand Down
Loading