public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Ren Wei <n05ec@lzu.edu.cn>,
	linux-crypto@vger.kernel.org,
	Herbert Xu <herbert@gondor.apana.org.au>,
	davem@davemloft.net, yuantan098@gmail.com, yifanwucs@gmail.com,
	tomapufckgml@gmail.com, bird@lzu.edu.cn, z1652074432@gmail.com,
	kanolyc@gmail.com
Subject: Re: [PATCH 1/1] crypto: authencesn: reject short ahash digests during instance creation
Date: Tue, 21 Apr 2026 14:27:01 -0700	[thread overview]
Message-ID: <20260421212701.GA37143@quark> (raw)
In-Reply-To: <fd3a1c5d-8ebf-48de-91a0-019b05f1dc41@app.fastmail.com>

On Mon, Apr 20, 2026 at 11:21:54AM +0200, Ard Biesheuvel wrote:
> > diff --git a/crypto/authencesn.c b/crypto/authencesn.c
> > index 542a978663b9..bf44f035f7f8 100644
> > --- a/crypto/authencesn.c
> > +++ b/crypto/authencesn.c
> > @@ -384,6 +384,11 @@ static int crypto_authenc_esn_create(struct 
> > crypto_template *tmpl,
> >  		goto err_free_inst;
> >  	enc = crypto_spawn_skcipher_alg_common(&ctx->enc);
> > 
> > +	if (auth->digestsize > 0 && auth->digestsize < 4) {
> > +		err = -EINVAL;
> > +		goto err_free_inst;
> > +	}
> > +
> 
> Is this the best place for this check?

I probably would have put it a few lines earlier, right after the line
'auth_base = &auth->base;'.  But this works too.

Reviewed-by: Eric Biggers <ebiggers@kernel.org>

Of course, while this patch needs to be applied, this also doesn't go
nearly far enough.
https://lore.kernel.org/linux-crypto/20260420094120.5167-1-ardb@kernel.org/
removes the so-called "cipher_null", which has no reason to exist.

But "authencesn" itself should not be exposed to AF_ALG, let alone exist
in its current form at all.  The IPsec sequence numbers should just be
handled internally in the IPsec code itself.  That would be simpler and
more efficient, with much less UAPI surface as well.

- Eric

  reply	other threads:[~2026-04-21 21:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1775217403.git.kanolyc@gmail.com>
2026-04-20  8:48 ` [PATCH 1/1] crypto: authencesn: reject short ahash digests during instance creation Ren Wei
2026-04-20  9:21   ` Ard Biesheuvel
2026-04-21 21:27     ` Eric Biggers [this message]
2026-04-22 13:45   ` [PATCH v2 " Ren Wei
2026-04-23  5:46   ` Herbert Xu

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=20260421212701.GA37143@quark \
    --to=ebiggers@kernel.org \
    --cc=ardb@kernel.org \
    --cc=bird@lzu.edu.cn \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=kanolyc@gmail.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=n05ec@lzu.edu.cn \
    --cc=tomapufckgml@gmail.com \
    --cc=yifanwucs@gmail.com \
    --cc=yuantan098@gmail.com \
    --cc=z1652074432@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox