Re: [PATCH RFC 1/2] crypto: ti: Add support for SHA224/256/384/512 in DTHE V2 driver
From: T Pratham
Date: Wed Apr 02 2025 - 10:18:39 EST
On 02/04/25 19:24, Herbert Xu wrote:
> On Wed, Apr 02, 2025 at 07:01:25PM +0530, T Pratham wrote:
>> How are you planning to restore such states in import if the export is
>> to be made compatible with sha512_state? Do you have any pointers for me
>> on how to change the import/export before sending the next revision of
>> my driver?
> In struct sha512_state buflen is simply stored in the lower bits of
> count[0]. So when you import count[0] you can derive buflen from it
> as
>
> buflen = count[0] & (SHA512_BLOCK_SIZE - 1);
Thanks! I'm assuming then count[1] will store the digest count in sha512
here.
Is this the same for SHA256? Since there the count is not an array, so
is it then count = (digestcnt << 32) & buflen?
>
> Of course when you're exporting don't forget to put buflen into
> the lower bits of count[0] before you write it out.
>
> Cheers,