diff options
author | Marek Vasut <marex@denx.de> | 2023-01-12 18:58:39 +0100 |
---|---|---|
committer | Patrice Chotard <patrice.chotard@foss.st.com> | 2023-01-13 13:46:57 +0100 |
commit | bbafbc044dcab06eccba0dc6a7235a0c6e782484 (patch) | |
tree | 988050a959ce2565e91bbcdf3f8bed2f426137bf | |
parent | d3a87e32dd0841463c2d5ea0778aecf0fc03a93a (diff) | |
download | u-boot-bbafbc044dcab06eccba0dc6a7235a0c6e782484.tar.gz u-boot-bbafbc044dcab06eccba0dc6a7235a0c6e782484.tar.bz2 u-boot-bbafbc044dcab06eccba0dc6a7235a0c6e782484.zip |
ARM: stm32: Fix ECDSA authentication with Dcache enabled
In case Dcache is enabled while the ECDSA authentication function is
called via BootROM ROM API, the MMU tables are set up and the BootROM
region is not marked as executable, so an attempt to run code from it
results in a hang. Mark the BootROM region as executable as suggested
by Patrick to prevent the hang.
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
-rw-r--r-- | arch/arm/mach-stm32mp/ecdsa_romapi.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/arm/mach-stm32mp/ecdsa_romapi.c b/arch/arm/mach-stm32mp/ecdsa_romapi.c index a2f63ff879..6156526253 100644 --- a/arch/arm/mach-stm32mp/ecdsa_romapi.c +++ b/arch/arm/mach-stm32mp/ecdsa_romapi.c @@ -81,6 +81,10 @@ static int romapi_ecdsa_verify(struct udevice *dev, memcpy(raw_key + 32, pubkey->y, 32); stm32mp_rom_get_ecdsa_functions(&rom); + + /* Mark BootROM region as executable. */ + mmu_set_region_dcache_behaviour(0, SZ_2M, DCACHE_DEFAULT_OPTION); + rom_ret = rom.ecdsa_verify_signature(hash, raw_key, signature, algo); return rom_ret == ROM_API_SUCCESS ? 0 : -EPERM; |