Re: [PATCH v3 1/3] crypto: ti - Add support for SHA224/256/384/512 in DTHEv2 driver
From: T Pratham
Date: Mon May 18 2026 - 09:39:49 EST
On 3/14/26 09:29, Herbert Xu wrote:
> On Thu, Feb 26, 2026 at 06:41:01PM +0530, T Pratham wrote:
>>
>> +static int dthe_hash_export(struct ahash_request *req, void *out)
>> +{
>> + struct dthe_hash_req_ctx *rctx = ahash_request_ctx(req);
>> + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
>> + struct dthe_tfm_ctx *ctx = crypto_ahash_ctx(tfm);
>> + union {
>> + u8 *u8;
>> + u64 *u64;
>> + } p = { .u8 = out };
>> +
>> + memcpy(out, rctx->phash, ctx->phash_size);
>> + p.u8 += ctx->phash_size;
>> + put_unaligned(rctx->digestcnt[0], p.u64++);
>> + if (ctx->phash_size >= SHA512_DIGEST_SIZE)
>> + put_unaligned(rctx->digestcnt[1], p.u64++);
>> +
>> + return 0;
>> +}
>
> The hash state must always be exported, even right after initialisation.
> So you need to export the initial SHA stats if phash_available is
> false.
>
> Cheers,
Hi,
I fixed the above and will send a new patch. But I had a question.
What is the expected export/import format for HMAC algorithms? Can't
seem to find a struct similar to sha512_state/sha256_state for hmac.
--
Regards
T Pratham <t-pratham@xxxxxx>