diff --git a/hw/application_fpga/fw/tk1/main.c b/hw/application_fpga/fw/tk1/main.c index 4232936..a098619 100644 --- a/hw/application_fpga/fw/tk1/main.c +++ b/hw/application_fpga/fw/tk1/main.c @@ -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; diff --git a/hw/application_fpga/fw/tk1/partition_table.h b/hw/application_fpga/fw/tk1/partition_table.h index 7a954bb..361bbe3 100644 --- a/hw/application_fpga/fw/tk1/partition_table.h +++ b/hw/application_fpga/fw/tk1/partition_table.h @@ -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 diff --git a/hw/application_fpga/fw/tk1/preload_app.c b/hw/application_fpga/fw/tk1/preload_app.c index f47d021..7f929bc 100644 --- a/hw/application_fpga/fw/tk1/preload_app.c +++ b/hw/application_fpga/fw/tk1/preload_app.c @@ -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();