vboot: Add VBOOT_ARMV8_CE_SHA256_ACCELERATION config

Add Kconfig option for VBOOT_ARMV8_CE_SHA256_ACCELERATION, which will
use ARMv8 Crypto Extension for SHA256[1] instead of software
implementation.

This will speed up firmware verification in verstage.

[1] https://crrev.com/c/4170144

BUG=b:263514393
BRANCH=corsola
TEST='calculating body hash (SHA2)' get 13 msecs improvement on
Tentacruel.
Before:
 509:finished calculating body hash (SHA2)             161,548 (14,490)

After:
 509:finished calculating body hash (SHA2)             155,101 (1,187)

Change-Id: I02671338fd9e0deb5294dbb7c03528061edc18c4
Signed-off-by: Yidi Lin <yidilin@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/72711
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Yidi Lin 2023-01-31 15:18:57 +08:00 committed by Felix Held
parent 70409217e7
commit bd6b81dcad
2 changed files with 9 additions and 0 deletions

View File

@ -291,6 +291,14 @@ config VBOOT_X86_SHA256_ACCELERATION
Use sha256msg1, sha256msg2, sha256rnds2 instruction to accelerate Use sha256msg1, sha256msg2, sha256rnds2 instruction to accelerate
SHA hash calculation in vboot. SHA hash calculation in vboot.
config VBOOT_ARMV8_CE_SHA256_ACCELERATION
bool "Use ARMv8 Crypto Extension for sha256 hash calculation"
default y if CHROMEOS
default n
depends on ARCH_ARM64
help
Use ARMv8 Crypto Extension to accelerate SHA hash calculation in vboot.
config VBOOT_DEFINE_WIDEVINE_COUNTERS config VBOOT_DEFINE_WIDEVINE_COUNTERS
bool bool
default n default n

View File

@ -30,6 +30,7 @@ $$(VBOOT_LIB_$(1)): $(obj)/config.h
EC_EFS="$(CONFIG_VBOOT_EC_EFS)" \ EC_EFS="$(CONFIG_VBOOT_EC_EFS)" \
X86_SHA_EXT="$(if $(CONFIG_ARCH_$(call toupper,$(1))_X86_32)$(CONFIG_ARCH_$(call toupper,$(1))_X86_64),$\ X86_SHA_EXT="$(if $(CONFIG_ARCH_$(call toupper,$(1))_X86_32)$(CONFIG_ARCH_$(call toupper,$(1))_X86_64),$\
$(CONFIG_VBOOT_X86_SHA256_ACCELERATION))" \ $(CONFIG_VBOOT_X86_SHA256_ACCELERATION))" \
ARMV8_CRYPTO_EXT="$(if $(CONFIG_ARCH_$(call toupper,$(1))_ARMV8_64),$$(CONFIG_VBOOT_ARMV8_CE_SHA256_ACCELERATION))" \
$(MAKE) -C $(VBOOT_SOURCE) \ $(MAKE) -C $(VBOOT_SOURCE) \
BUILD=$$(abspath $$(dir $$(VBOOT_LIB_$(1)))) \ BUILD=$$(abspath $$(dir $$(VBOOT_LIB_$(1)))) \
V=$(V) \ V=$(V) \