From patchwork Wed Jan 3 20:11:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 123338 Delivered-To: patch@linaro.org Received: by 10.80.135.92 with SMTP id 28csp5927025edv; Wed, 3 Jan 2018 12:25:49 -0800 (PST) X-Google-Smtp-Source: ACJfBou8hnMmaA0ljScCFNdg3LEiYhy7Ax6rexaHQOP+w+D+nB8YhieDWSiAaygmlPJcvUh/nkK4 X-Received: by 10.84.168.3 with SMTP id e3mr2432525plb.208.1515011149080; Wed, 03 Jan 2018 12:25:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515011149; cv=none; d=google.com; s=arc-20160816; b=iCqOMpgQSLduWKklolviPCOp1U/BHIFPf2hOoww7piYPO5wqNhpolmSmO0W5AY4VYm SK+VD38LULLMMAdQm//r3rsc2p7tP/uSEWNF+RvmVYKIbw8oCAfdjNeXuWLPZx4/yCp6 zQ8IvXVkIv1tGVYxXexe3qbikm8QV6LQ/jqZPCamgqEiTjQZ8iE9E3ly08TQ9edS2072 is3qJO18ohx93KAqoLMKjSIr+2c96cV9ywScBBkYOv0RQEMevyU1zbv5CcIa+9q/TsqZ oPZVDWd+g9ct8rv7muUh3z+giLjykz2RPvWY42EsTcONGZOvPElzTDk5x78OTEWJRCHQ 87fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=yuxNFdqyh9fGOBfXt7ecxjJ/90yWX0zeX2nQ3WuQ6Lc=; b=H4vu+cjHgAFibMZ2APhj5yMRqZxEkarsEdSCZ7dR5UhBwJ3PsvYzjBP4Xjwqh7oyrW FqNwhYDtFRwaXtjiQaUtbjKXmSRrPSQtfP88fnUIFuKfZA186CIWY9xgpRYx45MKj/n7 7F9hBtOPOf8YVQNAZOzatxw20TvEZdW+wuZb8eORpIc9rdQH8o1c4ATm23GmfKG4SgMl C0tV5PTQEqKN2Z5y+Tf/8j9Lr3QMR2cJSlKj3JbOyDxpY26/YKgzV5TS6A6IUvvfLbWp RT8ctWK2pYkcDOK/5/zaP+DFPfKcNBoBCImY9vXvrH4FTUsn0QCTrkK+VufMzdFAnpKh 4zPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=m3BdYLld; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id be1si1151096plb.48.2018.01.03.12.25.48; Wed, 03 Jan 2018 12:25:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=m3BdYLld; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752379AbeACUZq (ORCPT + 28 others); Wed, 3 Jan 2018 15:25:46 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:45851 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752096AbeACUN0 (ORCPT ); Wed, 3 Jan 2018 15:13:26 -0500 Received: by mail-wr0-f194.google.com with SMTP id o15so2834482wrf.12; Wed, 03 Jan 2018 12:13:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yuxNFdqyh9fGOBfXt7ecxjJ/90yWX0zeX2nQ3WuQ6Lc=; b=m3BdYLldQfK/BHxp30G8d50z1sQ8A+0BqTAXBx8XzHZLAr91K8b8rc/0oj/v9pPlmc /zOZHoR7URcYPG9Usq+Q0mlc5jvJM17iRor/TsJaXhk+gMwY1LzonaFpTS+I+tMfYd2l Mmks1e8/Ks9O2Zu98ixqbA/cU6sjRycHHWqM0hcYRPGmCpV4hzSyBgs6cvkAIhH27V/j dplxXtAZ/zJTY0xwEo1vH4cNW+LVOhlCU8CYys/jU/E2ekJwHv+xN6HX0UIwXlWLL0pl tKM9QY0TMefSj4um//Dm2UlRxrcPSwAv0BPydprpt1tUXkGf29ATP4E6CaT6f0eTX28U pCMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yuxNFdqyh9fGOBfXt7ecxjJ/90yWX0zeX2nQ3WuQ6Lc=; b=XIPn+x5tq+USFuKLQd/gavlmAto5GkWCKQUx09h2JJeZIef8LsZSE+sP8oY8IT880b lk/mb5TfgpwHpJd1teZb3rErUcTI7HUHPt0EtZXcEqGTnAZWAuZFI5Z4xAMRM1mnAXZ2 4hXQC3rD7rtnFIO/f+H43TrKOg5LuGlzAnKVuqv4Dz/deyCJMgMcmNYN/88aQEzmIkDu LahK5vZ1hrrRhBMZIJ1oMap9uV1bj+AutsoCLvUXk5TrqFzZraHRJfwRNvWqbHt8hI0b 9PO3VBZIBb8KDkqwvY6ZJSC0oil51LJzFYvJMo88WVeOaWDZ3sTGDScvofUGOSmVE4be AvXA== X-Gm-Message-State: AKGB3mI5uySHkxi/ScbUkaKVcLPpjP/fzLODub+X9AwnCUwrkRTgMVw6 6PHF4iEOnyk8m43BYPqrV6c= X-Received: by 10.223.187.130 with SMTP id q2mr2702770wrg.181.1515010405302; Wed, 03 Jan 2018 12:13:25 -0800 (PST) Received: from Red.local (LFbn-1-6953-20.w90-116.abo.wanadoo.fr. [90.116.134.20]) by smtp.googlemail.com with ESMTPSA id p90sm1800627wmf.3.2018.01.03.12.13.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Jan 2018 12:13:24 -0800 (PST) From: Corentin Labbe To: alexandre.torgue@st.com, arei.gonglei@huawei.com, corbet@lwn.net, davem@davemloft.net, herbert@gondor.apana.org.au, jasowang@redhat.com, mcoquelin.stm32@gmail.com, mst@redhat.com Cc: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, fabien.dessenne@st.com, Corentin Labbe Subject: [PATCH 4/6] crypto: virtio: convert to new crypto engine API Date: Wed, 3 Jan 2018 21:11:07 +0100 Message-Id: <20180103201109.16077-5-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180103201109.16077-1-clabbe.montjoie@gmail.com> References: <20180103201109.16077-1-clabbe.montjoie@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch convert the driver to the new crypto engine API. Signed-off-by: Corentin Labbe --- drivers/crypto/virtio/virtio_crypto_algs.c | 10 +++++++--- drivers/crypto/virtio/virtio_crypto_common.h | 3 +-- drivers/crypto/virtio/virtio_crypto_core.c | 3 --- 3 files changed, 8 insertions(+), 8 deletions(-) -- 2.13.6 diff --git a/drivers/crypto/virtio/virtio_crypto_algs.c b/drivers/crypto/virtio/virtio_crypto_algs.c index abe8c15450df..060824a8ab0a 100644 --- a/drivers/crypto/virtio/virtio_crypto_algs.c +++ b/drivers/crypto/virtio/virtio_crypto_algs.c @@ -29,6 +29,7 @@ struct virtio_crypto_ablkcipher_ctx { + struct crypto_engine_reqctx enginectx; struct virtio_crypto *vcrypto; struct crypto_tfm *tfm; @@ -521,6 +522,9 @@ static int virtio_crypto_ablkcipher_init(struct crypto_tfm *tfm) tfm->crt_ablkcipher.reqsize = sizeof(struct virtio_crypto_sym_request); ctx->tfm = tfm; + ctx->enginectx.op.do_one_request = virtio_crypto_ablkcipher_crypt_req; + ctx->enginectx.op.prepare_request = NULL; + ctx->enginectx.op.unprepare_request = NULL; return 0; } @@ -538,9 +542,9 @@ static void virtio_crypto_ablkcipher_exit(struct crypto_tfm *tfm) } int virtio_crypto_ablkcipher_crypt_req( - struct crypto_engine *engine, - struct ablkcipher_request *req) + struct crypto_engine *engine, void *vreq) { + struct ablkcipher_request *req = container_of(vreq, struct ablkcipher_request, base); struct virtio_crypto_sym_request *vc_sym_req = ablkcipher_request_ctx(req); struct virtio_crypto_request *vc_req = &vc_sym_req->base; @@ -562,7 +566,7 @@ static void virtio_crypto_ablkcipher_finalize_req( int err) { crypto_finalize_cipher_request(vc_sym_req->base.dataq->engine, - req, err); + req, err); kzfree(vc_sym_req->iv); virtcrypto_clear_request(&vc_sym_req->base); } diff --git a/drivers/crypto/virtio/virtio_crypto_common.h b/drivers/crypto/virtio/virtio_crypto_common.h index e976539a05d9..72621bd67211 100644 --- a/drivers/crypto/virtio/virtio_crypto_common.h +++ b/drivers/crypto/virtio/virtio_crypto_common.h @@ -107,8 +107,7 @@ struct virtio_crypto *virtcrypto_get_dev_node(int node); int virtcrypto_dev_start(struct virtio_crypto *vcrypto); void virtcrypto_dev_stop(struct virtio_crypto *vcrypto); int virtio_crypto_ablkcipher_crypt_req( - struct crypto_engine *engine, - struct ablkcipher_request *req); + struct crypto_engine *engine, void *vreq); void virtcrypto_clear_request(struct virtio_crypto_request *vc_req); diff --git a/drivers/crypto/virtio/virtio_crypto_core.c b/drivers/crypto/virtio/virtio_crypto_core.c index ff1410a32c2b..83326986c113 100644 --- a/drivers/crypto/virtio/virtio_crypto_core.c +++ b/drivers/crypto/virtio/virtio_crypto_core.c @@ -111,9 +111,6 @@ static int virtcrypto_find_vqs(struct virtio_crypto *vi) ret = -ENOMEM; goto err_engine; } - - vi->data_vq[i].engine->cipher_one_request = - virtio_crypto_ablkcipher_crypt_req; } kfree(names);