summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2023-10-03 11:43:32 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2023-10-13 18:27:27 +0800
commitc2e93d6372cadb653054710ad9be3e8ba4231551 (patch)
tree38a06cf505459b7603f7226bed23432f5add1980
parent8323119732f508dcd39cc8cdd5ebe54559cfb5bb (diff)
downloadlinux-crypto-c2e93d6372cadb653054710ad9be3e8ba4231551.tar.gz
linux-crypto-c2e93d6372cadb653054710ad9be3e8ba4231551.zip
crypto: xts - Only access common skcipher fields on spawn
As skcipher spawns may be of the type lskcipher, only the common fields may be accessed. This was already the case but use the correct helpers to make this more obvious. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--crypto/xts.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/crypto/xts.c b/crypto/xts.c
index 548b302c..9237b143 100644
--- a/crypto/xts.c
+++ b/crypto/xts.c
@@ -338,9 +338,9 @@ static void xts_free_instance(struct skcipher_instance *inst)
static int xts_create(struct crypto_template *tmpl, struct rtattr **tb)
{
+ struct skcipher_alg_common *alg;
struct skcipher_instance *inst;
struct xts_instance_ctx *ctx;
- struct skcipher_alg *alg;
const char *cipher_name;
u32 mask;
int err;
@@ -375,13 +375,13 @@ static int xts_create(struct crypto_template *tmpl, struct rtattr **tb)
if (err)
goto err_free_inst;
- alg = crypto_skcipher_spawn_alg(&ctx->spawn);
+ alg = crypto_spawn_skcipher_alg_common(&ctx->spawn);
err = -EINVAL;
if (alg->base.cra_blocksize != XTS_BLOCK_SIZE)
goto err_free_inst;
- if (crypto_skcipher_alg_ivsize(alg))
+ if (alg->ivsize)
goto err_free_inst;
err = crypto_inst_setname(skcipher_crypto_instance(inst), "xts",
@@ -421,8 +421,8 @@ static int xts_create(struct crypto_template *tmpl, struct rtattr **tb)
(__alignof__(u64) - 1);
inst->alg.ivsize = XTS_BLOCK_SIZE;
- inst->alg.min_keysize = crypto_skcipher_alg_min_keysize(alg) * 2;
- inst->alg.max_keysize = crypto_skcipher_alg_max_keysize(alg) * 2;
+ inst->alg.min_keysize = alg->min_keysize * 2;
+ inst->alg.max_keysize = alg->max_keysize * 2;
inst->alg.base.cra_ctxsize = sizeof(struct xts_tfm_ctx);