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

Commit c4b00eb7 authored by Alistair Strachan's avatar Alistair Strachan
Browse files

Revert "BACKPORT, FROMLIST: fscrypt: add Speck128/256 support"



This reverts commit 4b08356a.

Resolves conflicts with a later CL, e7724207 "fscrypt: log the
crypto algorithm implementations".

[astrachan: This is an update to 076c36fc which reverted only
            the fscrypt changes, not the ext4 changes, due to a
            historical bad merge.]
Bug: 116008047
Change-Id: I772d78d6e4bd126dcd2b25049c719f8522a1c157
Signed-off-by: default avatarAlistair Strachan <astrachan@google.com>
parent fd73fe98
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -457,17 +457,9 @@ errout:
	return err;
}

bool ext4_valid_enc_modes(uint32_t contents_mode, uint32_t filenames_mode)
bool ext4_valid_contents_enc_mode(uint32_t mode)
{
	if (contents_mode == EXT4_ENCRYPTION_MODE_AES_256_XTS) {
		return (filenames_mode == EXT4_ENCRYPTION_MODE_AES_256_CTS ||
			filenames_mode == EXT4_ENCRYPTION_MODE_AES_256_HEH);
	}

	if (contents_mode == EXT4_ENCRYPTION_MODE_SPECK128_256_XTS)
		return filenames_mode == EXT4_ENCRYPTION_MODE_SPECK128_256_CTS;

	return false;
	return (mode == EXT4_ENCRYPTION_MODE_AES_256_XTS);
}

/**
+6 −0
Original line number Diff line number Diff line
@@ -42,6 +42,12 @@ static void ext4_dir_crypt_complete(struct crypto_async_request *req, int res)
	complete(&ecr->completion);
}

bool ext4_valid_filenames_enc_mode(uint32_t mode)
{
	return (mode == EXT4_ENCRYPTION_MODE_AES_256_CTS ||
		mode == EXT4_ENCRYPTION_MODE_AES_256_HEH);
}

static unsigned max_name_len(struct inode *inode)
{
	return S_ISLNK(inode->i_mode) ? inode->i_sb->s_blocksize :
+0 −6
Original line number Diff line number Diff line
@@ -258,12 +258,6 @@ int ext4_get_encryption_info(struct inode *inode)
	case EXT4_ENCRYPTION_MODE_AES_256_HEH:
		cipher_str = "heh(aes)";
		break;
	case EXT4_ENCRYPTION_MODE_SPECK128_256_XTS:
		cipher_str = "xts(speck128)";
		break;
	case EXT4_ENCRYPTION_MODE_SPECK128_256_CTS:
		cipher_str = "cts(cbc(speck128))";
		break;
	default:
		printk_once(KERN_WARNING
			    "ext4: unsupported key mode %d (ino %u)\n",
+9 −5
Original line number Diff line number Diff line
@@ -60,11 +60,15 @@ static int ext4_create_encryption_context_from_policy(
	ctx.format = EXT4_ENCRYPTION_CONTEXT_FORMAT_V1;
	memcpy(ctx.master_key_descriptor, policy->master_key_descriptor,
	       EXT4_KEY_DESCRIPTOR_SIZE);
	if (!ext4_valid_enc_modes(policy->contents_encryption_mode,
				  policy->filenames_encryption_mode)) {
	if (!ext4_valid_contents_enc_mode(policy->contents_encryption_mode)) {
		printk(KERN_WARNING
		       "%s: Invalid encryption modes (contents %d, filenames %d)\n",
		       __func__, policy->contents_encryption_mode,
		       "%s: Invalid contents encryption mode %d\n", __func__,
			policy->contents_encryption_mode);
		return -EINVAL;
	}
	if (!ext4_valid_filenames_enc_mode(policy->filenames_encryption_mode)) {
		printk(KERN_WARNING
		       "%s: Invalid filenames encryption mode %d\n", __func__,
			policy->filenames_encryption_mode);
		return -EINVAL;
	}
+2 −3
Original line number Diff line number Diff line
@@ -589,8 +589,6 @@ enum {
#define EXT4_ENCRYPTION_MODE_AES_256_GCM	2
#define EXT4_ENCRYPTION_MODE_AES_256_CBC	3
#define EXT4_ENCRYPTION_MODE_AES_256_CTS	4
#define EXT4_ENCRYPTION_MODE_SPECK128_256_XTS	7
#define EXT4_ENCRYPTION_MODE_SPECK128_256_CTS	8
#define EXT4_ENCRYPTION_MODE_AES_256_HEH	126

#include "ext4_crypto.h"
@@ -2256,7 +2254,7 @@ int ext4_get_policy(struct inode *inode,

/* crypto.c */
extern struct kmem_cache *ext4_crypt_info_cachep;
bool ext4_valid_enc_modes(uint32_t contents_mode, uint32_t filenames_mode);
bool ext4_valid_contents_enc_mode(uint32_t mode);
uint32_t ext4_validate_encryption_key_size(uint32_t mode, uint32_t size);
extern struct workqueue_struct *ext4_read_workqueue;
struct ext4_crypto_ctx *ext4_get_crypto_ctx(struct inode *inode,
@@ -2287,6 +2285,7 @@ static inline int ext4_sb_has_crypto(struct super_block *sb)
#endif

/* crypto_fname.c */
bool ext4_valid_filenames_enc_mode(uint32_t mode);
u32 ext4_fname_crypto_round_up(u32 size, u32 blksize);
unsigned ext4_fname_encrypted_size(struct inode *inode, u32 ilen);
int ext4_fname_crypto_alloc_buffer(struct inode *inode,
Loading