Skip to content

Commit 4ca6257

Browse files
committed
Revert "[nrf noup] Added BOOT_SIGNATURE_USING_ITS for ecdsa configuration"
This reverts commit d69621e. Signed-off-by: Tomasz Chyrowicz <[email protected]>
1 parent d69621e commit 4ca6257

File tree

4 files changed

+2
-64
lines changed

4 files changed

+2
-64
lines changed

boot/bootutil/include/bootutil/crypto/ecdsa.h

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,6 @@ static int bootutil_ecdsa_parse_public_key(bootutil_ecdsa_context *ctx,
473473
}
474474
#endif /* !MCUBOOT_BUILTIN_KEY */
475475

476-
#if !defined(CONFIG_NRF_BOOT_SIGNATURE_USING_ITS)
477476
/* Verify the signature against the provided hash. The signature gets parsed from
478477
* the encoding first, then PSA Crypto has a dedicated API for ECDSA verification
479478
*/
@@ -492,55 +491,6 @@ static inline int bootutil_ecdsa_verify(bootutil_ecdsa_context *ctx,
492491
return (int) psa_verify_hash(ctx->key_id, PSA_ALG_ECDSA(ctx->required_algorithm),
493492
hash, hlen, reformatted_signature, 2*ctx->curve_byte_count);
494493
}
495-
#else /* !CONFIG_NRF_BOOT_SIGNATURE_USING_ITS */
496-
497-
static const psa_key_id_t builtin_key_ids[] = {
498-
0x40022100,
499-
0x40022101,
500-
0x40022102,
501-
0x40022103
502-
};
503-
504-
#define BOOT_SIGNATURE_BUILTIN_KEY_SLOTS ARRAY_SIZE(builtin_key_ids)
505-
506-
static inline int bootutil_ecdsa_verify(bootutil_ecdsa_context *ctx,
507-
uint8_t *pk, size_t pk_len,
508-
uint8_t *hash, size_t hlen,
509-
uint8_t *sig, size_t slen)
510-
{
511-
(void)pk;
512-
(void)pk_len;
513-
(void)slen;
514-
psa_status_t status = PSA_ERROR_BAD_STATE;
515-
516-
/* Initialize PSA Crypto */
517-
status = psa_crypto_init();
518-
if (status != PSA_SUCCESS) {
519-
BOOT_LOG_ERR("PSA crypto init failed %d", status);
520-
return 1;
521-
}
522-
523-
uint8_t reformatted_signature[96] = {0}; /* Enough for P-384 signature sizes */
524-
parse_signature_from_rfc5480_encoding(sig, ctx->curve_byte_count, reformatted_signature);
525-
526-
status = PSA_ERROR_BAD_STATE;
527-
528-
for (int i = 0; i < BOOT_SIGNATURE_BUILTIN_KEY_SLOTS; ++i) {
529-
psa_key_id_t kid = builtin_key_ids[i];
530-
531-
status = psa_verify_hash(kid, PSA_ALG_ECDSA(ctx->required_algorithm),
532-
hash, hlen, reformatted_signature, 2*ctx->curve_byte_count);
533-
if (status == PSA_SUCCESS) {
534-
break;
535-
}
536-
BOOT_LOG_ERR("ECDSA signature verification failed %d", status);
537-
}
538-
539-
return status == PSA_SUCCESS ? 0 : 2;
540-
}
541-
542-
#endif /* !CONFIG_NRF_BOOT_SIGNATURE_USING_ITS */
543-
544494
#elif defined(MCUBOOT_USE_MBED_TLS)
545495

546496
typedef mbedtls_ecdsa_context bootutil_ecdsa_context;

boot/bootutil/src/image_validate.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,7 @@ bootutil_img_validate(struct boot_loader_state *state,
514514
#endif
515515
)
516516
{
517-
#if (defined(EXPECTED_KEY_TLV) && defined(MCUBOOT_HW_KEY)) || defined(MCUBOOT_HW_ROLLBACK_PROT) || defined(MCUBOOT_DECOMPRESS_IMAGES) \
518-
|| defined(MCUBOOT_BUILTIN_KEY)
517+
#if (defined(EXPECTED_KEY_TLV) && defined(MCUBOOT_HW_KEY)) || defined(MCUBOOT_HW_ROLLBACK_PROT) || defined(MCUBOOT_DECOMPRESS_IMAGES)
519518
int image_index = (state == NULL ? 0 : BOOT_CURR_IMG(state));
520519
#endif
521520
uint32_t off;

boot/zephyr/Kconfig

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -422,14 +422,7 @@ config BOOT_KMU_KEYS_REVOCATION
422422
help
423423
Enabling KMU key revocation backend.
424424

425-
config NRF_BOOT_SIGNATURE_USING_ITS
426-
bool "Use ITS stored keys for signature verification"
427-
depends on NRF_SECURITY
428-
help
429-
MCUboot will use keys provisioned to the internal trusted storage for signature
430-
verification instead of compiling in key data from a file.
431-
432-
if !BOOT_SIGNATURE_USING_KMU && !NRF_BOOT_SIGNATURE_USING_ITS
425+
if !BOOT_SIGNATURE_USING_KMU
433426

434427
config BOOT_SIGNATURE_KEY_FILE
435428
string "PEM key file"

boot/zephyr/include/mcuboot_config/mcuboot_config.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@
6868
#define MCUBOOT_HW_KEY
6969
#endif
7070

71-
#ifdef CONFIG_NRF_BOOT_SIGNATURE_USING_ITS
72-
#define MCUBOOT_BUILTIN_KEY
73-
#endif
74-
7571
#ifdef CONFIG_BOOT_VALIDATE_SLOT0
7672
#define MCUBOOT_VALIDATE_PRIMARY_SLOT
7773
#endif

0 commit comments

Comments
 (0)