@@ -31,7 +31,7 @@
#define FSCRYPT_CONTEXT_V2 2
/* Keep this in sync with include/uapi/linux/fscrypt.h */
-#define FSCRYPT_MODE_MAX FSCRYPT_MODE_AES_256_HCTR2
+#define FSCRYPT_MODE_MAX FSCRYPT_MODE_LEA_256_CTS
struct fscrypt_context_v1 {
u8 version; /* FSCRYPT_CONTEXT_V1 */
@@ -74,6 +74,21 @@ struct fscrypt_mode fscrypt_modes[] = {
.security_strength = 32,
.ivsize = 32,
},
+ [FSCRYPT_MODE_LEA_256_XTS] = {
+ .friendly_name = "LEA-256-XTS",
+ .cipher_str = "xts(lea)",
+ .keysize = 64,
+ .security_strength = 32,
+ .ivsize = 16,
+ .blk_crypto_mode = BLK_ENCRYPTION_MODE_LEA_256_XTS,
+ },
+ [FSCRYPT_MODE_LEA_256_CTS] = {
+ .friendly_name = "LEA-256-CTS-CBC",
+ .cipher_str = "cts(cbc(lea))",
+ .keysize = 32,
+ .security_strength = 32,
+ .ivsize = 16,
+ },
};
static DEFINE_MUTEX(fscrypt_mode_key_setup_mutex);
@@ -94,6 +94,10 @@ static bool fscrypt_valid_enc_modes_v2(u32 contents_mode, u32 filenames_mode)
filenames_mode == FSCRYPT_MODE_SM4_CTS)
return true;
+ if (contents_mode == FSCRYPT_MODE_LEA_256_XTS &&
+ filenames_mode == FSCRYPT_MODE_LEA_256_CTS)
+ return true;
+
return fscrypt_valid_enc_modes_v1(contents_mode, filenames_mode);
}
@@ -30,7 +30,9 @@
#define FSCRYPT_MODE_SM4_CTS 8
#define FSCRYPT_MODE_ADIANTUM 9
#define FSCRYPT_MODE_AES_256_HCTR2 10
-/* If adding a mode number > 10, update FSCRYPT_MODE_MAX in fscrypt_private.h */
+#define FSCRYPT_MODE_LEA_256_XTS 11
+#define FSCRYPT_MODE_LEA_256_CTS 12
+/* If adding a mode number > 12, update FSCRYPT_MODE_MAX in fscrypt_private.h */
/*
* Legacy policy version; ad-hoc KDF and no key verification.
@@ -30,7 +30,9 @@
#define FSCRYPT_MODE_SM4_CTS 8
#define FSCRYPT_MODE_ADIANTUM 9
#define FSCRYPT_MODE_AES_256_HCTR2 10
-/* If adding a mode number > 10, update FSCRYPT_MODE_MAX in fscrypt_private.h */
+#define FSCRYPT_MODE_LEA_256_XTS 11
+#define FSCRYPT_MODE_LEA_256_CTS 12
+/* If adding a mode number > 12, update FSCRYPT_MODE_MAX in fscrypt_private.h */
/*
* Legacy policy version; ad-hoc KDF and no key verification.