summaryrefslogtreecommitdiff
path: root/common/hash.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-04-13 09:50:45 -0400
committerTom Rini <trini@konsulko.com>2021-04-13 09:50:45 -0400
commita94ab561e2f49a80d8579930e840b810ab1a1330 (patch)
tree77913e7bd9309afa6b2ddc6f3e3e49827da2025c /common/hash.c
parent3b676a1662ac6b54d1e97ea40a0c41ee0925ffe3 (diff)
parent8c4e3b79bd0bb76eea16869e9666e19047c0d005 (diff)
Merge branch '2021-04-13-assorted-improvements'
- A large assortment of bug fixes, code cleanups and a few feature enhancements.
Diffstat (limited to 'common/hash.c')
-rw-r--r--common/hash.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/common/hash.c b/common/hash.c
index fc64002f736..10dff7ddb0e 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -97,7 +97,7 @@ static int hash_finish_sha256(struct hash_algo *algo, void *ctx, void
}
#endif
-#if defined(CONFIG_SHA384)
+#if defined(CONFIG_SHA384) && !defined(CONFIG_SHA_PROG_HW_ACCEL)
static int hash_init_sha384(struct hash_algo *algo, void **ctxp)
{
sha512_context *ctx = malloc(sizeof(sha512_context));
@@ -125,7 +125,7 @@ static int hash_finish_sha384(struct hash_algo *algo, void *ctx, void
}
#endif
-#if defined(CONFIG_SHA512)
+#if defined(CONFIG_SHA512) && !defined(CONFIG_SHA_PROG_HW_ACCEL)
static int hash_init_sha512(struct hash_algo *algo, void **ctxp)
{
sha512_context *ctx = malloc(sizeof(sha512_context));
@@ -260,10 +260,20 @@ static struct hash_algo hash_algo[] = {
.name = "sha384",
.digest_size = SHA384_SUM_LEN,
.chunk_size = CHUNKSZ_SHA384,
+#ifdef CONFIG_SHA_HW_ACCEL
+ .hash_func_ws = hw_sha384,
+#else
.hash_func_ws = sha384_csum_wd,
+#endif
+#ifdef CONFIG_SHA_PROG_HW_ACCEL
+ .hash_init = hw_sha_init,
+ .hash_update = hw_sha_update,
+ .hash_finish = hw_sha_finish,
+#else
.hash_init = hash_init_sha384,
.hash_update = hash_update_sha384,
.hash_finish = hash_finish_sha384,
+#endif
},
#endif
#ifdef CONFIG_SHA512
@@ -271,10 +281,20 @@ static struct hash_algo hash_algo[] = {
.name = "sha512",
.digest_size = SHA512_SUM_LEN,
.chunk_size = CHUNKSZ_SHA512,
+#ifdef CONFIG_SHA_HW_ACCEL
+ .hash_func_ws = hw_sha512,
+#else
.hash_func_ws = sha512_csum_wd,
+#endif
+#ifdef CONFIG_SHA_PROG_HW_ACCEL
+ .hash_init = hw_sha_init,
+ .hash_update = hw_sha_update,
+ .hash_finish = hw_sha_finish,
+#else
.hash_init = hash_init_sha512,
.hash_update = hash_update_sha512,
.hash_finish = hash_finish_sha512,
+#endif
},
#endif
{