mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2025-12-10 07:44:53 +01:00
common: cmd_aes: Add print for derived key value
Signed-off-by: Poovendhan Selvaraj <quic_poovendh@quicinc.com>
Change-Id: I5c51e7c7307f3b661ff6ce756845ee0225cc69f2
(cherry picked from commit 9dea41ab451ebc2c462a7d8b08cebf49ff12b9ca)
(cherry picked from commit 238d9a95bc)
This commit is contained in:
parent
45059c65ed
commit
1d7a2c9f08
1 changed files with 60 additions and 56 deletions
|
|
@ -158,16 +158,20 @@ static int do_derive_aes_256_key(cmd_tbl_t *cmdtp, int flag,
|
||||||
req_ptr->policy.key_type = DEFAULT_KEY_TYPE;
|
req_ptr->policy.key_type = DEFAULT_KEY_TYPE;
|
||||||
req_ptr->policy.destination = DEFAULT_POLICY_DESTINATION;
|
req_ptr->policy.destination = DEFAULT_POLICY_DESTINATION;
|
||||||
req_ptr->source = simple_strtoul(argv[1], NULL, 16);
|
req_ptr->source = simple_strtoul(argv[1], NULL, 16);
|
||||||
req_ptr->hw_key_bindings.bindings = simple_strtoul(argv[2],
|
req_ptr->hw_key_bindings.bindings = simple_strtoul(argv[2], NULL, 16);
|
||||||
NULL, 16);
|
|
||||||
req_ptr->key = (uintptr_t) key_handle;
|
req_ptr->key = (uintptr_t) key_handle;
|
||||||
req_ptr->mixing_key = 0;
|
req_ptr->mixing_key = 0;
|
||||||
req_ptr->hw_key_bindings.context_len = context_len;
|
req_ptr->hw_key_bindings.context_len = context_len;
|
||||||
|
|
||||||
while (i < context_len) {
|
while (i < context_len) {
|
||||||
req_ptr->hw_key_bindings.context[j++] = context_buf[i++];
|
req_ptr->hw_key_bindings.context[j++] = context_buf[i++];
|
||||||
}
|
}
|
||||||
ret = qca_scm_crypto(TZ_CRYPTO_SERVICE_AES_DERIVE_KEY_ID,
|
ret = qca_scm_crypto(TZ_CRYPTO_SERVICE_AES_DERIVE_KEY_ID,
|
||||||
(void *)req_ptr, sizeof(struct crypto_aes_derive_key_cmd_t_v1));
|
(void *)req_ptr, sizeof(struct crypto_aes_derive_key_cmd_t_v1));
|
||||||
|
if (ret)
|
||||||
|
printf("Scm call failed with error code: %d\n", ret);
|
||||||
|
else
|
||||||
|
printf("Key handle is %u\n", (unsigned int)*key_handle);
|
||||||
|
|
||||||
if (key_handle)
|
if (key_handle)
|
||||||
free(key_handle);
|
free(key_handle);
|
||||||
|
|
@ -224,8 +228,7 @@ static int do_derive_aes_256_max_ctxt_key(cmd_tbl_t *cmdtp, int flag,
|
||||||
MAX_CONTEXT_BUFFER_LEN_V2);
|
MAX_CONTEXT_BUFFER_LEN_V2);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
key_handle = (uintptr_t *)memalign(ARCH_DMA_MINALIGN,
|
key_handle = (uintptr_t *)memalign(ARCH_DMA_MINALIGN, sizeof(uint64_t));
|
||||||
sizeof(uint64_t));
|
|
||||||
req_ptr = (struct crypto_aes_derive_key_cmd_t_v2 *)memalign(ARCH_DMA_MINALIGN,
|
req_ptr = (struct crypto_aes_derive_key_cmd_t_v2 *)memalign(ARCH_DMA_MINALIGN,
|
||||||
sizeof(struct crypto_aes_derive_key_cmd_t_v2));
|
sizeof(struct crypto_aes_derive_key_cmd_t_v2));
|
||||||
if (!req_ptr) {
|
if (!req_ptr) {
|
||||||
|
|
@ -240,16 +243,17 @@ static int do_derive_aes_256_max_ctxt_key(cmd_tbl_t *cmdtp, int flag,
|
||||||
req_ptr->key = (uintptr_t) key_handle;
|
req_ptr->key = (uintptr_t) key_handle;
|
||||||
req_ptr->mixing_key = 0;
|
req_ptr->mixing_key = 0;
|
||||||
req_ptr->hw_key_bindings.context_len = context_len;
|
req_ptr->hw_key_bindings.context_len = context_len;
|
||||||
|
|
||||||
while (i < context_len) {
|
while (i < context_len) {
|
||||||
req_ptr->hw_key_bindings.context[j++] = context_buf[i++];
|
req_ptr->hw_key_bindings.context[j++] = context_buf[i++];
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = qca_scm_crypto(TZ_CRYPTO_SERVICE_AES_DERIVE_128_KEY_ID,
|
ret = qca_scm_crypto(TZ_CRYPTO_SERVICE_AES_DERIVE_128_KEY_ID,
|
||||||
(void *)req_ptr, sizeof(struct crypto_aes_derive_key_cmd_t_v2));
|
(void *)req_ptr, sizeof(struct crypto_aes_derive_key_cmd_t_v2));
|
||||||
if (ret)
|
if (ret)
|
||||||
printf("Scm call failed with error code: %d\n", ret);
|
printf("Scm call failed with error code: %d\n", ret);
|
||||||
else {
|
else
|
||||||
printf("Key handle is %u\n", (unsigned int)*key_handle);
|
printf("Key handle is %u\n", (unsigned int)*key_handle);
|
||||||
}
|
|
||||||
|
|
||||||
if (key_handle)
|
if (key_handle)
|
||||||
free(key_handle);
|
free(key_handle);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue