diff options
author | AnilKumar Chimata <anilc@codeaurora.org> | 2018-06-14 16:43:17 +0530 |
---|---|---|
committer | AnilKumar Chimata <anilc@codeaurora.org> | 2018-06-20 22:11:26 +0530 |
commit | 7cc34529cd52b1522ed60497437851758312c066 (patch) | |
tree | 330568278f9a7bf38c2149843cc193d0d72cf765 | |
parent | 36017216cce7d7fdf9c2b2eacc9835fd2d0f6d21 (diff) | |
download | android_vendor_qcom_opensource_cryptfs_hw-7cc34529cd52b1522ed60497437851758312c066.tar.gz android_vendor_qcom_opensource_cryptfs_hw-7cc34529cd52b1522ed60497437851758312c066.tar.bz2 android_vendor_qcom_opensource_cryptfs_hw-7cc34529cd52b1522ed60497437851758312c066.zip |
cryptfs: Allow vold to set encryption info
Vold needs to set partition and ICE specific
data before encryption starts.
Change-Id: Ie721f35d7f5cbb486d1d3895e42f992fe4bc51bf
-rw-r--r-- | cryptfs_hw.c | 22 | ||||
-rw-r--r-- | cryptfs_hw.h | 6 |
2 files changed, 28 insertions, 0 deletions
diff --git a/cryptfs_hw.c b/cryptfs_hw.c index 859b108..65618df 100644 --- a/cryptfs_hw.c +++ b/cryptfs_hw.c @@ -66,6 +66,8 @@ #define CRYPTFS_HW_WIPE_KEY_FAILED -8 #define CRYPTFS_HW_CREATE_KEY_FAILED -7 +#define CRYPTFS_HW_ALGO_MODE_AES_XTS 0x3 + enum cryptfs_hw_key_management_usage_type { CRYPTFS_HW_KM_USAGE_DISK_ENCRYPTION = 0x01, CRYPTFS_HW_KM_USAGE_FILE_ENCRYPTION = 0x02, @@ -171,6 +173,26 @@ static int cryptfs_hw_wipe_key(enum cryptfs_hw_key_management_usage_type usage) return ret; } +#ifdef QSEECOM_IOCTL_SET_ICE_INFO +int set_ice_param(int flag) +{ + int qseecom_fd, ret = -1; + struct qseecom_ice_data_t ice_data; + qseecom_fd = open("/dev/qseecom", O_RDWR); + if (qseecom_fd < 0) + return ret; + ice_data.flag = flag; + ret = ioctl(qseecom_fd, QSEECOM_IOCTL_SET_ICE_INFO, &ice_data); + close(qseecom_fd); + return ret; +} +#else +int set_ice_param(int flag) +{ + return -1; +} +#endif + static int cryptfs_hw_clear_key(enum cryptfs_hw_key_management_usage_type usage) { int32_t ret; diff --git a/cryptfs_hw.h b/cryptfs_hw.h index e857c47..65321eb 100644 --- a/cryptfs_hw.h +++ b/cryptfs_hw.h @@ -33,12 +33,18 @@ extern "C" { #endif +/*This is equivalent of MAX_CRYPTO_TYPE_NAME_LEN*/ +#define CRYPTO_ALGO_LENGTH 64 +#define START_ENC 0x1 +#define START_ENCDEC 0x3 + int set_hw_device_encryption_key(const char*, const char*); int update_hw_device_encryption_key(const char*, const char*, const char*); int clear_hw_device_encryption_key(); unsigned int is_hw_disk_encryption(const char*); int is_ice_enabled(void); int should_use_keymaster(); +int set_ice_param(int flag); #ifdef __cplusplus } |