Re: [PATCH v3 01/16] crypto: sha1: implement base layer for SHA-1

2015-04-08 Thread Ard Biesheuvel
On 8 April 2015 at 15:19, Herbert Xu herb...@gondor.apana.org.au wrote: On Tue, Apr 07, 2015 at 10:51:49AM +0200, Ard Biesheuvel wrote: +typedef void (sha1_block_fn)(int blocks, u8 const *src, u32 *state, + const u8 *head, void *p); Does this really need five

Re: [PATCH v3 01/16] crypto: sha1: implement base layer for SHA-1

2015-04-08 Thread Ard Biesheuvel
On 8 April 2015 at 15:30, Herbert Xu herb...@gondor.apana.org.au wrote: On Wed, Apr 08, 2015 at 03:25:14PM +0200, Ard Biesheuvel wrote: Not having to call the function twice is the whole point. In the arm64 case, all the SHA-256 round keys can be kept in registers (it has 32 16-byte SIMD

Re: [PATCH v3 01/16] crypto: sha1: implement base layer for SHA-1

2015-04-08 Thread Ard Biesheuvel
On 8 April 2015 at 15:40, Ard Biesheuvel ard.biesheu...@linaro.org wrote: On 8 April 2015 at 15:30, Herbert Xu herb...@gondor.apana.org.au wrote: On Wed, Apr 08, 2015 at 03:25:14PM +0200, Ard Biesheuvel wrote: Not having to call the function twice is the whole point. In the arm64 case, all

Re: [PATCH v3 01/16] crypto: sha1: implement base layer for SHA-1

2015-04-08 Thread Herbert Xu
On Wed, Apr 08, 2015 at 03:40:56PM +0200, Ard Biesheuvel wrote: This is not the partial code path, it is the .finup path, in fact. Anything that hashes data that is often a multiple of the block size (which is more likely for block based applications than for IPsec, I think) should benefit

Re: [PATCH v3 01/16] crypto: sha1: implement base layer for SHA-1

2015-04-08 Thread Herbert Xu
On Wed, Apr 08, 2015 at 03:25:14PM +0200, Ard Biesheuvel wrote: Not having to call the function twice is the whole point. In the arm64 case, all the SHA-256 round keys can be kept in registers (it has 32 16-byte SIMD registers), and that is what motivates this pattern. By passing a head

Re: [PATCH v3 01/16] crypto: sha1: implement base layer for SHA-1

2015-04-08 Thread Herbert Xu
On Tue, Apr 07, 2015 at 10:51:49AM +0200, Ard Biesheuvel wrote: +typedef void (sha1_block_fn)(int blocks, u8 const *src, u32 *state, + const u8 *head, void *p); Does this really need five arguments? First of all we can get rid of head by just calling this function

Re: [PATCH v3 01/16] crypto: sha1: implement base layer for SHA-1

2015-04-08 Thread Ard Biesheuvel
On 8 April 2015 at 16:06, Herbert Xu herb...@gondor.apana.org.au wrote: On Wed, Apr 08, 2015 at 03:40:56PM +0200, Ard Biesheuvel wrote: This is not the partial code path, it is the .finup path, in fact. Anything that hashes data that is often a multiple of the block size (which is more likely

Re: [PATCH v3 01/16] crypto: sha1: implement base layer for SHA-1

2015-04-08 Thread Herbert Xu
On Wed, Apr 08, 2015 at 04:18:56PM +0200, Ard Biesheuvel wrote: So what about +typedef void (sha1_block_fn)(int blocks, u8 const *src, u32 *state, + bool final); ? Looks good to me. Thanks, -- Email: Herbert Xu herb...@gondor.apana.org.au Home Page:

[PATCH v3 01/16] crypto: sha1: implement base layer for SHA-1

2015-04-07 Thread Ard Biesheuvel
To reduce the number of copies of boilerplate code throughout the tree, this patch implements generic glue for the SHA-1 algorithm. This allows a specific arch or hardware implementation to only implement the special handling that it needs. Signed-off-by: Ard Biesheuvel ard.biesheu...@linaro.org