diff options
author | Jussi Kivilinna <jussi.kivilinna@mbnet.fi> | 2011-10-18 06:33:07 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2011-11-08 22:53:32 -0500 |
commit | f9d2691fc9a00f39b587f965c33cca012a5597bc (patch) | |
tree | aec2fc72e15ed2fd9ba3ccd5f368961e6183d8ba /crypto | |
parent | 81559f9ad3d88c033e4ec3b6468012dbfda3b31d (diff) |
crypto: xts - use blocksize constant
XTS has fixed blocksize of 16. Define XTS_BLOCK_SIZE and use in place of
crypto_cipher_blocksize().
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/xts.c | 8 |
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 | |||
27 | struct priv { | 29 | struct 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; |