diff options
author | Ji Luo <ji.luo@nxp.com> | 2019-06-22 10:18:01 +0800 |
---|---|---|
committer | Ji Luo <ji.luo@nxp.com> | 2019-07-17 11:45:19 +0800 |
commit | 827f6a10e4a1ca3dc4c3844cff3e97f5dcd35857 (patch) | |
tree | 7d94d2131097fa7a58df9c9a109ecc3a4a2e25da /lib | |
parent | 7a18b1643d7cd7c454b653e8cf1db83043824764 (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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/trusty/ql-tipc/hwcrypto.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/trusty/ql-tipc/hwcrypto.c b/lib/trusty/ql-tipc/hwcrypto.c index ccaf18b4279..50532b005b3 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; +} |