lkml.org 
[lkml]   [2021]   [Oct]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/6] crypto: hisilicon/sec - add ahash alg features for Kunpeng920
On Fri, Sep 24, 2021 at 05:27:12PM +0800, Kai Ye wrote:
>
> +static int sec_ahash_import(struct ahash_request *req, const void *in)
> +{
> + /*
> + * Import partial state of the transformation. This function loads the
> + * entire state of the ongoing transformation from a provided block of
> + * data so the transformation can continue from this point onward.
> + */
> + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
> + struct sec_req *sreq = ahash_request_ctx(req);
> + struct sec_ctx *ctx = crypto_ahash_ctx(tfm);
> + const struct sec_ahash_req *state = in;
> +
> + sreq->ctx = ctx;
> + memcpy(&sreq->hash_req, state, sizeof(struct sec_ahash_req));
> +
> + return 0;
> +}

It's still not clear how this function actually works.

Could you please explain how can this work in the following scenario?

x = export_state

reboot_machine

import_state(x)

How do you restore all the internal state so that further data
can be hashed onto the existing hash state after a reboot?

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

\
 
 \ /
  Last update: 2021-10-01 07:59    [W:0.117 / U:1.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site