crypto: sha1 - implement base layer for SHA-1
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 9 Apr 2015 10:55:33 +0000 (12:55 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 10 Apr 2015 13:39:39 +0000 (21:39 +0800)
commitc4d5b9ffa31f7283b34cba991514dacae4c8d3de
tree6ad1da41a7bbb9eef225fe9f76a3039872db4d36
parent9c521a200bc3c12bd724e48a75c57d5358f672be
crypto: sha1 - implement base layer for SHA-1

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.

The users need to supply an implementation of

  void (sha1_block_fn)(struct sha1_state *sst, u8 const *src, int blocks)

and pass it to the SHA-1 base functions. For easy casting between the
prototype above and existing block functions that take a 'u32 state[]'
as their first argument, the 'state' member of struct sha1_state is
moved to the base of the struct.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
include/crypto/sha.h
include/crypto/sha1_base.h [new file with mode: 0644]