| #
c216899e |
| 10-Jul-2024 |
Thomas Perrot <thomas.perrot@bootlin.com> |
drivers: nvmem: nvmem-huk: fix cell size and memory allocation issues
No longer free the HUK cell after at the end of the "tee_otp_get_hw_unique_key" execution, because for the regression test 4013,
drivers: nvmem: nvmem-huk: fix cell size and memory allocation issues
No longer free the HUK cell after at the end of the "tee_otp_get_hw_unique_key" execution, because for the regression test 4013, the "tee_otp_get_hw_unique_key" callback isn't re-called then an invalid huk_cell pointer is used, leading the following issue:
E/TC:0 0 Core data-abort at address 0x0 (translation fault) E/TC:0 0 fsr 0x00000005 ttbr0 0x20087859 ttbr1 0x20080059 cidr 0x2 E/TC:0 0 cpu #0 cpsr 0x60000133 E/TC:0 0 r0 0x2007d8e8 r4 0x2007d8e8 r8 0x00102010 r12 0xfffc2a40 E/TC:0 0 r1 0x20089528 r5 0x2008954c r9 0x00000010 sp 0x20089508 E/TC:0 0 r2 0x20059164 r6 0x20060188 r10 0x00000020 lr 0x2000bcb3 E/TC:0 0 r3 0x00000000 r7 0x2008954c r11 0x20089684 pc 0x2000baa2 E/TC:0 0 TEE load address @ 0x20000000 E/TC:0 0 Call stack: E/TC:0 0 0x2000baa2 nvmem_cell_malloc_and_read at core/drivers/nvmem/nvmem.c:62 E/TC:0 0 0x2000bcb3 tee_otp_get_hw_unique_key at core/drivers/nvmem/nvmem_huk.c:23 E/TC:0 0 0x20010e9f __huk_subkey_derive at core/kernel/huk_subkey.c:78 E/TC:0 0 0x200178c9 system_derive_ta_unique_key at core/pta/system.c:122 E/TC:0 0 0x2001382b pseudo_ta_enter_invoke_cmd at core/kernel/pseudo_ta.c:209 E/TC:0 0 0x20010d95 tee_ta_invoke_command at core/kernel/tee_ta_manager.c:765 E/TC:0 0 0x20019567 syscall_invoke_ta_command at core/tee/tee_svc.c:871 E/TC:0 0 0x20002178 scall_do_call at core/arch/arm/kernel/arch_scall_a32.S:54 E/TC:0 0 Panic 'unhandled pageable abort' at core/arch/arm/kernel/abort.c:582 <abort_handler> E/TC:0 0 TEE load address @ 0x20000000 E/TC:0 0 Call stack: E/TC:0 0 0x200039b1 print_kernel_stack at core/arch/arm/kernel/unwind_arm32.c:109 E/TC:0 0 0x2000ff05 __do_panic at core/kernel/panic.c:80 E/TC:0 0 0x20002f01 get_fault_type at core/arch/arm/kernel/abort.c:498 E/TC:0 0 0x2000077c thread_excp_vect at core/arch/arm/kernel/thread_a32.S:758
Moreover, the length of the HW unique key must be 16 bytes. But the size of NVMEM cells can be larger than 16 bytes, for example on samad5 the SFC is using 32 bytes cells. These changes also allow the use of a NVMEM cell larger to the HW unique key length, using the first 16 bytes of a cell.
Finally, the instance of the NVMEM cell data will be allocated once, in the probe. Before, a new instance was allocated at each call to tee_otp_get_hw_unique_key().
Fixes: fc7169686724 ("drivers: nvmem: add nvmem-huk driver") Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| #
fc716968 |
| 27-Nov-2023 |
Thomas Perrot <thomas.perrot@bootlin.com> |
drivers: nvmem: add nvmem-huk driver
This driver is meant to read the OTP unique hardware key from a NVMEM controller. It uses the nvmem framework to read the NVMEM cells from the device tree.
Sign
drivers: nvmem: add nvmem-huk driver
This driver is meant to read the OTP unique hardware key from a NVMEM controller. It uses the nvmem framework to read the NVMEM cells from the device tree.
Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|