Re: [PATCH 07/29] crypto: skcipher - optimize initializing skcipher_walk fields

Herbert Xu
2024-12-21T11:16:11Z

Eric Biggers <ebiggers@kernel.org> wrote:
>
> @@ -326,13 +326,13 @@ int skcipher_walk_virt(struct skcipher_walk *walk,
> return 0;
>
> scatterwalk_start(&walk->in, req->src);
> scatterwalk_start(&walk->out, req->dst);
>
> - walk->blocksize = crypto_skcipher_blocksize(tfm);
> - walk->ivsize = crypto_skcipher_ivsize(tfm);
> - walk->alignmask = crypto_skcipher_alignmask(tfm);
> + walk->blocksize = alg->base.cra_blocksize;
> + walk->ivsize = alg->co.ivsize;
> + walk->alignmask = alg->base.cra_alignmask;

Please do this instead:

unsigned bs, ivs, am;

bs = crypto_skcipher_blocksize(tfm);
ivs = crypto_skcipher_ivsize(tfm);
am = crypto_skcipher_alignmask(tfm);
walk->blocksize = bs;
walk->ivsize = ivs;
walk->alignmask = am;

This generates the right thing for me with gcc12.

Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt