diff options
author | Kangheui Won <khwon@chromium.org> | 2021-01-21 14:52:00 +1100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-07-01 01:51:54 +0000 |
commit | ccc56f46c51fa9d0c2b3c086ace97c14fe887c32 (patch) | |
tree | 0f97f914992421ff48d2ff7d32f6b0933848a568 /Makefile | |
parent | 6a558ef5be4703b9ff61bdc92c4a6f43d8cc406b (diff) | |
download | vboot-ccc56f46c51fa9d0c2b3c086ace97c14fe887c32.tar.gz |
vboot: add x86 SHA256 ext support
Latest x86 processors have SHA256 extension which can accelerate hash
computation in vboot.
This is especially helpful on low-end devices where sha256 computation
takes 70ms-90ms, with this CL it is reduced to 10ms.
BUG=b:162551138
BRANCH=zork
TEST=build and boot, check cbmem -t
TEST=run vb2_sha256_x86_tests on dirinboz
Signed-off-by: Kangheui Won <khwon@chromium.org>
Change-Id: I50e123048d54d5061e8d8e0e0ae804a416130948
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2639457
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Reviewed-by: Raul E Rangel <rrangel@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Commit-Queue: Raul E Rangel <rrangel@chromium.org>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -445,6 +445,14 @@ FWLIB_SRCS += \ firmware/lib/tpm_lite/mocked_tlcl.c endif +ifneq ($(filter-out 0,${X86_SHA_EXT}),) +CFLAGS += -DX86_SHA_EXT +FWLIB_SRCS += \ + firmware/2lib/2sha256_x86.c +endif +# Even if X86_SHA_EXT is 0 we need cflags since this will be compiled for tests +${BUILD}/firmware/2lib/2sha256_x86.o: CFLAGS += -mssse3 -mno-avx -msha + ifeq (${FIRMWARE_ARCH},) # Include BIOS stubs in the firmware library when compiling for host # TODO: split out other stub funcs too @@ -774,6 +782,11 @@ TEST21_NAMES = \ TEST_NAMES += ${TEST2X_NAMES} ${TEST20_NAMES} ${TEST21_NAMES} +# This is build-only test since we can't run this without +# sha-ni extension on x86. To run this test, you have to +# manually copy executable into compatible machine and run it. +TEST_NAMES += tests/vb2_sha256_x86_tests + # And a few more... ifeq (${TPM2_MODE},) TLCL_TEST_NAMES = \ @@ -1095,6 +1108,11 @@ ${TEST20_BINS}: ${FWLIB} ${TEST20_BINS}: LIBS += ${FWLIB} ${TEST20_BINS}: LDLIBS += ${CRYPTO_LIBS} +# Special build for sha256_x86 test +X86_SHA256_TEST = ${BUILD_RUN}/tests/vb2_sha256_x86_tests +${X86_SHA256_TEST}: ${BUILD}/firmware/2lib/2sha256_x86.o +${X86_SHA256_TEST}: LIBS += ${BUILD}/firmware/2lib/2sha256_x86.o + ${TESTLIB}: ${TESTLIB_OBJS} @${PRINTF} " RM $(subst ${BUILD}/,,$@)\n" ${Q}rm -f $@ |