[v3 PATCH 01/13] crypto: sha256 - support arch-optimized lib and expose through shash

2025-04-27 Thread Herbert Xu
From: Eric Biggers As has been done for various other algorithms, rework the design of the SHA-256 library to support arch-optimized implementations, and make crypto/sha256.c expose both generic and arch-optimized shash algorithms that wrap the library functions. This allows users of the SHA-256

[v2 PATCH 01/13] crypto: sha256 - support arch-optimized lib and expose through shash

2025-04-26 Thread Herbert Xu
From: Eric Biggers As has been done for various other algorithms, rework the design of the SHA-256 library to support arch-optimized implementations, and make crypto/sha256.c expose both generic and arch-optimized shash algorithms that wrap the library functions. This allows users of the SHA-256

Re: [PATCH 01/13] crypto: sha256 - support arch-optimized lib and expose through shash

2025-04-26 Thread Eric Biggers
On Sun, Apr 27, 2025 at 09:52:42AM +0800, Herbert Xu wrote: > On Sat, Apr 26, 2025 at 06:50:41PM -0700, Eric Biggers wrote: > > > > But this one does have a lib/crypto/ interface now. There's no reason not > > to > > use it here. > > I need to maintain a consistent export format between shash an

Re: [PATCH 01/13] crypto: sha256 - support arch-optimized lib and expose through shash

2025-04-26 Thread Herbert Xu
On Sat, Apr 26, 2025 at 07:05:50PM -0700, Eric Biggers wrote: > > Why? And how is that relevant here, when the export format should just be Because I want to be able to fall back from an ahash to shash in the middle of a hash, i.e., I need to be able to export from the ahash, import it into an sh

Re: [PATCH 01/13] crypto: sha256 - support arch-optimized lib and expose through shash

2025-04-26 Thread Eric Biggers
On Sun, Apr 27, 2025 at 09:17:28AM +0800, Herbert Xu wrote: > On Sat, Apr 26, 2025 at 06:12:28PM -0700, Eric Biggers wrote: > > > > No, that would be silly. I'm not doing that. The full update including the > > partial block handling is already needed in the library. There is no need > > to > >

Re: [PATCH 01/13] crypto: sha256 - support arch-optimized lib and expose through shash

2025-04-26 Thread Herbert Xu
On Sat, Apr 26, 2025 at 06:50:41PM -0700, Eric Biggers wrote: > > But this one does have a lib/crypto/ interface now. There's no reason not to > use it here. I need to maintain a consistent export format between shash and ahash, and the easiest way to do that is to use the shash partial block han

Re: [PATCH 01/13] crypto: sha256 - support arch-optimized lib and expose through shash

2025-04-26 Thread Herbert Xu
On Sat, Apr 26, 2025 at 06:12:28PM -0700, Eric Biggers wrote: > > No, that would be silly. I'm not doing that. The full update including the > partial block handling is already needed in the library. There is no need to > implement it again at the shash level. shash implements a lot more algori

Re: [PATCH 01/13] crypto: sha256 - support arch-optimized lib and expose through shash

2025-04-26 Thread Eric Biggers
On Sun, Apr 27, 2025 at 09:06:51AM +0800, Herbert Xu wrote: > Eric Biggers wrote: > > > > +static int crypto_sha256_update_arch(struct shash_desc *desc, const u8 > > *data, > > +unsigned int len) > > +{ > > + sha256_update(shash_desc_ctx(desc), data, len)

Re: [PATCH 01/13] crypto: sha256 - support arch-optimized lib and expose through shash

2025-04-26 Thread Herbert Xu
Eric Biggers wrote: > > +static int crypto_sha256_update_arch(struct shash_desc *desc, const u8 *data, > +unsigned int len) > +{ > + sha256_update(shash_desc_ctx(desc), data, len); > + return 0; > +} Please use the block functions directly in the sh

[PATCH 01/13] crypto: sha256 - support arch-optimized lib and expose through shash

2025-04-25 Thread Eric Biggers
From: Eric Biggers As has been done for various other algorithms, rework the design of the SHA-256 library to support arch-optimized implementations, and make crypto/sha256.c expose both generic and arch-optimized shash algorithms that wrap the library functions. This allows users of the SHA-256