
On Wed, 27 Feb 2013 10:24:39 -0500 Akshay Saraswat akshay.s@samsung.com wrote:
SHA-256 and SHA-1 accelerated using ACE hardware.
TEST=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.
can we get rid of this TEST= infrastructure format? It's not used on upstream u-boot.
Signed-off-by: ARUN MANKUZHI arun.m@samsung.com Signed-off-by: Akshay Saraswat akshay.s@samsung.com
arch/arm/cpu/armv7/exynos/Makefile | 4 + arch/arm/cpu/armv7/exynos/ace_sha.c | 118 +++++++++++ arch/arm/include/asm/arch-exynos/ace_sfr.h | 310 +++++++++++++++++++++++++++++ arch/arm/include/asm/arch-exynos/ace_sha.h | 41 ++++ arch/arm/include/asm/arch-exynos/cpu.h | 4 + 5 files changed, 477 insertions(+) create mode 100644 arch/arm/cpu/armv7/exynos/ace_sha.c create mode 100644 arch/arm/include/asm/arch-exynos/ace_sfr.h create mode 100644 arch/arm/include/asm/arch-exynos/ace_sha.h
I doubt there's anything binding this to arch-exynos, and I bet the h/w is going to be available - if not already - on some other parts, so it probably belongs in a new drivers/crypto directory.
+/* Maximum input data size is 8 MB. Timeout observed for data size above 8MB */ +#define TIMEOUT_MS 100
So if there's a drop in processor frequency, the driver times out too early? Not good.
+#define SHA1_DIGEST_LEN 20 +#define SHA256_DIGEST_LEN 32
don't duplicate definitions that already exist in include/sha*.h.
- if (buf_len == 0) {
/* ACE H/W cannot compute hash value for empty string */
if (hash_type == ACE_SHA_TYPE_SHA1)
memcpy(pout, sha1_digest_emptymsg, SHA1_DIGEST_LEN);
else
memcpy(pout, sha256_digest_emptymsg, SHA256_DIGEST_LEN);
return 0;
- }
there's no protection from buf_len going over the h/w 8MB limit mentioned above - why not fall back to the s/w implementation in both those cases? Or, if the h/w can be programmed to perform multiple hash updates in 8MB data chunks, add support to do that.
- /* Read hash result */
- pdigest = (unsigned int *)pout;
- len = (hash_type == ACE_SHA_TYPE_SHA1) ? 5 : 8;
magic numbers - use SHAx_SUM_LEN / 4.
Kim