Re: [PATCH v2 2/6] crypto: hisilicon/sec - add ahash alg features for Kunpeng920

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux