|
@@ -137,14 +137,13 @@ struct ext4_crypto_ctx *ext4_get_crypto_ctx(struct inode *inode)
|
|
|
|
|
|
/* Allocate a new Crypto API context if we don't already have
|
|
/* Allocate a new Crypto API context if we don't already have
|
|
* one or if it isn't the right mode. */
|
|
* one or if it isn't the right mode. */
|
|
- BUG_ON(ci->ci_mode == EXT4_ENCRYPTION_MODE_INVALID);
|
|
|
|
- if (ctx->tfm && (ctx->mode != ci->ci_mode)) {
|
|
|
|
|
|
+ if (ctx->tfm && (ctx->mode != ci->ci_data_mode)) {
|
|
crypto_free_tfm(ctx->tfm);
|
|
crypto_free_tfm(ctx->tfm);
|
|
ctx->tfm = NULL;
|
|
ctx->tfm = NULL;
|
|
ctx->mode = EXT4_ENCRYPTION_MODE_INVALID;
|
|
ctx->mode = EXT4_ENCRYPTION_MODE_INVALID;
|
|
}
|
|
}
|
|
if (!ctx->tfm) {
|
|
if (!ctx->tfm) {
|
|
- switch (ci->ci_mode) {
|
|
|
|
|
|
+ switch (ci->ci_data_mode) {
|
|
case EXT4_ENCRYPTION_MODE_AES_256_XTS:
|
|
case EXT4_ENCRYPTION_MODE_AES_256_XTS:
|
|
ctx->tfm = crypto_ablkcipher_tfm(
|
|
ctx->tfm = crypto_ablkcipher_tfm(
|
|
crypto_alloc_ablkcipher("xts(aes)", 0, 0));
|
|
crypto_alloc_ablkcipher("xts(aes)", 0, 0));
|
|
@@ -162,9 +161,9 @@ struct ext4_crypto_ctx *ext4_get_crypto_ctx(struct inode *inode)
|
|
ctx->tfm = NULL;
|
|
ctx->tfm = NULL;
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
- ctx->mode = ci->ci_mode;
|
|
|
|
|
|
+ ctx->mode = ci->ci_data_mode;
|
|
}
|
|
}
|
|
- BUG_ON(ci->ci_size != ext4_encryption_key_size(ci->ci_mode));
|
|
|
|
|
|
+ BUG_ON(ci->ci_size != ext4_encryption_key_size(ci->ci_data_mode));
|
|
|
|
|
|
/* There shouldn't be a bounce page attached to the crypto
|
|
/* There shouldn't be a bounce page attached to the crypto
|
|
* context at this point. */
|
|
* context at this point. */
|
|
@@ -321,7 +320,7 @@ static int ext4_page_crypto(struct ext4_crypto_ctx *ctx,
|
|
int res = 0;
|
|
int res = 0;
|
|
|
|
|
|
BUG_ON(!ctx->tfm);
|
|
BUG_ON(!ctx->tfm);
|
|
- BUG_ON(ctx->mode != ei->i_crypt_info->ci_mode);
|
|
|
|
|
|
+ BUG_ON(ctx->mode != ei->i_crypt_info->ci_data_mode);
|
|
|
|
|
|
if (ctx->mode != EXT4_ENCRYPTION_MODE_AES_256_XTS) {
|
|
if (ctx->mode != EXT4_ENCRYPTION_MODE_AES_256_XTS) {
|
|
printk_ratelimited(KERN_ERR
|
|
printk_ratelimited(KERN_ERR
|