diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2013-11-22 10:35:27 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2013-11-22 10:35:27 -0800 |
commit | 099a9d06ec12006985a71133de289bdd92eb2f3b (patch) | |
tree | 968bc96593217c67fc6b9ebad42058a024484edb | |
parent | f740c98b96e14557b630ec5b16a2125afe424a2d (diff) | |
parent | 7d563651aa956c0f9831b7b64be35c2ec790bdec (diff) | |
download | android_hardware_qcom_keymaster-099a9d06ec12006985a71133de289bdd92eb2f3b.tar.gz android_hardware_qcom_keymaster-099a9d06ec12006985a71133de289bdd92eb2f3b.tar.bz2 android_hardware_qcom_keymaster-099a9d06ec12006985a71133de289bdd92eb2f3b.zip |
Merge commit '7d563651aa956c0f9831b7b64be35c2ec790bdec' into HEAD
-rw-r--r-- | Android.mk | 6 | ||||
-rw-r--r-- | keymaster_qcom.cpp | 50 |
2 files changed, 53 insertions, 3 deletions
@@ -1,10 +1,10 @@ LOCAL_PATH := $(call my-dir) -ifneq ($(filter msm8960,$(TARGET_BOARD_PLATFORM)),) +ifneq ($(filter msm8960 msm8974 msm8226,$(TARGET_BOARD_PLATFORM)),) include $(CLEAR_VARS) -LOCAL_MODULE := keystore.msm8960 +LOCAL_MODULE := keystore.$(TARGET_BOARD_PLATFORM) LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw @@ -27,4 +27,4 @@ LOCAL_MODULE_TAGS := optional include $(BUILD_SHARED_LIBRARY) -endif # msm8960 == TARGET_BOARD_PLATFORM +endif # TARGET_BOARD_PLATFORM diff --git a/keymaster_qcom.cpp b/keymaster_qcom.cpp index 0058b09..2284290 100644 --- a/keymaster_qcom.cpp +++ b/keymaster_qcom.cpp @@ -71,6 +71,7 @@ struct qcom_keymaster_handle { int (*QSEECom_send_modified_cmd)(struct QSEECom_handle* handle, void *cbuf, uint32_t clen, void *rbuf, uint32_t rlen, struct QSEECom_ion_fd_info *ihandle); + int (*QSEECom_set_bandwidth)(struct QSEECom_handle* handle, bool high); }; typedef struct qcom_keymaster_handle qcom_keymaster_handle_t; @@ -350,10 +351,19 @@ static int qcom_km_generate_keypair(const keymaster_device_t* dev, resp->status = KEYMASTER_FAILURE; resp->key_blob_len = sizeof(qcom_km_key_blob_t); + ret = (*km_handle->QSEECom_set_bandwidth)(handle, true); + if (ret < 0) { + ALOGE("Generate key command failed (unable to enable clks) ret =%d", ret); + return -1; + } + ret = (*km_handle->QSEECom_send_cmd)(handle, send_cmd, QSEECOM_ALIGN(sizeof(keymaster_gen_keypair_cmd_t)), resp, QSEECOM_ALIGN(sizeof(keymaster_gen_keypair_resp_t))); + if((*km_handle->QSEECom_set_bandwidth)(handle, false)) + ALOGE("Import key command: (unable to disable clks)"); + if ( (ret < 0) || (resp->status < 0)) { ALOGE("Generate key command failed resp->status = %d ret =%d", resp->status, ret); return -1; @@ -423,10 +433,19 @@ static int qcom_km_import_keypair(const keymaster_device_t* dev, resp->status = KEYMASTER_FAILURE; resp->key_blob_len = sizeof(qcom_km_key_blob_t); + ret = (*km_handle->QSEECom_set_bandwidth)(handle, true); + if (ret < 0) { + ALOGE("Import key command failed (unable to enable clks) ret =%d", ret); + qcom_km_ion_dealloc(&ihandle); + return -1; + } ret = (*km_handle->QSEECom_send_modified_cmd)(handle, send_cmd, QSEECOM_ALIGN(sizeof(*send_cmd)), resp, QSEECOM_ALIGN(sizeof(*resp)), &ion_fd_info); + if((*km_handle->QSEECom_set_bandwidth)(handle, false)) + ALOGE("Import key command: (unable to disable clks)"); + if ( (ret < 0) || (resp->status < 0)) { ALOGE("Import key command failed resp->status = %d ret =%d", resp->status, ret); qcom_km_ion_dealloc(&ihandle); @@ -513,9 +532,20 @@ static int qcom_km_sign_data(const keymaster_device_t* dev, resp->sig_len = KM_KEY_SIZE_MAX; resp->status = KEYMASTER_FAILURE; + ret = (*km_handle->QSEECom_set_bandwidth)(handle, true); + if (ret < 0) { + ALOGE("Sign data command failed (unable to enable clks) ret =%d", ret); + qcom_km_ion_dealloc(&ihandle); + return -1; + } + ret = (*km_handle->QSEECom_send_modified_cmd)(handle, send_cmd, QSEECOM_ALIGN(sizeof(*send_cmd)), resp, QSEECOM_ALIGN(sizeof(*resp)), &ion_fd_info); + + if((*km_handle->QSEECom_set_bandwidth)(handle, false)) + ALOGE("Sign data command: (unable to disable clks)"); + if ( (ret < 0) || (resp->status < 0)) { ALOGE("Sign data command failed resp->status = %d ret =%d", resp->status, ret); qcom_km_ion_dealloc(&ihandle); @@ -605,10 +635,21 @@ static int qcom_km_verify_data(const keymaster_device_t* dev, memcpy(((unsigned char *)ihandle.ion_sbuffer + signedDataLength), signature, signatureLength); resp->status = KEYMASTER_FAILURE; + + ret = (*km_handle->QSEECom_set_bandwidth)(handle, true); + if (ret < 0) { + ALOGE("Verify data command failed (unable to enable clks) ret =%d", ret); + qcom_km_ion_dealloc(&ihandle); + return -1; + } + ret = (*km_handle->QSEECom_send_modified_cmd)(handle, send_cmd, QSEECOM_ALIGN(sizeof(*send_cmd)), resp, QSEECOM_ALIGN(sizeof(*resp)), &ion_fd_info); + if((*km_handle->QSEECom_set_bandwidth)(handle, false)) + ALOGE("Verify data command: (unable to disable clks)"); + if ( (ret < 0) || (resp->status < 0)) { ALOGE("Verify data command failed resp->status = %d ret =%d", resp->status, ret); qcom_km_ion_dealloc(&ihandle); @@ -670,6 +711,15 @@ static int qcom_km_get_lib_sym(qcom_keymaster_handle_t* km_handle) km_handle->libhandle = NULL; return -1; } + *(void **)(&km_handle->QSEECom_set_bandwidth) = + dlsym(km_handle->libhandle,"QSEECom_set_bandwidth"); + if (km_handle->QSEECom_set_bandwidth == NULL) { + ALOGE("dlsym: Error Loading QSEECom_set_bandwidth"); + dlclose(km_handle->libhandle ); + km_handle->libhandle = NULL; + return -1; + } + } else { ALOGE("failed to load qseecom library"); return -1; |