From patchwork Mon Sep 19 15:22:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 76554 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp1016323qgf; Mon, 19 Sep 2016 08:23:37 -0700 (PDT) X-Received: by 10.66.175.38 with SMTP id bx6mr37202205pac.159.1474298617185; Mon, 19 Sep 2016 08:23:37 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id if10si29448562pad.130.2016.09.19.08.23.36; Mon, 19 Sep 2016 08:23:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752077AbcISPXg (ORCPT + 4 others); Mon, 19 Sep 2016 11:23:36 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:41256 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752043AbcISPXe (ORCPT ); Mon, 19 Sep 2016 11:23:34 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id u8JFMwb9026956; Mon, 19 Sep 2016 10:22:58 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id u8JFMvOr002496; Mon, 19 Sep 2016 10:22:57 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.294.0; Mon, 19 Sep 2016 10:22:57 -0500 Received: from gomoku.home (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id u8JFMWdB031441; Mon, 19 Sep 2016 10:22:55 -0500 From: Tero Kristo To: , , , , CC: Subject: [PATCH 7/8] crypto: omap-sham: add support for export/import Date: Mon, 19 Sep 2016 18:22:18 +0300 Message-ID: <1474298539-23897-8-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1474298539-23897-1-git-send-email-t-kristo@ti.com> References: <1474298539-23897-1-git-send-email-t-kristo@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Now that the driver has been converted to use scatterlists for data handling, add proper implementation for the export/import stubs also. Signed-off-by: Tero Kristo --- drivers/crypto/omap-sham.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index 412559e..8eefd79 100644 --- a/drivers/crypto/omap-sham.c +++ b/drivers/crypto/omap-sham.c @@ -1418,12 +1418,21 @@ static void omap_sham_cra_exit(struct crypto_tfm *tfm) static int omap_sham_export(struct ahash_request *req, void *out) { - return -ENOTSUPP; + struct omap_sham_reqctx *rctx = ahash_request_ctx(req); + + memcpy(out, rctx, sizeof(*rctx) + rctx->bufcnt); + + return 0; } static int omap_sham_import(struct ahash_request *req, const void *in) { - return -ENOTSUPP; + struct omap_sham_reqctx *rctx = ahash_request_ctx(req); + const struct omap_sham_reqctx *ctx_in = in; + + memcpy(rctx, in, sizeof(*rctx) + ctx_in->bufcnt); + + return 0; } static struct ahash_alg algs_sha1_md5[] = { @@ -2083,7 +2092,8 @@ static int omap_sham_probe(struct platform_device *pdev) alg = &dd->pdata->algs_info[i].algs_list[j]; alg->export = omap_sham_export; alg->import = omap_sham_import; - alg->halg.statesize = sizeof(struct omap_sham_reqctx); + alg->halg.statesize = sizeof(struct omap_sham_reqctx) + + BUFLEN; err = crypto_register_ahash(alg); if (err) goto err_algs;