diff options
-rw-r--r-- | src/soc/amd/common/psp_verstage/vboot_crypto.c | 8 | ||||
-rw-r--r-- | src/soc/rockchip/rk3288/crypto.c | 5 |
2 files changed, 3 insertions, 10 deletions
diff --git a/src/soc/amd/common/psp_verstage/vboot_crypto.c b/src/soc/amd/common/psp_verstage/vboot_crypto.c index 89a4ccea51..81a6740668 100644 --- a/src/soc/amd/common/psp_verstage/vboot_crypto.c +++ b/src/soc/amd/common/psp_verstage/vboot_crypto.c @@ -17,15 +17,11 @@ static uint8_t __attribute__((aligned(32))) sha_hash[64]; vb2_error_t vb2ex_hwcrypto_digest_init(enum vb2_hash_algorithm hash_alg, uint32_t data_size) { - printk(BIOS_DEBUG, "Calculating hash of %d bytes\n", data_size); + if (!data_size || platform_set_sha_op(hash_alg, &sha_op) != 0) + return VB2_ERROR_EX_HWCRYPTO_UNSUPPORTED; sha_op_size_remaining = data_size; - if (platform_set_sha_op(hash_alg, &sha_op) != 0) { - printk(BIOS_INFO, "Unsupported hash_alg %d!\n", hash_alg); - return VB2_ERROR_EX_HWCRYPTO_UNSUPPORTED; - } - /* Set init flag for first operation */ sha_op.Init = 1; diff --git a/src/soc/rockchip/rk3288/crypto.c b/src/soc/rockchip/rk3288/crypto.c index 6ce6a27c95..450a8a05ac 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 */ |