diff options
Diffstat (limited to 'security/pfe/pfk_ice.c')
| -rw-r--r-- | security/pfe/pfk_ice.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/security/pfe/pfk_ice.c b/security/pfe/pfk_ice.c index 2f09d8801a96..facecedc3827 100644 --- a/security/pfe/pfk_ice.c +++ b/security/pfe/pfk_ice.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -64,7 +64,8 @@ uint8_t ice_key[ICE_KEY_SIZE]; uint8_t ice_salt[ICE_KEY_SIZE]; -int qti_pfk_ice_set_key(uint32_t index, uint8_t *key, uint8_t *salt) +int qti_pfk_ice_set_key(uint32_t index, uint8_t *key, uint8_t *salt, + char *storage_type) { struct scm_desc desc = {0}; int ret; @@ -84,6 +85,9 @@ int qti_pfk_ice_set_key(uint32_t index, uint8_t *key, uint8_t *salt) if (!tzbuf_key || !tzbuf_salt) return -ENOMEM; + if (storage_type == NULL) + return -EINVAL; + memset(tzbuf_key, 0, tzbuflen_key); memset(tzbuf_salt, 0, tzbuflen_salt); @@ -103,7 +107,8 @@ int qti_pfk_ice_set_key(uint32_t index, uint8_t *key, uint8_t *salt) desc.args[3] = virt_to_phys(tzbuf_salt); desc.args[4] = tzbuflen_salt; - ret = qcom_ice_setup_ice_hw("ufs", true); + ret = qcom_ice_setup_ice_hw((const char *)storage_type, true); + if (ret) { pr_err("%s: could not enable clocks: 0x%x\n", __func__, ret); return ret; @@ -111,7 +116,7 @@ int qti_pfk_ice_set_key(uint32_t index, uint8_t *key, uint8_t *salt) ret = scm_call2(smc_id, &desc); - qcom_ice_setup_ice_hw("ufs", false); + ret = qcom_ice_setup_ice_hw((const char *)storage_type, false); pr_debug(" %s , ret = %d\n", __func__, ret); if (ret) { @@ -127,7 +132,7 @@ int qti_pfk_ice_set_key(uint32_t index, uint8_t *key, uint8_t *salt) } -int qti_pfk_ice_invalidate_key(uint32_t index) +int qti_pfk_ice_invalidate_key(uint32_t index, char *storage_type) { struct scm_desc desc = {0}; int ret; @@ -137,13 +142,17 @@ int qti_pfk_ice_invalidate_key(uint32_t index) if (index < MIN_ICE_KEY_INDEX || index > MAX_ICE_KEY_INDEX) return -EINVAL; + if (storage_type == NULL) + return -EINVAL; + smc_id = TZ_ES_INVALIDATE_ICE_KEY_ID; pr_debug(" %s , smc_id = 0x%x\n", __func__, smc_id); desc.arginfo = TZ_ES_INVALIDATE_ICE_KEY_PARAM_ID; desc.args[0] = index; - ret = qcom_ice_setup_ice_hw("ufs", true); + ret = qcom_ice_setup_ice_hw((const char *)storage_type, true); + if (ret) { pr_err("%s: could not enable clocks: 0x%x\n", __func__, ret); return ret; @@ -151,7 +160,7 @@ int qti_pfk_ice_invalidate_key(uint32_t index) ret = scm_call2(smc_id, &desc); - qcom_ice_setup_ice_hw("ufs", false); + ret = qcom_ice_setup_ice_hw((const char *)storage_type, false); pr_debug(" %s , ret = %d\n", __func__, ret); if (ret) |
