Skip to content

Commit

Permalink
plat-ti: Read and store HUK sent by initial secure software
Browse files Browse the repository at this point in the history
Some TI platforms pass the HUK to OP-TEE via a secure memory stack. Read
and store this key for later use. On platforms without CFG_OTP_SUPPORT
this key is ignored.

Signed-off-by: Andrew F. Davis <afd@ti.com>
  • Loading branch information
glneo committed Apr 21, 2017
1 parent 79fdd7c commit d25dd27
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/arch/arm/plat-ti/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@
#include <console.h>
#include <sm/sm.h>

#define PLAT_HW_UNIQUE_KEY_LENGTH 32

static struct gic_data gic_data;
static struct serial8250_uart_data console_data __early_bss;
static uint8_t plat_huk[PLAT_HW_UNIQUE_KEY_LENGTH];

register_phys_mem(MEM_AREA_IO_SEC, SECRAM_BASE, SECRAM_SIZE);
register_phys_mem(MEM_AREA_IO_SEC, GICC_BASE, GICC_SIZE);
Expand Down Expand Up @@ -127,6 +130,7 @@ struct plat_nsec_ctx {

struct plat_boot_args {
struct plat_nsec_ctx nsec_ctx;
uint8_t huk[PLAT_HW_UNIQUE_KEY_LENGTH];
};

void init_sec_mon(unsigned long nsec_entry)
Expand Down Expand Up @@ -161,6 +165,8 @@ void init_sec_mon(unsigned long nsec_entry)
nsec_ctx->mode_regs.und_lr = plat_boot_args->nsec_ctx.und_lr;
nsec_ctx->mon_lr = plat_boot_args->nsec_ctx.mon_lr;
nsec_ctx->mon_spsr = plat_boot_args->nsec_ctx.mon_spsr;

memcpy(&plat_huk[0], &plat_boot_args->huk[0], sizeof(plat_boot_args->huk));
}

void console_init(void)
Expand Down

0 comments on commit d25dd27

Please sign in to comment.