aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/crypto/sha.h
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2015-04-09 12:55:34 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2015-04-10 21:39:39 +0800
commit11b8d5ef91388162103bf28f2e9d6dfd400d192d (patch)
treefc9891eb9efe548edf71fd43c02a1cd266a27dab /include/crypto/sha.h
parentcrypto: sha1 - implement base layer for SHA-1 (diff)
downloadwireguard-linux-11b8d5ef91388162103bf28f2e9d6dfd400d192d.tar.xz
wireguard-linux-11b8d5ef91388162103bf28f2e9d6dfd400d192d.zip
crypto: sha256 - implement base layer for SHA-256
To reduce the number of copies of boilerplate code throughout the tree, this patch implements generic glue for the SHA-256 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 (sha256_block_fn)(struct sha256_state *sst, u8 const *src, int blocks) and pass it to the SHA-256 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 sha256_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>
Diffstat (limited to 'include/crypto/sha.h')
-rw-r--r--include/crypto/sha.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/crypto/sha.h b/include/crypto/sha.h
index a9aad8e63f43..a75bc80cc776 100644
--- a/include/crypto/sha.h
+++ b/include/crypto/sha.h
@@ -71,8 +71,8 @@ struct sha1_state {
};
struct sha256_state {
- u64 count;
u32 state[SHA256_DIGEST_SIZE / 4];
+ u64 count;
u8 buf[SHA256_BLOCK_SIZE];
};