Loading drivers/misc/qseecom.c +14 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ #include <linux/ion_kernel.h> #include <linux/compat.h> #include "compat_qseecom.h" #include <linux/pfk.h> #define QSEECOM_DEV "qseecom" #define QSEOS_VERSION_14 0x14 Loading Loading @@ -7741,6 +7742,19 @@ static inline long qseecom_ioctl(struct file *file, qcom_ice_set_fde_flag(ice_data.flag); break; } case QSEECOM_IOCTL_FBE_CLEAR_KEY: { struct qseecom_ice_key_data_t key_data; ret = copy_from_user(&key_data, argp, sizeof(key_data)); if (ret) { pr_err("copy from user failed\n"); return -EFAULT; } pfk_fbe_clear_key((const unsigned char *) key_data.key, key_data.key_len, (const unsigned char *) key_data.salt, key_data.salt_len); break; } default: pr_err("Invalid IOCTL: 0x%x\n", cmd); return -EINVAL; Loading include/linux/pfk.h +8 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,8 @@ int pfk_load_key_start(const struct bio *bio, bool *is_pfe, bool async); int pfk_load_key_end(const struct bio *bio, bool *is_pfe); int pfk_remove_key(const unsigned char *key, size_t key_size); int pfk_fbe_clear_key(const unsigned char *key, size_t key_size, const unsigned char *salt, size_t salt_size); bool pfk_allow_merge_bio(const struct bio *bio1, const struct bio *bio2); void pfk_clear_on_reset(void); Loading @@ -63,6 +65,12 @@ static inline bool pfk_allow_merge_bio(const struct bio *bio1, return true; } static inline int pfk_fbe_clear_key(const unsigned char *key, size_t key_size, const unsigned char *salt, size_t salt_size) { return -ENODEV; } static inline void pfk_clear_on_reset(void) {} Loading include/uapi/linux/qseecom.h +13 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,9 @@ #define QSEECOM_TA_ION_ALLOCATE_DELAY 50 #define QSEECOM_TA_ION_ALLOCATE_MAX_ATTEMP 20 #define ICE_KEY_SIZE 32 #define ICE_SALT_SIZE 32 /* * struct qseecom_register_listener_req - * for register listener ioctl request Loading Loading @@ -281,6 +284,13 @@ struct qseecom_ce_info_req { struct qseecom_ce_pipe_entry ce_pipe_entry[MAX_CE_PIPE_PAIR_PER_UNIT]; }; struct qseecom_ice_key_data_t { uint8_t key[ICE_KEY_SIZE]; uint32_t key_len; uint8_t salt[ICE_SALT_SIZE]; uint32_t salt_len; }; #define SG_ENTRY_SZ sizeof(struct qseecom_sg_entry) #define SG_ENTRY_SZ_64BIT sizeof(struct qseecom_sg_entry_64bit) Loading Loading @@ -392,4 +402,7 @@ struct file; #define QSEECOM_IOCTL_SET_ICE_INFO \ _IOWR(QSEECOM_IOC_MAGIC, 43, struct qseecom_ice_data_t) #define QSEECOM_IOCTL_FBE_CLEAR_KEY \ _IOWR(QSEECOM_IOC_MAGIC, 44, struct qseecom_ice_key_data_t) #endif /* _UAPI_QSEECOM_H_ */ security/pfe/pfk.c +14 −0 Original line number Diff line number Diff line Loading @@ -533,6 +533,20 @@ bool pfk_allow_merge_bio(const struct bio *bio1, const struct bio *bio2) !crypto_memneq(key1->raw, key2->raw, sizeof(key1->raw))); } int pfk_fbe_clear_key(const unsigned char *key, size_t key_size, const unsigned char *salt, size_t salt_size) { int ret = -EINVAL; if (!key || !salt) return ret; ret = pfk_kc_remove_key_with_salt(key, key_size, salt, salt_size); if (ret) pr_err("Clear key error: ret value %d\n", ret); return ret; } /** * Flush key table on storage core reset. During core reset key configuration * is lost in ICE. We need to flash the cache, so that the keys will be Loading Loading
drivers/misc/qseecom.c +14 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ #include <linux/ion_kernel.h> #include <linux/compat.h> #include "compat_qseecom.h" #include <linux/pfk.h> #define QSEECOM_DEV "qseecom" #define QSEOS_VERSION_14 0x14 Loading Loading @@ -7741,6 +7742,19 @@ static inline long qseecom_ioctl(struct file *file, qcom_ice_set_fde_flag(ice_data.flag); break; } case QSEECOM_IOCTL_FBE_CLEAR_KEY: { struct qseecom_ice_key_data_t key_data; ret = copy_from_user(&key_data, argp, sizeof(key_data)); if (ret) { pr_err("copy from user failed\n"); return -EFAULT; } pfk_fbe_clear_key((const unsigned char *) key_data.key, key_data.key_len, (const unsigned char *) key_data.salt, key_data.salt_len); break; } default: pr_err("Invalid IOCTL: 0x%x\n", cmd); return -EINVAL; Loading
include/linux/pfk.h +8 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,8 @@ int pfk_load_key_start(const struct bio *bio, bool *is_pfe, bool async); int pfk_load_key_end(const struct bio *bio, bool *is_pfe); int pfk_remove_key(const unsigned char *key, size_t key_size); int pfk_fbe_clear_key(const unsigned char *key, size_t key_size, const unsigned char *salt, size_t salt_size); bool pfk_allow_merge_bio(const struct bio *bio1, const struct bio *bio2); void pfk_clear_on_reset(void); Loading @@ -63,6 +65,12 @@ static inline bool pfk_allow_merge_bio(const struct bio *bio1, return true; } static inline int pfk_fbe_clear_key(const unsigned char *key, size_t key_size, const unsigned char *salt, size_t salt_size) { return -ENODEV; } static inline void pfk_clear_on_reset(void) {} Loading
include/uapi/linux/qseecom.h +13 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,9 @@ #define QSEECOM_TA_ION_ALLOCATE_DELAY 50 #define QSEECOM_TA_ION_ALLOCATE_MAX_ATTEMP 20 #define ICE_KEY_SIZE 32 #define ICE_SALT_SIZE 32 /* * struct qseecom_register_listener_req - * for register listener ioctl request Loading Loading @@ -281,6 +284,13 @@ struct qseecom_ce_info_req { struct qseecom_ce_pipe_entry ce_pipe_entry[MAX_CE_PIPE_PAIR_PER_UNIT]; }; struct qseecom_ice_key_data_t { uint8_t key[ICE_KEY_SIZE]; uint32_t key_len; uint8_t salt[ICE_SALT_SIZE]; uint32_t salt_len; }; #define SG_ENTRY_SZ sizeof(struct qseecom_sg_entry) #define SG_ENTRY_SZ_64BIT sizeof(struct qseecom_sg_entry_64bit) Loading Loading @@ -392,4 +402,7 @@ struct file; #define QSEECOM_IOCTL_SET_ICE_INFO \ _IOWR(QSEECOM_IOC_MAGIC, 43, struct qseecom_ice_data_t) #define QSEECOM_IOCTL_FBE_CLEAR_KEY \ _IOWR(QSEECOM_IOC_MAGIC, 44, struct qseecom_ice_key_data_t) #endif /* _UAPI_QSEECOM_H_ */
security/pfe/pfk.c +14 −0 Original line number Diff line number Diff line Loading @@ -533,6 +533,20 @@ bool pfk_allow_merge_bio(const struct bio *bio1, const struct bio *bio2) !crypto_memneq(key1->raw, key2->raw, sizeof(key1->raw))); } int pfk_fbe_clear_key(const unsigned char *key, size_t key_size, const unsigned char *salt, size_t salt_size) { int ret = -EINVAL; if (!key || !salt) return ret; ret = pfk_kc_remove_key_with_salt(key, key_size, salt, salt_size); if (ret) pr_err("Clear key error: ret value %d\n", ret); return ret; } /** * Flush key table on storage core reset. During core reset key configuration * is lost in ICE. We need to flash the cache, so that the keys will be Loading