All of lore.kernel.org
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Cc: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
	Herbert Xu <herbert@gondor.apana.org.au>
Subject: [PATCH 05/16] crypto: adiantum - Only access common skcipher fields on spawn
Date: Tue,  3 Oct 2023 11:43:22 +0800	[thread overview]
Message-ID: <20231003034333.1441826-6-herbert@gondor.apana.org.au> (raw)
In-Reply-To: <20231003034333.1441826-1-herbert@gondor.apana.org.au>

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>
---
 crypto/adiantum.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/crypto/adiantum.c b/crypto/adiantum.c
index c33ba22a6638..51703746d91e 100644
--- a/crypto/adiantum.c
+++ b/crypto/adiantum.c
@@ -468,7 +468,7 @@ static void adiantum_free_instance(struct skcipher_instance *inst)
  * Check for a supported set of inner algorithms.
  * See the comment at the beginning of this file.
  */
-static bool adiantum_supported_algorithms(struct skcipher_alg *streamcipher_alg,
+static bool adiantum_supported_algorithms(struct skcipher_alg_common *streamcipher_alg,
 					  struct crypto_alg *blockcipher_alg,
 					  struct shash_alg *hash_alg)
 {
@@ -494,7 +494,7 @@ static int adiantum_create(struct crypto_template *tmpl, struct rtattr **tb)
 	const char *nhpoly1305_name;
 	struct skcipher_instance *inst;
 	struct adiantum_instance_ctx *ictx;
-	struct skcipher_alg *streamcipher_alg;
+	struct skcipher_alg_common *streamcipher_alg;
 	struct crypto_alg *blockcipher_alg;
 	struct shash_alg *hash_alg;
 	int err;
@@ -514,7 +514,7 @@ static int adiantum_create(struct crypto_template *tmpl, struct rtattr **tb)
 				   crypto_attr_alg_name(tb[1]), 0, mask);
 	if (err)
 		goto err_free_inst;
-	streamcipher_alg = crypto_spawn_skcipher_alg(&ictx->streamcipher_spawn);
+	streamcipher_alg = crypto_spawn_skcipher_alg_common(&ictx->streamcipher_spawn);
 
 	/* Block cipher, e.g. "aes" */
 	err = crypto_grab_cipher(&ictx->blockcipher_spawn,
@@ -578,8 +578,8 @@ static int adiantum_create(struct crypto_template *tmpl, struct rtattr **tb)
 	inst->alg.decrypt = adiantum_decrypt;
 	inst->alg.init = adiantum_init_tfm;
 	inst->alg.exit = adiantum_exit_tfm;
-	inst->alg.min_keysize = crypto_skcipher_alg_min_keysize(streamcipher_alg);
-	inst->alg.max_keysize = crypto_skcipher_alg_max_keysize(streamcipher_alg);
+	inst->alg.min_keysize = streamcipher_alg->min_keysize;
+	inst->alg.max_keysize = streamcipher_alg->max_keysize;
 	inst->alg.ivsize = TWEAK_SIZE;
 
 	inst->free = adiantum_free_instance;
-- 
2.39.2


  parent reply	other threads:[~2023-10-03  3:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03  3:43 [PATCH 0/16] crypto: Only use common fields on skcipher spawn algs Herbert Xu
2023-10-03  3:43 ` [PATCH 01/16] crypto: arc4 - Convert from skcipher to lskcipher Herbert Xu
2023-10-03  3:43 ` [PATCH 02/16] crypto: skcipher - Add crypto_spawn_skcipher_alg_common Herbert Xu
2023-10-03  3:43 ` [PATCH 03/16] crypto: essiv - Handle lskcipher spawns Herbert Xu
2023-10-03  3:43 ` [PATCH 04/16] crypto: cryptd - Only access common skcipher fields on spawn Herbert Xu
2023-10-03  3:43 ` Herbert Xu [this message]
2023-10-03  3:43 ` [PATCH 06/16] crypto: authenc " Herbert Xu
2023-10-03  3:43 ` [PATCH 07/16] crypto: authencesn " Herbert Xu
2023-10-03  3:43 ` [PATCH 08/16] crypto: ccm " Herbert Xu
2023-10-03  3:43 ` [PATCH 09/16] crypto: chacha20poly1305 " Herbert Xu
2023-10-03  3:43 ` [PATCH 10/16] crypto: ctr " Herbert Xu
2023-10-03  3:43 ` [PATCH 11/16] crypto: cts " Herbert Xu
2023-10-03  3:43 ` [PATCH 12/16] crypto: gcm " Herbert Xu
2023-10-03  3:43 ` [PATCH 13/16] crypto: hctr2 " Herbert Xu
2023-10-03  3:43 ` [PATCH 14/16] crypto: lrw " Herbert Xu
2023-10-03  3:43 ` [PATCH 15/16] crypto: xts " Herbert Xu
2023-10-03  3:43 ` [PATCH 16/16] crypto: skcipher - Remove obsolete skcipher_alg helpers Herbert Xu
2023-10-03 11:39 ` [PATCH 0/16] crypto: Only use common fields on skcipher spawn algs Shinichiro Kawasaki

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=20231003034333.1441826-6-herbert@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.