summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-11-01 16:05:34 +0000
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-11-01 16:05:34 +0000
commitb2310a33f801b9e676467c101f11903ad4eaacbe (patch)
treec401059de962c1df5ab4c2b728273c68d8b651ba
parent15c1af6c4ccdcd7f943060a32b82312286ca43db (diff)
parent27e66b721ed6472fb319b0421ca460713a1b2df5 (diff)
downloadandroid_hardware_qcom_keymaster-b2310a33f801b9e676467c101f11903ad4eaacbe.tar.gz
android_hardware_qcom_keymaster-b2310a33f801b9e676467c101f11903ad4eaacbe.tar.bz2
android_hardware_qcom_keymaster-b2310a33f801b9e676467c101f11903ad4eaacbe.zip
Merge tag 'android-4.4_r1' into cm-11.0
Android 4.4 Release 1.0
-rw-r--r--Android.mk6
-rw-r--r--keymaster_qcom.cpp50
2 files changed, 53 insertions, 3 deletions
diff --git a/Android.mk b/Android.mk
index 8de1dd3..d8408cd 100644
--- a/Android.mk
+++ b/Android.mk
@@ -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
@@ -28,4 +28,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 f3907b0..55220d1 100644
--- a/keymaster_qcom.cpp
+++ b/keymaster_qcom.cpp
@@ -70,6 +70,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;
@@ -349,10 +350,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;
@@ -422,10 +432,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);
@@ -512,9 +531,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);
@@ -604,10 +634,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);
@@ -669,6 +710,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;