Linux cryptographic layer development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Bruno Meneguele" <bmeneg@redhat.com>, linux-crypto@vger.kernel.org
Cc: herbert@gondor.apana.org.au, davem@davemloft.net, ebiggers@google.com
Subject: Re: [PATCH] crypto: cmac,xcbc,ccm - accept CRYPTO_ALG_REQ_VIRT in template type check
Date: Thu, 03 Dec 2026 21:21:13 +0000	[thread overview]
Message-ID: <sashiko-outbox-248682@kernel.org> (raw)
In-Reply-To: <20261203210119.42352-1-bmeneg@redhat.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] crypto: hmac_create_shash() omitted from CRYPTO_ALG_REQ_VIRT
  type check
--

commit dd045144cfb684760383283e25dcfff6615c568c
Author: Bruno Meneguele <bmeneg@redhat.com>

crypto: cmac,xcbc,ccm - accept CRYPTO_ALG_REQ_VIRT in template type check

This commit updates cbcmac_create(), cmac_create(), and xcbc_create() to
pass CRYPTO_ALG_TYPE_SHASH | CRYPTO_ALG_REQ_VIRT to
crypto_check_attr_type(), so that fallback lookups from
crypto_ahash_init_tfm() with CRYPTO_ALG_REQ_VIRT set are accepted.

[ ... ]

> diff --git a/crypto/cmac.c b/crypto/cmac.c
> index 83e58937f0136..74786612a6f16 100644
> --- a/crypto/cmac.c
> +++ b/crypto/cmac.c
> @@ -165,7 +165,8 @@ static int cmac_create(struct crypto_template *tmpl, struct rtattr **tb)
>  	u32 mask;
>  	int err;
>  
> -	err = crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_SHASH, &mask);
> +	err = crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_SHASH |
> +				     CRYPTO_ALG_REQ_VIRT, &mask);
>  	if (err)
>  		return err;

[Severity: Low]
Should hmac_create_shash() in crypto/hmac.c also include
CRYPTO_ALG_REQ_VIRT?

shash_prepare_alg() sets CRYPTO_ALG_REQ_VIRT on every registered shash
instance, and hmac_create_shash() is the only remaining shash template
still calling crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_SHASH, &mask).

Via crypto_add_alg(), a NETLINK_CRYPTO CRYPTO_MSG_NEWALG request for
hmac-shash(...) with CRYPTO_ALG_REQ_VIRT set in type and mask fails with
-ENOENT, while a request requiring it clear still registers the shash
instance and fails re-lookup with -EAGAIN.

Updating hmac_create_shash() as well, or handling CRYPTO_ALG_REQ_VIRT
centrally for CRYPTO_ALG_TYPE_SHASH in crypto_check_attr_type(), would
keep all four shash templates consistent and avoid repeating the flag in
future shash templates.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203210119.42352-1-bmeneg@redhat.com?part=1

      parent reply	other threads:[~2026-12-03 21:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 21:01 [PATCH] crypto: cmac,xcbc,ccm - accept CRYPTO_ALG_REQ_VIRT in template type check Bruno Meneguele
2026-12-03 21:18 ` Eric Biggers
2026-12-03 21:36   ` Bruno Meneguele
2026-12-03 21:21 ` sashiko-bot [this message]

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=sashiko-outbox-248682@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bmeneg@redhat.com \
    --cc=davem@davemloft.net \
    --cc=ebiggers@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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