summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnilKumar Chimata <anilc@codeaurora.org>2014-12-09 19:44:16 (GMT)
committerZhao Wei Liew <zhaoweiliew@gmail.com>2017-02-12 12:43:50 (GMT)
commit53ae3b48568b97117d81cfb3ea938f8a3a4acb5d (patch)
treefd95f18bb810112bdb98f054e43f168babb545a7
parent1ecf84f4002cc250ce688e18d43547b07b86234b (diff)
downloadandroid_vendor_qcom_opensource_cryptfs_hw-53ae3b48568b97117d81cfb3ea938f8a3a4acb5d.zip
android_vendor_qcom_opensource_cryptfs_hw-53ae3b48568b97117d81cfb3ea938f8a3a4acb5d.tar.gz
android_vendor_qcom_opensource_cryptfs_hw-53ae3b48568b97117d81cfb3ea938f8a3a4acb5d.tar.bz2
cryptfs_hw: Add support for wipe_key routine
Add support for wipe_key routine to clean key. Change-Id: I9e258e1506d0634c4fc5b5142475005f6eb51c4e
-rwxr-xr-xcryptfs_hw.c24
-rwxr-xr-xcryptfs_hw.h1
2 files changed, 23 insertions, 2 deletions
diff --git a/cryptfs_hw.c b/cryptfs_hw.c
index 76609ff..a7164ab 100755
--- a/cryptfs_hw.c
+++ b/cryptfs_hw.c
@@ -66,6 +66,7 @@ static int loaded_library = 0;
static unsigned char current_passwd[MAX_PASSWORD_LEN];
static int (*qseecom_create_key)(int, void*);
static int (*qseecom_update_key)(int, void*, void*);
+static int (*qseecom_wipe_key)(int);
static int map_usage(int usage)
{
@@ -127,8 +128,16 @@ static int load_qseecom_library()
if((error = dlerror()) == NULL) {
SLOGD("Success loading QSEECom_create_key \n");
*(void **) (&qseecom_update_key) = dlsym(handle,"QSEECom_update_key_user_info");
- if ((error = dlerror()) == NULL)
- loaded_library = 1;
+ if ((error = dlerror()) == NULL) {
+ SLOGD("Success loading QSEECom_update_key_user_info\n");
+ *(void **) (&qseecom_wipe_key) = dlsym(handle,"QSEECom_wipe_key");
+ if ((error = dlerror()) == NULL) {
+ loaded_library = 1;
+ SLOGD("Success loading QSEECom_wipe_key \n");
+ }
+ else
+ SLOGE("Error %s loading symbols for QSEECom APIs \n", error);
+ }
else
SLOGE("Error %s loading symbols for QSEECom APIs \n", error);
}
@@ -212,3 +221,14 @@ int is_ice_enabled(void)
}
return storage_type;
}
+
+int wipe_hw_device_encryption_key(const char* enc_mode)
+{
+ if (!enc_mode)
+ return -1;
+
+ if (is_hw_disk_encryption(enc_mode) && load_qseecom_library())
+ return qseecom_wipe_key(map_usage(QSEECOM_DISK_ENCRYPTION));
+
+ return 0;
+}
diff --git a/cryptfs_hw.h b/cryptfs_hw.h
index 2fccd5d..c7b1746 100755
--- a/cryptfs_hw.h
+++ b/cryptfs_hw.h
@@ -35,6 +35,7 @@ extern "C" {
int set_hw_device_encryption_key(const char*, const char*);
int update_hw_device_encryption_key(const char*, const char*);
+int wipe_hw_device_encryption_key(const char*);
unsigned int is_hw_disk_encryption(const char*);
int is_ice_enabled(void);