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

From: Herbert Xu
Date: Wed Apr 02 2025 - 10:20:00 EST


On Wed, Apr 02, 2025 at 07:42:08PM +0530, T Pratham wrote:
>
> Thanks! I'm assuming then count[1] will store the digest count in sha512
> here.

count[1] contains the upper 64 bits of the 128-bit sha512 counter.

> Is this the same for SHA256? Since there the count is not an array, so
> is it then count = (digestcnt << 32) & buflen? 

The sha256 counter is only 64 bits long, so only count[0] gets
written out. There is no need to do any shifting for either sha256
or sha512, it should just be:

count = digestcnt + buflen;

Where digestcnt is a multiple of blocksize and buflen is less than
blocksize.

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