summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVadim Sukhomlinov <sukhomlinov@google.com>2021-07-20 09:28:38 -0700
committerCommit Bot <commit-bot@chromium.org>2021-07-21 20:11:03 +0000
commit7c1e430fa0cfd8a46030c3ef69fd3ab99ebc133a (patch)
tree9d324b1d4de82f23a0e5fb86b06ab9b8ba137a01 /test
parentafa1e4cddef431500ae1763135c4ace60289931d (diff)
downloadchrome-ec-7c1e430fa0cfd8a46030c3ef69fd3ab99ebc133a.tar.gz
cr50: replace call to __aeabi_uldivmod with better implementation
FIPS module should be self contained. Adding __aeabi_uldivmod is challenging as it comes from compiler builtin and used by other parts. In this CL we implement udiv32() which divides 64-bit number by 32-bit number. Since it doesn't compute reminder and don't have to support real 64-bit by 64-bit division it's faster. Also, we can use ARM instruction to count leading zeros instead of doing it manually. This code is reused from Ti50 cryptolib code as is. Exhaustive bn_div() test is provided by test/tpm_test/bn_test.c which is now can be built with board/cr50/dcrypto version. BUG=b:138578318 TEST=make BOARD=cr50 test/tpm_test/make CR50=1 build/tpm_test/bn_test Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: I19cebc5c11d3a80bc50732350b7c598bfa374348 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3042138 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/tpm_test/Makefile11
1 files changed, 9 insertions, 2 deletions
diff --git a/test/tpm_test/Makefile b/test/tpm_test/Makefile
index 23f66317f9..29d3e229bc 100644
--- a/test/tpm_test/Makefile
+++ b/test/tpm_test/Makefile
@@ -22,14 +22,21 @@ SWIG = /usr/bin/swig
PYTHON_INCLUDE = $(shell python3 -c 'import sysconfig; \
print(sysconfig.get_paths().get("include"))')
+ifeq ($(CR50),)
vpath %c $(src) ../../chip/g/dcrypto $(src)/testlib
+CFLAGS += -I../../chip/g/dcrypto
+else
-CFLAGS = -fPIC
+# Use BOARD=cr50 specific implementation
+vpath %c $(src) ../../board/cr50/dcrypto $(src)/testlib
+CFLAGS += -I../../board/cr50/dcrypto
+endif
+
+CFLAGS += -fPIC
CFLAGS += -I ${PYTHON_INCLUDE}
CFLAGS += -I../../../../third_party/cryptoc/include
CFLAGS += -I../../board/cr50
CFLAGS += -I../../chip/g
-CFLAGS += -I../../chip/g/dcrypto
CFLAGS += -I../../fuzz
CFLAGS += -I../../include
CFLAGS += -I..