aboutsummaryrefslogtreecommitdiff
path: root/crypto/sha256_generic.c
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amatus.name>2014-08-13 16:14:13 -0500
committerDavid Barksdale <amatus@amatus.name>2014-08-13 16:14:13 -0500
commitace6c6d243016e272050787c14e27a83ecd94a25 (patch)
treec837edb1ca98b2552fbc7edba47aeb63f98ca1f0 /crypto/sha256_generic.c
parent1b6e1688bd215cd7c9cb75650fa815a1ec6567e1 (diff)
Diffstat (limited to 'crypto/sha256_generic.c')
-rw-r--r--crypto/sha256_generic.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/crypto/sha256_generic.c b/crypto/sha256_generic.c
index c48459ebf05..5868d962229 100644
--- a/crypto/sha256_generic.c
+++ b/crypto/sha256_generic.c
@@ -336,6 +336,20 @@ static int sha256_import(struct shash_desc *desc, const void *in)
return 0;
}
+static int sha256_partial(struct shash_desc *desc, u8 *data)
+{
+ struct sha256_state *sctx = shash_desc_ctx(desc);
+ int i;
+
+ for (i = 0; i < 8; i++) {
+ *data++ = sctx->state[i] & 0xFF;
+ *data++ = (sctx->state[i] >> 8) & 0xFF;
+ *data++ = (sctx->state[i] >> 16) & 0xFF;
+ *data++ = (sctx->state[i] >> 24) & 0xFF;
+ }
+ return 0;
+}
+
static struct shash_alg sha256 = {
.digestsize = SHA256_DIGEST_SIZE,
.init = sha256_init,
@@ -343,6 +357,8 @@ static struct shash_alg sha256 = {
.final = sha256_final,
.export = sha256_export,
.import = sha256_import,
+ .partial = sha256_partial,
+ .partialsize = SHA256_DIGEST_SIZE,
.descsize = sizeof(struct sha256_state),
.statesize = sizeof(struct sha256_state),
.base = {
@@ -359,6 +375,8 @@ static struct shash_alg sha224 = {
.init = sha224_init,
.update = sha256_update,
.final = sha224_final,
+ .partial = sha256_partial,
+ .partialsize = SHA256_DIGEST_SIZE,
.descsize = sizeof(struct sha256_state),
.base = {
.cra_name = "sha224",