Introduce symbolic names for present and present & authenticated

A preloaded app can be:

- present and not yet authenticated (0x01)
- present and authenticated (0x02)

Let's use symbolic names for these.
This commit is contained in:
Michael Cardell Widerkrantz 2025-03-13 16:36:54 +01:00
parent 980a3c84a1
commit c359a52905
No known key found for this signature in database
GPG Key ID: D3DB3DDF57E704E5
3 changed files with 9 additions and 4 deletions
hw/application_fpga/fw/tk1

@ -375,10 +375,10 @@ static void run_flash(const struct context *ctx, struct partition_table *part_ta
// CDI = hash(uds, hash(app), uss)
compute_cdi(ctx->digest, ctx->use_uss, ctx->uss);
if (part_table->pre_app_data.status == 0x02) {
if (part_table->pre_app_data.status == PRE_LOADED_STATUS_PRESENT) {
debug_puts("Create auth\n");
auth_app_create(&part_table->pre_app_data.auth);
part_table->pre_app_data.status = 0x01;
part_table->pre_app_data.status = PRE_LOADED_STATUS_AUTH;
part_table_write(part_table);
}
@ -508,7 +508,7 @@ int main(void)
assert(digest_err == 0);
print_digest(ctx.digest);
part_table.pre_app_data.status = 0x02;
part_table.pre_app_data.status = PRE_LOADED_STATUS_PRESENT;
state = FW_STATE_RUN_FLASH;

@ -37,6 +37,11 @@
#define ADDR_PRE_LOADED_APP (ADDR_PARTITION_TABLE + SIZE_PARTITION_TABLE)
#define SIZE_PRE_LOADED_APP 0x20000UL // 128KiB
// Pre-loaded app present and authenticated
#define PRE_LOADED_STATUS_AUTH 0x01
// Pre-loaded app present but not yet authenticated
#define PRE_LOADED_STATUS_PRESENT 0x02
#define ADDR_STORAGE_AREA (ADDR_PRE_LOADED_APP + SIZE_PRE_LOADED_APP)
#define SIZE_STORAGE_AREA 0x20000UL // 128KiB
#define N_STORAGE_AREA 4

@ -94,7 +94,7 @@ int preload_store_finalize(struct partition_table *part_table, bool use_uss,
part_table->pre_app_data.size = app_size;
part_table->pre_app_data.status =
0x02; /* Stored but not yet authenticated */
PRE_LOADED_STATUS_PRESENT; /* Stored but not yet authenticated */
debug_puts("preload_*_final: size: ");
debug_putinthex(app_size);
debug_lf();