summaryrefslogtreecommitdiff
path: root/lib/trusty
diff options
context:
space:
mode:
authorJi Luo <ji.luo@nxp.com>2019-06-22 10:18:01 +0800
committerJi Luo <ji.luo@nxp.com>2022-04-18 16:40:08 +0800
commit17252016a97bd864338963207ac527f67e35ba4f (patch)
tree848f0dad2839720ef0e00562b04bfda09892fb7e /lib/trusty
parent9dffdcb12845d849693800b8f0fa3e6026d7c6a7 (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) (cherry picked from commit 02f0cd1484bc8883d784e08ea9c8fd2e9fc7dd3d) (cherry picked from commit 2ad901636baf6678c6a1e42d51e7fd1d1772c316)
Diffstat (limited to 'lib/trusty')
-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;
+}