summaryrefslogtreecommitdiffstats
path: root/src/soc/rockchip/rk3288/crypto.c
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2022-08-09 18:46:50 -0700
committerJulius Werner <jwerner@chromium.org>2022-08-12 20:59:59 +0000
commit99a9928447568e0144a61ea1d1799ecd99b31b9d (patch)
tree346de50def36a9f1c46d8dd4adf476acce33105c /src/soc/rockchip/rk3288/crypto.c
parent5ef258b3f6a6481d20f1fca0f60db894b80649ab (diff)
downloadcoreboot-99a9928447568e0144a61ea1d1799ecd99b31b9d.tar.gz
coreboot-99a9928447568e0144a61ea1d1799ecd99b31b9d.tar.bz2
coreboot-99a9928447568e0144a61ea1d1799ecd99b31b9d.zip
soc/(amd|rockchip): Update vb2ex_hwcrypto implementations to new API req
We want to extend the vb2ex_hwcrypto APIs on the vboot side to allow passing 0 for the data_size parameter to vb2ex_hwcrypto_digest_init() (see CL:3825558). This is because not all use cases allow knowing the amount of data to be hashed beforehand (most notable the metadata hash for CBFS verification), and some HW crypto engines do not need this information, so we don't want to preclude them from optimizing these use cases just because others do. The new API requirement is that data_size may be 0, which indicates that the amount of data to be hashed is unknown. If a HW crypto engine cannot support this case, it should return VB2_ERROR_EX_HWCRYPTO_UNSUPPORTED to those calls (this patch adds the code to do that to existing HW crypto implementations). If the passed-in data_size value is non-zero, the HW crypto implementation can trust that it is accurate. Also reduce a bit of the console spew for existing HW crypto implementations, since vboot already logs the same information anyway. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Ieb7597080254b31ef2bdbc0defc91b119c618380 Reviewed-on: https://review.coreboot.org/c/coreboot/+/66621 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com> Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Diffstat (limited to 'src/soc/rockchip/rk3288/crypto.c')
-rw-r--r--src/soc/rockchip/rk3288/crypto.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/soc/rockchip/rk3288/crypto.c b/src/soc/rockchip/rk3288/crypto.c
index 6ce6a27c95e4..450a8a05ac90 100644
--- a/src/soc/rockchip/rk3288/crypto.c
+++ b/src/soc/rockchip/rk3288/crypto.c
@@ -58,11 +58,8 @@ check_member(rk3288_crypto, trng_dout[7], 0x220);
vb2_error_t vb2ex_hwcrypto_digest_init(enum vb2_hash_algorithm hash_alg,
uint32_t data_size)
{
- if (hash_alg != VB2_HASH_SHA256) {
- printk(BIOS_INFO, "RK3288 doesn't support hash_alg %d!\n",
- hash_alg);
+ if (hash_alg != VB2_HASH_SHA256 || !data_size)
return VB2_ERROR_EX_HWCRYPTO_UNSUPPORTED;
- }
write32(&crypto->ctrl, RK_SETBITS(1 << 6)); /* Assert HASH_FLUSH */
udelay(1); /* for 10+ cycles to */