Skip to content

Commit 4660720

Browse files
jkivilinherbertx
authored andcommitted
crypto: lrw - use blocksize constant
LRW has fixed blocksize of 16. Define LRW_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>
1 parent b884f8b commit 4660720

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎crypto/lrw.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include <crypto/b128ops.h>
2828
#include <crypto/gf128mul.h>
2929

30+
#define LRW_BLOCK_SIZE 16
31+
3032
struct priv {
3133
struct crypto_cipher *child;
3234
/* optimizes multiplying a random (non incrementing, as at the
@@ -61,7 +63,7 @@ static int setkey(struct crypto_tfm *parent, const u8 *key,
6163
struct crypto_cipher *child = ctx->child;
6264
int err, i;
6365
be128 tmp = { 0 };
64-
int bsize = crypto_cipher_blocksize(child);
66+
int bsize = LRW_BLOCK_SIZE;
6567

6668
crypto_cipher_clear_flags(child, CRYPTO_TFM_REQ_MASK);
6769
crypto_cipher_set_flags(child, crypto_tfm_get_flags(parent) &
@@ -134,7 +136,7 @@ static int crypt(struct blkcipher_desc *d,
134136
{
135137
int err;
136138
unsigned int avail;
137-
const int bs = crypto_cipher_blocksize(ctx->child);
139+
const int bs = LRW_BLOCK_SIZE;
138140
struct sinfo s = {
139141
.tfm = crypto_cipher_tfm(ctx->child),
140142
.fn = fn
@@ -218,7 +220,7 @@ static int init_tfm(struct crypto_tfm *tfm)
218220
if (IS_ERR(cipher))
219221
return PTR_ERR(cipher);
220222

221-
if (crypto_cipher_blocksize(cipher) != 16) {
223+
if (crypto_cipher_blocksize(cipher) != LRW_BLOCK_SIZE) {
222224
*flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN;
223225
crypto_free_cipher(cipher);
224226
return -EINVAL;

0 commit comments

Comments
 (0)