summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJi Luo <ji.luo@nxp.com>2019-06-22 10:18:01 +0800
committerJi Luo <ji.luo@nxp.com>2020-05-18 09:45:08 +0800
commit0532229cea2df862b807831ca3bcacab4104b853 (patch)
tree88827eb5bdd1368017d4c67de77de4b2f711691d /lib
parentbb4943caeca9fc8d8e1b6542e1be55c942f4aa14 (diff)
MA-15017 Add new command to generate bkek from trusty
Add new command to generate bkek from trusty. Test: generate and dump bkek. Change-Id: I6b2a30b87c755eecd00ced7c53cfb86e432040de Signed-off-by: Ji Luo <ji.luo@nxp.com> (cherry picked from commit 6c1087c030de491a12b7f1be9d332f30ba27d183)
Diffstat (limited to 'lib')
-rw-r--r--lib/trusty/ql-tipc/hwcrypto.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/trusty/ql-tipc/hwcrypto.c b/lib/trusty/ql-tipc/hwcrypto.c
index ccaf18b427..50532b005b 100644
--- a/lib/trusty/ql-tipc/hwcrypto.c
+++ b/lib/trusty/ql-tipc/hwcrypto.c
@@ -240,3 +240,25 @@ int hwcrypto_gen_rng(uint32_t buf, uint32_t len)
sizeof(req), NULL, 0, false);
return rc;
}
+
+int hwcrypto_gen_bkek(uint32_t buf, uint32_t len)
+{
+ hwcrypto_bkek_msg req;
+ unsigned long start, end;
+
+ /* check the address */
+ if (buf == 0)
+ return TRUSTY_ERR_INVALID_ARGS;
+ /* fill the request buffer */
+ req.buf = buf;
+ req.len = len;
+
+ /* invalidate dcache for output buffer */
+ start = (unsigned long)buf & ~(ARCH_DMA_MINALIGN - 1);
+ end = ALIGN((unsigned long)buf + len, ARCH_DMA_MINALIGN);
+ invalidate_dcache_range(start, end);
+
+ int rc = hwcrypto_do_tipc(HWCRYPTO_GEN_BKEK, (void*)&req,
+ sizeof(req), NULL, 0, false);
+ return rc;
+}