Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp945314pxb; Thu, 30 Sep 2021 23:04:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycGF0iWlmaZstjXGac4vLqxuUY419d2WMr7qxIwiJe7hb8kShCJxAy6oU9DkaWflBZ5f2C X-Received: by 2002:a17:90a:5895:: with SMTP id j21mr17645669pji.99.1633068262320; Thu, 30 Sep 2021 23:04:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633068262; cv=none; d=google.com; s=arc-20160816; b=Ur12DQUThY0I96TqeuBiCGylsSxjXnRgrSGwQioqm0/FHiUAoRsP8g043X48ZgxGQt rfGVEIj1htd34+nxktlQvdEa4+DQDcNkv3zRWseIPVZAG73Ez0nRMJQS9xUI14T4B2S9 VywZ1jppV4cnFDXex8n0g7LUz5z9YQs9RUs5pWEYJGERsL6p7a6bs3vyam/yjaFDw+C5 gQuHGFvNJlA91cIIi+2nKq9nE47nnb5YGCX/h3xRhUGUcKPzkrrrKWgv+gz/VB7of7cA d2UNAmhKsEDUOub+NurisfRuyzmAlvh9aMGpvCotQmARrgg+1OGVhT3OkneJdz+5OMiE 9dZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=wD1zfxQHWweqF21ZA6WDk21uzLpswTxy2RkxKLCQALI=; b=XLvO7ypzj6pw+ll7PSUfjJgsrYjQyLc7mTzJnEwu3Dw6rI9hMIoMNHX4eioeO5UIgV ys0n/+lIt1zLgX0aLV0ryTakCtCTn6u6vhTVpUEqEh4wh9OCVREdweztdg9Kf+PTNgtq 0QMLblI/sPc0gVYN/0Fh+PQcnXlZ1NoYPdzEaDbX3lOSCyQ+WzpTULHxCxhZGDSHuDRx X/ITrjOYpusd+36VPTknb/2wiqyyBM3EMa8/p+opCnj0qDXWH/e+c1xG7gXAd2sWa+O0 fFiECM8oeWdlTlBrgU4LeTaYUFBnvrJN9hsQWjDOVzk5gaHUw9K0ust05cvPTSKksJaX GWqQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b5si6912403plz.341.2021.09.30.23.04.07; Thu, 30 Sep 2021 23:04:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237032AbhJAF7b (ORCPT + 99 others); Fri, 1 Oct 2021 01:59:31 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:55754 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230494AbhJAF7b (ORCPT ); Fri, 1 Oct 2021 01:59:31 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtp (Exim 4.92 #5 (Debian)) id 1mWBYI-0006Ag-FJ; Fri, 01 Oct 2021 13:57:46 +0800 Received: from herbert by gondobar with local (Exim 4.92) (envelope-from ) id 1mWBYH-0007bI-6I; Fri, 01 Oct 2021 13:57:45 +0800 Date: Fri, 1 Oct 2021 13:57:45 +0800 From: Herbert Xu To: Kai Ye Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, wangzhou1@hisilicon.com Subject: Re: [PATCH v2 2/6] crypto: hisilicon/sec - add ahash alg features for Kunpeng920 Message-ID: <20211001055745.GA31918@gondor.apana.org.au> References: <20210924092716.12848-1-yekai13@huawei.com> <20210924092716.12848-3-yekai13@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210924092716.12848-3-yekai13@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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 Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt