fw: Remove pre loaded app auth and status from partition table

This commit is contained in:
Mikael Ågren 2025-03-25 15:00:40 +01:00
parent f590f423a3
commit 715d792d86
No known key found for this signature in database
GPG key ID: E02DA3D397792C46
4 changed files with 9 additions and 70 deletions

View file

@ -12,7 +12,6 @@
#include <tkey/tk1_mem.h>
#include <tkey/led.h>
#include "auth_app.h"
#include "blake2s/blake2s.h"
#include "partition_table.h"
#include "preload_app.h"
@ -412,28 +411,6 @@ static int load_flash_app(struct partition_table *part_table,
return 0;
}
static enum state auth_flash_app(const struct context *ctx, struct partition_table *part_table)
{
if (ctx->flash_slot >= N_PRELOADED_APP) {
return FW_STATE_FAIL;
}
if (part_table->pre_app_data[ctx->flash_slot].status == PRE_LOADED_STATUS_PRESENT) {
debug_puts("Create auth\n");
auth_app_create(&part_table->pre_app_data[ctx->flash_slot].auth);
part_table->pre_app_data[ctx->flash_slot].status = PRE_LOADED_STATUS_AUTH;
part_table_write(part_table);
}
if (!auth_app_authenticate(&part_table->pre_app_data[ctx->flash_slot].auth)) {
debug_puts("!Authenticated\n");
return FW_STATE_FAIL;
}
return FW_STATE_START;
}
#if !defined(SIMULATION)
static uint32_t xorwow(uint32_t state, uint32_t acc)
{
@ -617,10 +594,6 @@ int main(void)
break;
case FW_STATE_LOAD_FLASH:
// TODO Just lie and say that an app is present but not yet
// authenticated.
part_table.pre_app_data[ctx.flash_slot].status = PRE_LOADED_STATUS_PRESENT;
if (load_flash_app(&part_table, ctx.digest, ctx.flash_slot) < 0) {
debug_puts("Couldn't load app from flash\n");
state = FW_STATE_FAIL;
@ -638,7 +611,7 @@ int main(void)
// CDI = hash(uds, hash(app), uss)
compute_cdi(ctx.digest, ctx.use_uss, ctx.uss);
state = auth_flash_app(&ctx, &part_table);
state = FW_STATE_START;
break;
case FW_STATE_START: