mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 13:49:24 -04:00
Merge "soc: qcom: hwkm: check key size before unwrap"
This commit is contained in:
commit
fac58968a5
1 changed files with 8 additions and 0 deletions
|
|
@ -44,6 +44,8 @@ int retries;
|
|||
#define WAIT_UNTIL(cond) \
|
||||
for (retries = 0; !(cond) && (retries < MAX_RETRIES); retries++)
|
||||
|
||||
#define EXPECTED_UNWRAP_KEY_SIZE 68
|
||||
|
||||
#define ICEMEM_SLAVE_TPKEY_VAL 0x192
|
||||
#define ICEMEM_SLAVE_TPKEY_SLOT 0x92
|
||||
#define KM_MASTER_TPKEY_SLOT 10
|
||||
|
|
@ -473,6 +475,12 @@ static int qti_handle_key_unwrap_import(const struct hwkm_cmd *cmd_in,
|
|||
|
||||
pr_debug("%s: KEY_UNWRAP_IMPORT start\n", __func__);
|
||||
|
||||
if (cmd_in->unwrap.sz != EXPECTED_UNWRAP_KEY_SIZE) {
|
||||
pr_err("%s: Invalid key size - %d\n", __func__,
|
||||
cmd_in->unwrap.sz);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
memcpy(cmd, &operation, OPERATION_INFO_LENGTH);
|
||||
memcpy(cmd + COMMAND_WRAPPED_KEY_IDX, cmd_in->unwrap.wkb,
|
||||
cmd_in->unwrap.sz);
|
||||
|
|
|
|||
Loading…
Reference in a new issue