[U-Boot] [PATCH 3/4 v3] gen: Add ACE acceleration to hash
Akshay Saraswat
akshay.s at samsung.com
Fri Mar 1 17:16:24 CET 2013
ACE H/W acceleration support is added to hash
which can be used to test SHA 256 hash algorithm.
Tested with command "hash sha256 0x40008000 0x2B 0x40009000".
Used mm and md to write a standard string to memory location
0x40008000 and ran the above command to verify the output.
Change-Id: If76820057763e833a6150e55bffea3d010b86721
Signed-off-by: ARUN MANKUZHI <arun.m at samsung.com>
Signed-off-by: Akshay Saraswat <akshay.s at samsung.com>
---
Changes sice v2:
- Added new nodes for SHA1 and SHA256 in struct hash_algo for the case when ACE is enabled.
- Added new declaration for function pointer hash_func_ws with different return type.
common/hash.c | 15 +++++++++++++++
include/hash.h | 5 +++++
2 files changed, 20 insertions(+)
diff --git a/common/hash.c b/common/hash.c
index e3a6e43..b8f9d29 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -28,12 +28,26 @@
#include <hash.h>
#include <sha1.h>
#include <sha256.h>
+#include <ace_sha.h>
/*
* These are the hash algorithms we support. Chips which support accelerated
* crypto could perhaps add named version of these algorithms here.
*/
static struct hash_algo hash_algo[] = {
+#ifdef CONFIG_EXYNOS_ACE_SHA
+ {
+ "SHA1",
+ SHA1_SUM_LEN,
+ ace_sha_hash_digest,
+ ACE_SHA_TYPE_SHA1,
+ }, {
+ "SHA256",
+ SHA256_SUM_LEN,
+ ace_sha_hash_digest,
+ ACE_SHA_TYPE_SHA256,
+ },
+#else
#ifdef CONFIG_SHA1
{
"SHA1",
@@ -50,6 +64,7 @@ static struct hash_algo hash_algo[] = {
CHUNKSZ_SHA256,
},
#endif
+#endif
};
/**
diff --git a/include/hash.h b/include/hash.h
index 34ba558..83e1fb6 100644
--- a/include/hash.h
+++ b/include/hash.h
@@ -40,8 +40,13 @@ struct hash_algo {
* @output: Checksum result (length depends on algorithm)
* @chunk_sz: Trigger watchdog after processing this many bytes
*/
+#ifdef CONFIG_EXYNOS_ACE_SHA
+ int (*hash_func_ws)(const unsigned char *input, unsigned int ilen,
+ unsigned char *output, unsigned int chunk_sz);
+#else
void (*hash_func_ws)(const unsigned char *input, unsigned int ilen,
unsigned char *output, unsigned int chunk_sz);
+#endif
int chunk_size; /* Watchdog chunk size */
};
--
1.8.0
More information about the U-Boot
mailing list