Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jussi Kivilinna and committed by
Herbert Xu
f9d2691f 81559f9a

+5 -3
+5 -3
crypto/xts.c
··· 24 24 #include <crypto/b128ops.h> 25 25 #include <crypto/gf128mul.h> 26 26 27 + #define XTS_BLOCK_SIZE 16 28 + 27 29 struct priv { 28 30 struct crypto_cipher *child; 29 31 struct crypto_cipher *tweak; ··· 98 96 { 99 97 int err; 100 98 unsigned int avail; 101 - const int bs = crypto_cipher_blocksize(ctx->child); 99 + const int bs = XTS_BLOCK_SIZE; 102 100 struct sinfo s = { 103 101 .tfm = crypto_cipher_tfm(ctx->child), 104 102 .fn = fn ··· 179 177 if (IS_ERR(cipher)) 180 178 return PTR_ERR(cipher); 181 179 182 - if (crypto_cipher_blocksize(cipher) != 16) { 180 + if (crypto_cipher_blocksize(cipher) != XTS_BLOCK_SIZE) { 183 181 *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; 184 182 crypto_free_cipher(cipher); 185 183 return -EINVAL; ··· 194 192 } 195 193 196 194 /* this check isn't really needed, leave it here just in case */ 197 - if (crypto_cipher_blocksize(cipher) != 16) { 195 + if (crypto_cipher_blocksize(cipher) != XTS_BLOCK_SIZE) { 198 196 crypto_free_cipher(cipher); 199 197 crypto_free_cipher(ctx->child); 200 198 *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN;