Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae7eae84 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "security: pfe: update data unit number for default key too"

parents 04077886 75e59c91
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -76,7 +76,6 @@ typedef int (*pfk_parse_inode_type)(const struct bio *bio,
	struct pfk_key_info *key_info,
	enum ice_cryto_algo_mode *algo,
	bool *is_pfe,
	unsigned int *data_unit,
	const char *storage_type);

typedef bool (*pfk_allow_merge_bio_type)(const struct bio *bio1,
@@ -294,13 +293,17 @@ static int pfk_get_key_for_bio(const struct bio *bio,
	which_pfe = pfk_get_pfe_type(inode);
	s_type = (char *)pfk_kc_get_storage_type();

	if (data_unit && (bio_dun(bio) ||
			!memcmp(s_type, "ufs", strlen("ufs"))))
		*data_unit = 1 << ICE_CRYPTO_DATA_UNIT_4_KB;

	if (which_pfe != INVALID_PFE) {
		/* Encrypted file; override ->bi_crypt_key */
		pr_debug("parsing inode %lu with PFE type %d\n",
			 inode->i_ino, which_pfe);
		return (*(pfk_parse_inode_ftable[which_pfe]))
				(bio, inode, key_info, algo_mode, is_pfe,
					data_unit, (const char *)s_type);
					(const char *)s_type);
	}

	/*
+0 −14
Original line number Diff line number Diff line
@@ -142,7 +142,6 @@ int pfk_ext4_parse_inode(const struct bio *bio,
	struct pfk_key_info *key_info,
	enum ice_cryto_algo_mode *algo,
	bool *is_pfe,
	unsigned int *data_unit,
	const char *storage_type)
{
	int ret = 0;
@@ -157,19 +156,6 @@ int pfk_ext4_parse_inode(const struct bio *bio,
	 */
	*is_pfe = true;

	/* Update dun based upon storage type.
	 * For ext4 FS UFS has 4k dun whereas eMMC
	 * uses 512Byte dun.
	 */
	if (storage_type && data_unit) {
		if (!memcmp(storage_type, "ufs", strlen("ufs")))
			*data_unit = 1 << ICE_CRYPTO_DATA_UNIT_4_KB;
		else if (!memcmp(storage_type, "sdcc", strlen("sdcc")))
			*data_unit = 1 << ICE_CRYPTO_DATA_UNIT_512_B;
		else
			return -EINVAL;
	}

	if (!pfk_ext4_is_ready())
		return -ENODEV;

+0 −1
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ int pfk_ext4_parse_inode(const struct bio *bio,
	struct pfk_key_info *key_info,
	enum ice_cryto_algo_mode *algo,
	bool *is_pfe,
	unsigned int *data_unit,
	const char *storage_type);

bool pfk_ext4_allow_merge_bio(const struct bio *bio1,
+0 −13
Original line number Diff line number Diff line
@@ -117,7 +117,6 @@ int pfk_f2fs_parse_inode(const struct bio *bio,
		struct pfk_key_info *key_info,
		enum ice_cryto_algo_mode *algo,
		bool *is_pfe,
		unsigned int *data_unit,
		const char *storage_type)
{
	int ret = 0;
@@ -132,18 +131,6 @@ int pfk_f2fs_parse_inode(const struct bio *bio,
	 */
	*is_pfe = true;

	/* Update the dun based upon storage type.
	 * Right now both UFS and eMMC storage uses 4KB dun
	 * for F2FS
	 */
	if (storage_type && data_unit) {
		if (!memcmp(storage_type, "ufs", strlen("ufs")) ||
			!memcmp(storage_type, "sdcc", strlen("sdcc")))
			*data_unit = 1 << ICE_CRYPTO_DATA_UNIT_4_KB;
		else
			return -EINVAL;
	}

	if (!pfk_f2fs_is_ready())
		return -ENODEV;

+0 −1
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ int pfk_f2fs_parse_inode(const struct bio *bio,
		struct pfk_key_info *key_info,
		enum ice_cryto_algo_mode *algo,
		bool *is_pfe,
		unsigned int *data_unit,
		const char *storage_type);

bool pfk_f2fs_allow_merge_bio(const struct bio *bio1,