On Wed, Mar 08, 2023 at 06:10:14PM +0800, Herbert Xu wrote: > > If it's just empty messages, which we know are broken with ux500 > to begin with, then we can simply not do the hash at all (doing > it and then throwing it away seems pointless). Here is a patch to not process empty messages at all. Cheers, -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c index ff6e4f1e47ed..3f436fa0e5c1 100644 --- a/drivers/crypto/stm32/stm32-hash.c +++ b/drivers/crypto/stm32/stm32-hash.c @@ -374,9 +374,15 @@ static int stm32_hash_xmit_cpu(struct stm32_hash_dev *hdev, const u32 *buffer = (const u32 *)buf; u32 reg; - if (final) + if (final) { hdev->flags |= HASH_FLAGS_FINAL; + /* Do not process empty messages if hw is buggy. */ + if (!(hdev->flags & HASH_FLAGS_INIT) && !length && + hdev->pdata->broken_emptymsg) + return 0; + } + len32 = DIV_ROUND_UP(length, sizeof(u32)); dev_dbg(hdev->dev, "%s: length: %zd, final: %x len32 %i\n",