diff options
author | Breno Lima <breno.lima@nxp.com> | 2018-03-23 17:05:47 -0300 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2018-04-27 06:14:58 -0700 |
commit | fe33f7296336b7364fb24ad21b0be32eb5810262 (patch) | |
tree | e366d7622cbd4dfd361ade58b6fb0574bb40a847 /cmd | |
parent | acda6159eefbefaee15b19568fd1c4665c047432 (diff) |
MLK-17915: cmd: blob: Instantiate RNG before running CMD_BLOB
U-Boot can instantiate CAAM RNG if needed by crypto operations.
Call sec_init() prior running a blob operation to ensure
RNG is correctly instantiated.
Make sure CAAM clock is enabled and check if a job ring is
available for that operation.
Signed-off-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit b2b745515d06f05ea288524e26cf2389d6924ff2)
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/blob.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cmd/blob.c b/cmd/blob.c index bdd4cfda0b3..8d96fd687d0 100644 --- a/cmd/blob.c +++ b/cmd/blob.c @@ -11,6 +11,10 @@ #include <malloc.h> #include <asm/byteorder.h> #include <linux/compiler.h> +#if defined(CONFIG_ARCH_MX6) || defined(CONFIG_ARCH_MX7) +#include <fsl_sec.h> +#include <asm/arch/clock.h> +#endif DECLARE_GLOBAL_DATA_PTR; @@ -77,6 +81,16 @@ static int do_blob(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) src_ptr = (uint8_t *)(uintptr_t)src_addr; dst_ptr = (uint8_t *)(uintptr_t)dst_addr; +#if defined(CONFIG_ARCH_MX6) || defined(CONFIG_ARCH_MX7) + + hab_caam_clock_enable(1); + + u32 out_jr_size = sec_in32(CONFIG_SYS_FSL_JR0_ADDR + + FSL_CAAM_ORSR_JRa_OFFSET); + if (out_jr_size != FSL_CAAM_MAX_JR_SIZE) + sec_init(); +#endif + if (enc) ret = blob_encap(km_ptr, src_ptr, dst_ptr, len); else |