summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2020-07-08 18:39:40 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2020-07-16 13:49:05 +0200
commit9ea9c58b40a441a0babef8c615acedcfb3733919 (patch)
treedc3f3877b658e2a9ce6432550e0e5a6d22095d75 /include
parentcrypto: sparc - rename sha256 to sha256_alg (diff)
downloadlinux-9ea9c58b40a441a0babef8c615acedcfb3733919.tar.xz
linux-9ea9c58b40a441a0babef8c615acedcfb3733919.zip
crypto: lib/sha256 - add sha256() function
Add a function sha256() which computes a SHA-256 digest in one step, combining sha256_init() + sha256_update() + sha256_final(). This is similar to how we also have blake2s(). Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Tested-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include')
-rw-r--r--include/crypto/sha.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/crypto/sha.h b/include/crypto/sha.h
index 10753ff71d46..4ff3da816630 100644
--- a/include/crypto/sha.h
+++ b/include/crypto/sha.h
@@ -147,6 +147,7 @@ static inline void sha256_init(struct sha256_state *sctx)
}
void sha256_update(struct sha256_state *sctx, const u8 *data, unsigned int len);
void sha256_final(struct sha256_state *sctx, u8 *out);
+void sha256(const u8 *data, unsigned int len, u8 *out);
static inline void sha224_init(struct sha256_state *sctx)
{