From: Eric Biggers <ebiggers@kernel.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: linux-crypto@vger.kernel.org,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 28/29] crypto: remove deprecated and unused ablkcipher support
Date: Tue, 5 Nov 2019 09:52:06 -0800 [thread overview]
Message-ID: <20191105175206.GD757@sol.localdomain> (raw)
In-Reply-To: <20191105132826.1838-29-ardb@kernel.org>
On Tue, Nov 05, 2019 at 02:28:25PM +0100, Ard Biesheuvel wrote:
> Now that all users of the deprecated ablkcipher interface have been
> moved to the skcipher interface, ablkcipher is no longer used and
> can be removed.
>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
Thanks for doing this!
A couple ideas for future cleanups below (which, if done, should go in separate
patches rather than in this big one):
> @@ -786,9 +683,6 @@ static int crypto_skcipher_init_tfm(struct crypto_tfm *tfm)
> struct crypto_skcipher *skcipher = __crypto_skcipher_cast(tfm);
> struct skcipher_alg *alg = crypto_skcipher_alg(skcipher);
>
> - if (tfm->__crt_alg->cra_type == &crypto_ablkcipher_type)
> - return crypto_init_skcipher_ops_ablkcipher(tfm);
> -
> skcipher->setkey = skcipher_setkey;
> skcipher->encrypt = alg->encrypt;
> skcipher->decrypt = alg->decrypt;
> skcipher->ivsize = alg->ivsize;
> skcipher->keysize = alg->max_keysize;
Since a crypto_skcipher will now always be paired with a skcipher_alg (rather
than an blkcipher or ablkcipher algorithm), we could remove the 'encrypt',
'decrypt', 'ivsize', and 'keysize' fields of crypto_skcipher, and instead always
get them from the skcipher_alg.
> @@ -182,27 +171,18 @@ static inline u32 skcipher_request_flags(struct skcipher_request *req)
> static inline unsigned int crypto_skcipher_alg_min_keysize(
> struct skcipher_alg *alg)
> {
> - if (alg->base.cra_ablkcipher.encrypt)
> - return alg->base.cra_ablkcipher.min_keysize;
> -
> return alg->min_keysize;
> }
>
> static inline unsigned int crypto_skcipher_alg_max_keysize(
> struct skcipher_alg *alg)
> {
> - if (alg->base.cra_ablkcipher.encrypt)
> - return alg->base.cra_ablkcipher.max_keysize;
> -
> return alg->max_keysize;
> }
>
> static inline unsigned int crypto_skcipher_alg_walksize(
> struct skcipher_alg *alg)
> {
> - if (alg->base.cra_ablkcipher.encrypt)
> - return alg->base.cra_blocksize;
> -
> return alg->walksize;
> }
>
> diff --git a/include/crypto/skcipher.h b/include/crypto/skcipher.h
> index 8c5a31e810da..b4655d91661f 100644
> --- a/include/crypto/skcipher.h
> +++ b/include/crypto/skcipher.h
> @@ -241,9 +241,6 @@ static inline struct skcipher_alg *crypto_skcipher_alg(
>
> static inline unsigned int crypto_skcipher_alg_ivsize(struct skcipher_alg *alg)
> {
> - if (alg->base.cra_ablkcipher.encrypt)
> - return alg->base.cra_ablkcipher.ivsize;
> -
> return alg->ivsize;
> }
>
> @@ -286,9 +283,6 @@ static inline unsigned int crypto_skcipher_blocksize(
> static inline unsigned int crypto_skcipher_alg_chunksize(
> struct skcipher_alg *alg)
> {
> - if (alg->base.cra_ablkcipher.encrypt)
> - return alg->base.cra_blocksize;
> -
> return alg->chunksize;
> }
Now that these helpers are trivial, they could be removed and we could just
dereference the struct skcipher_alg directly.
- Eric
next prev parent reply other threads:[~2019-11-05 17:52 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-05 13:27 [PATCH v3 00/29] crypto: convert h/w accelerator drivers to skcipher API Ard Biesheuvel
2019-11-05 13:27 ` [PATCH v3 01/29] crypto: virtio - implement missing support for output IVs Ard Biesheuvel
2019-11-05 13:27 ` [PATCH v3 02/29] crypto: virtio - deal with unsupported input sizes Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 03/29] crypto: virtio - switch to skcipher API Ard Biesheuvel
2019-11-05 17:32 ` Eric Biggers
2019-11-05 13:28 ` [PATCH v3 04/29] crypto: ccp - switch from ablkcipher to skcipher Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 05/29] crypto: omap - switch to skcipher API Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 06/29] crypto: ux500 " Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 07/29] crypto: s5p " Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 08/29] crypto: atmel-aes " Ard Biesheuvel
2019-11-09 6:23 ` Tudor.Ambarus
2019-11-05 13:28 ` [PATCH v3 09/29] crypto: atmel-tdes " Ard Biesheuvel
2019-11-09 6:17 ` Tudor.Ambarus
2019-11-05 13:28 ` [PATCH v3 10/29] crypto: bcm-spu " Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 11/29] crypto: nitrox - remove cra_type reference to ablkcipher Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 12/29] crypto: cavium/cpt - switch to skcipher API Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 13/29] crypto: chelsio " Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 14/29] crypto: hifn " Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 15/29] crypto: ixp4xx " Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 16/29] crypto: mxs " Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 17/29] crypto: mediatek " Ard Biesheuvel
2019-11-10 18:31 ` Matthias Brugger
2019-11-05 13:28 ` [PATCH v3 18/29] crypto: sahara " Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 19/29] crypto: picoxcell " Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 20/29] crypto: qce " Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 21/29] crypto: stm32 " Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 22/29] crypto: niagara2 " Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 23/29] crypto: rockchip " Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 24/29] crypto: talitos " Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 25/29] crypto: qat " Ard Biesheuvel
2019-11-07 11:26 ` Giovanni Cabiddu
2019-11-07 11:34 ` Ard Biesheuvel
2019-11-08 9:14 ` Herbert Xu
2019-11-05 13:28 ` [PATCH v3 26/29] crypto: marvell/cesa - rename blkcipher to skcipher Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 27/29] crypto: nx - remove stale comment referring to the blkcipher walk API Ard Biesheuvel
2019-11-05 13:28 ` [PATCH v3 28/29] crypto: remove deprecated and unused ablkcipher support Ard Biesheuvel
2019-11-05 17:52 ` Eric Biggers [this message]
2019-11-06 4:03 ` Herbert Xu
2019-11-05 13:28 ` [PATCH v3 29/29] crypto: ccree - update a stale reference to ablkcipher Ard Biesheuvel
2019-11-06 6:24 ` Gilad Ben-Yossef
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191105175206.GD757@sol.localdomain \
--to=ebiggers@kernel.org \
--cc=ardb@kernel.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).