summaryrefslogtreecommitdiff
path: root/include/config.h
diff options
context:
space:
mode:
authorCHLin <CHLin56@nuvoton.com>2020-09-29 14:23:59 +0800
committerCommit Bot <commit-bot@chromium.org>2020-10-13 11:29:46 +0000
commit0f12014ad53ddfd0063a733a1357f81478136dc8 (patch)
treeb8a4e3b500ed7b9d28ae67588b8ceba42879503c /include/config.h
parent44435d3b9c447ad25edaa8aece42f1cff0dd6df9 (diff)
downloadchrome-ec-0f12014ad53ddfd0063a733a1357f81478136dc8.tar.gz
npcx9: support SHA256 hardware accelerator
There is the hardware accelerator for SHA computation inside npcx9. This CL wraps the Nuvoton SHA library APIs (which are in the ROM) to Chromium EC's SHA256_* APIs to speed up the SHA256 computation. With the help of the hardware accelerator, the hash computation runs several times faster than the software method (see b:155771688 for more detailed evaluation data.) Also, we can gain ~840 bytes of code size. BRANCH=none BUG=b:165777478 BUG=b:155771688 TEST=pass "make buildall" TEST=flash the same RW image; #define/#undef CONFIG_SHA256_HW_ACCELERATE ; verify the RW hash value is the same in the console message. TEST=with the following test CL, move test patterns in test/sha256.c to board/npcx9_evb/test_sha256.c; pass all test patterns. Signed-off-by: CHLin <CHLin56@nuvoton.com> Change-Id: I45ca609889bd73573d67d15f3e561614201e60f6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2455021 Tested-by: CH Lin <chlin56@nuvoton.com> Auto-Submit: CH Lin <chlin56@nuvoton.com> Reviewed-by: caveh jalali <caveh@chromium.org> Commit-Queue: caveh jalali <caveh@chromium.org>
Diffstat (limited to 'include/config.h')
-rw-r--r--include/config.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h
index 1921828c70..612afacad7 100644
--- a/include/config.h
+++ b/include/config.h
@@ -3334,6 +3334,9 @@
/* Support computing of other hash sizes (without the VBOOT code) */
#undef CONFIG_SHA256
+/* Compute SHA256 by using chip's hardware accelerator */
+#undef CONFIG_SHA256_HW_ACCELERATE
+
/* Unroll some loops in SHA256_transform for better performance. */
#undef CONFIG_SHA256_UNROLLED