Re: [PATCH RFC 1/2] crypto: ti: Add support for SHA224/256/384/512 in DTHE V2 driver

From: Herbert Xu
Date: Thu Apr 03 2025 - 04:36:16 EST


On Thu, Apr 03, 2025 at 01:58:47PM +0530, T Pratham wrote:
>
> I'm so sorry, for it slipped out of my mind that `u8 phash_available`
> also needs to be restored at import. It's just stores a boolean 0/1. How
> to go about handling this?

You should be able to derive that from digestcnt. IOW if you have
previously submitted data to the hardware, then phash is available,
and vice versa.

Note that if you go down this route (which many drivers do), then
you're going to need to initialise a zero hash partial state in
the export function like this:

static int ahash_export_zero(struct ahash_request *req, void *out)
{
HASH_FBREQ_ON_STACK(fbreq, req);

return crypto_ahash_init(fbreq) ?:
crypto_ahash_export(fbreq, out);
}

Cheers,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt