aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crypto/xts.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/crypto/xts.c b/crypto/xts.c
index 851705446c82..96f3f88d576e 100644
--- a/crypto/xts.c
+++ b/crypto/xts.c
@@ -24,6 +24,8 @@
24#include <crypto/b128ops.h> 24#include <crypto/b128ops.h>
25#include <crypto/gf128mul.h> 25#include <crypto/gf128mul.h>
26 26
27#define XTS_BLOCK_SIZE 16
28
27struct priv { 29struct priv {
28 struct crypto_cipher *child; 30 struct crypto_cipher *child;
29 struct crypto_cipher *tweak; 31 struct crypto_cipher *tweak;
@@ -96,7 +98,7 @@ static int crypt(struct blkcipher_desc *d,
96{ 98{
97 int err; 99 int err;
98 unsigned int avail; 100 unsigned int avail;
99 const int bs = crypto_cipher_blocksize(ctx->child); 101 const int bs = XTS_BLOCK_SIZE;
100 struct sinfo s = { 102 struct sinfo s = {
101 .tfm = crypto_cipher_tfm(ctx->child), 103 .tfm = crypto_cipher_tfm(ctx->child),
102 .fn = fn 104 .fn = fn
@@ -177,7 +179,7 @@ static int init_tfm(struct crypto_tfm *tfm)
177 if (IS_ERR(cipher)) 179 if (IS_ERR(cipher))
178 return PTR_ERR(cipher); 180 return PTR_ERR(cipher);
179 181
180 if (crypto_cipher_blocksize(cipher) != 16) { 182 if (crypto_cipher_blocksize(cipher) != XTS_BLOCK_SIZE) {
181 *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; 183 *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN;
182 crypto_free_cipher(cipher); 184 crypto_free_cipher(cipher);
183 return -EINVAL; 185 return -EINVAL;
@@ -192,7 +194,7 @@ static int init_tfm(struct crypto_tfm *tfm)
192 } 194 }
193 195
194 /* this check isn't really needed, leave it here just in case */ 196 /* this check isn't really needed, leave it here just in case */
195 if (crypto_cipher_blocksize(cipher) != 16) { 197 if (crypto_cipher_blocksize(cipher) != XTS_BLOCK_SIZE) {
196 crypto_free_cipher(cipher); 198 crypto_free_cipher(cipher);
197 crypto_free_cipher(ctx->child); 199 crypto_free_cipher(ctx->child);
198 *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; 200 *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN;