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
13 changes: 8 additions & 5 deletions boot/bootutil/src/ed25519_psa.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ static psa_key_id_t key_ids[] = {

#if defined(CONFIG_BOOT_KMU_KEYS_REVOCATION)
#include <bootutil/key_revocation.h>
static psa_key_id_t *validated_with = NULL;
#define VALIDATED_WITH_UNINITIALIZED INT32_MAX
static int32_t validated_with = VALIDATED_WITH_UNINITIALIZED;
#endif

BUILD_ASSERT(CONFIG_BOOT_SIGNATURE_KMU_SLOTS <= ARRAY_SIZE(key_ids),
Expand Down Expand Up @@ -142,7 +143,9 @@ int ED25519_verify(const uint8_t *message, size_t message_len,
EDDSA_SIGNAGURE_LENGTH);
if (status == PSA_SUCCESS) {
#if defined(CONFIG_BOOT_KMU_KEYS_REVOCATION)
validated_with = key_ids + i;
if(i < validated_with) {
validated_with = i;
}
#endif
return 1;
}
Expand All @@ -159,7 +162,7 @@ int exec_revoke(void)
int ret = BOOT_KEY_REVOKE_OK;
psa_status_t status = psa_crypto_init();

if (!validated_with) {
if (validated_with == VALIDATED_WITH_UNINITIALIZED) {
ret = BOOT_KEY_REVOKE_INVALID;
goto out;
}
Expand All @@ -170,7 +173,7 @@ int exec_revoke(void)
goto out;
}
for (int i = 0; i < CONFIG_BOOT_SIGNATURE_KMU_SLOTS; i++) {
if ((key_ids + i) == validated_with) {
if ( i == validated_with) {
break;
}
BOOT_LOG_DBG("Invalidating key ID %d", i);
Expand All @@ -179,7 +182,7 @@ int exec_revoke(void)
if (status == PSA_SUCCESS) {
BOOT_LOG_DBG("Success on key ID %d", i);
} else {
BOOT_LOG_ERR("Key invalidation failed with: %d", status);
BOOT_LOG_DBG("Key invalidation failed with: %d", status);
}
}
out:
Expand Down
10 changes: 10 additions & 0 deletions boot/zephyr/firmware_loader_bm.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "bootutil/bootutil_public.h"
#include "bootutil/fault_injection_hardening.h"
#include <bm_installs.h>
#include "bootutil/key_revocation.h"

#include "io/io.h"
#include "mcuboot_config/mcuboot_config.h"
Expand Down Expand Up @@ -249,6 +250,15 @@ boot_go(struct boot_rsp *rsp)
}
#endif

#if defined(CONFIG_BOOT_KEYS_REVOCATION)
if (softdevice_image_valid == true && firmware_loader_image_valid == true) {
allow_revoke();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use nrf-squash! and existing commit to squash to

if (revoke() != BOOT_KEY_REVOKE_OK) {
return -1;
}
}
#endif /*CONFIG_BOOT_KEYS_REVOCATION*/

if (app_installer_image_valid == true && app_installer_is_installer_image == true) {
/* Installer image is present, this gets priority */
BOOT_LOG_DBG("Booting installer");
Expand Down