Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: Re: [PATCH 09/15] crypto: lib/poly1305 - Use block-only interface
Date: Thu, 24 Apr 2025 09:21:12 -0700	[thread overview]
Message-ID: <20250424162112.GG2427@sol.localdomain> (raw)
In-Reply-To: <20250424154801.GC2427@sol.localdomain>

On Thu, Apr 24, 2025 at 08:48:01AM -0700, Eric Biggers wrote:
> On Thu, Apr 24, 2025 at 06:47:16PM +0800, Herbert Xu wrote:
> > diff --git a/lib/crypto/poly1305.c b/lib/crypto/poly1305.c
> > index ebdfccf378ee..a37b424ee84b 100644
> > --- a/lib/crypto/poly1305.c
> > +++ b/lib/crypto/poly1305.c
> > @@ -22,47 +22,59 @@ void poly1305_block_init_generic(struct poly1305_block_state *desc,
> >  }
> >  EXPORT_SYMBOL_GPL(poly1305_block_init_generic);
> >  
> > -void poly1305_init_generic(struct poly1305_desc_ctx *desc,
> > -			   const u8 key[POLY1305_KEY_SIZE])
> > +void poly1305_init(struct poly1305_desc_ctx *desc,
> > +		   const u8 key[POLY1305_KEY_SIZE])
> >  {
> >  	desc->s[0] = get_unaligned_le32(key + 16);
> >  	desc->s[1] = get_unaligned_le32(key + 20);
> >  	desc->s[2] = get_unaligned_le32(key + 24);
> >  	desc->s[3] = get_unaligned_le32(key + 28);
> >  	desc->buflen = 0;
> > -	poly1305_block_init_generic(&desc->state, key);
> > +	if (IS_ENABLED(CONFIG_CRYPTO_ARCH_HAVE_LIB_POLY1305))
> > +		poly1305_block_init_arch(&desc->state, key);
> > +	else
> > +		poly1305_block_init_generic(&desc->state, key);
> >  }
> > -EXPORT_SYMBOL_GPL(poly1305_init_generic);
> > +EXPORT_SYMBOL(poly1305_init);
> >  
> > -static inline void poly1305_block(struct poly1305_block_state *state, const u8 *src,
> > -				  unsigned int len)
> > +static inline void poly1305_block(struct poly1305_block_state *state,
> > +				  const u8 *src, unsigned int len)
> >  {
> > -	poly1305_blocks_generic(state, src, len, 1);
> > +	if (!IS_ENABLED(CONFIG_CRYPTO_ARCH_HAVE_LIB_POLY1305))
> > +		poly1305_blocks_generic(state, src, len, 1);
> > +	poly1305_blocks_arch(state, src, len, 1);
> >  }
> >  
> > -void poly1305_update_generic(struct poly1305_desc_ctx *desc, const u8 *src,
> > -			     unsigned int nbytes)
> > +void poly1305_update(struct poly1305_desc_ctx *desc,
> > +		     const u8 *src, unsigned int nbytes)
> >  {
> >  	desc->buflen = BLOCK_HASH_UPDATE(&poly1305_block, &desc->state,
> >  					 src, nbytes, POLY1305_BLOCK_SIZE,
> >  					 desc->buf, desc->buflen);
> >  }
> > -EXPORT_SYMBOL_GPL(poly1305_update_generic);
> > +EXPORT_SYMBOL(poly1305_update);
> 
> This randomly changes it to only do 1 block at a time.
> 
> And it also changes it to call poly1305_blocks_arch() even if the arch doesn't
> have it, causing build errors.

Actually maybe it still does more than 1 block at a time, since the '1' is
actually the padbit argument, and maybe poly1305_block() is missing an "s"
accidentally.  Hard to tell because the code is obfuscated in the macro though.

- Eric

  reply	other threads:[~2025-04-24 16:21 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-24 10:46 [PATCH 00/15] crypto: lib - Add partial block helper Herbert Xu
2025-04-24 10:46 ` [PATCH 01/15] crypto: lib/sha256 - Move partial block handling out Herbert Xu
2025-04-24 15:41   ` Eric Biggers
2025-04-25 11:42     ` Herbert Xu
2025-04-24 10:47 ` [PATCH 02/15] crypto: lib/poly1305 - Add block-only interface Herbert Xu
2025-04-24 16:14   ` Eric Biggers
2025-04-25 11:49     ` Herbert Xu
2025-04-27  1:41       ` Eric Biggers
2025-04-27  1:47         ` Herbert Xu
2025-04-24 10:47 ` [PATCH 03/15] crypto: arm/poly1305 " Herbert Xu
2025-04-24 10:47 ` [PATCH 04/15] crypto: arm64/poly1305 " Herbert Xu
2025-04-24 10:47 ` [PATCH 05/15] crypto: mips/poly1305 " Herbert Xu
2025-04-24 10:47 ` [PATCH 06/15] crypto: powerpc/poly1305 " Herbert Xu
2025-04-24 10:47 ` [PATCH 07/15] crypto: x86/poly1305 " Herbert Xu
2025-04-24 10:47 ` [PATCH 08/15] crypto: poly1305 - Use API partial block handling Herbert Xu
2025-04-24 15:36   ` Eric Biggers
2025-04-25  3:42     ` Herbert Xu
2025-04-25  3:59       ` Eric Biggers
2025-04-25 11:40         ` Herbert Xu
2025-04-24 10:47 ` [PATCH 09/15] crypto: lib/poly1305 - Use block-only interface Herbert Xu
2025-04-24 15:48   ` Eric Biggers
2025-04-24 16:21     ` Eric Biggers [this message]
2025-04-25 11:43     ` Herbert Xu
2025-04-24 10:47 ` [PATCH 10/15] crypto: chacha20poly1305 - Use setkey on poly1305 Herbert Xu
2025-04-24 10:47 ` [PATCH 11/15] crypto: testmgr/poly1305 " Herbert Xu
2025-04-24 10:47 ` [PATCH 12/15] crypto: poly1305 - Make setkey mandatory Herbert Xu
2025-04-24 10:47 ` [PATCH 13/15] crypto: arm64/polyval - Use API partial block handling Herbert Xu
2025-04-24 10:47 ` [PATCH 14/15] crypto: x86/polyval " Herbert Xu
2025-04-24 10:47 ` [PATCH 15/15] crypto: polyval-generic " Herbert Xu
2025-04-24 16:17 ` [PATCH 00/15] crypto: lib - Add partial block helper Eric Biggers
2025-04-25 11:52   ` 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=20250424162112.GG2427@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --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