Received: by 10.223.176.46 with SMTP id f43csp1069001wra; Fri, 26 Jan 2018 11:19:17 -0800 (PST) X-Google-Smtp-Source: AH8x2257E9yBRhH2X2P0g97mL2gckspTXd2hPOzB8AGoOjLlakMeZRy03GhI2CpJgBakpDrHSX2o X-Received: by 10.98.107.71 with SMTP id g68mr19692525pfc.96.1516994357151; Fri, 26 Jan 2018 11:19:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516994357; cv=none; d=google.com; s=arc-20160816; b=elM41AGhx63pBHtjjuHcAEzj9El1KmJkAbkvYjzkJcUpoSSCN78gNV3Akefem4DYW9 hvEDbOIHFRdph0vOlb2d8scshgLm7sThFiwAb7mJVorUz0IKnwedKoDt2op/nP33pkzE VLaq/DlJiboRmARRkXrEYRuWxtnI93DzINWMTTwjShryX/Z8tcHMSpYYf9OYSjRA5iiQ YZDrwVneA0lKMII+dp4Xbrt8XKoj7XW6u2WokWCohQVWNrTclFC1sB5I+SiC/fa2+qD8 Kv8KIDn+b9ltaFcTk+oC53b9oZm8zo599d7CtZSST29N8KN3thB8Icyqw/+NkdMwCCo8 gD1g== 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=52lE6G9FOb5vAshbK08DnSQT44vi95s6IvjigHuUZKs=; b=wSDA5/Nj5hsXqJ/j1/cTE5rI0rvtTikUXnUEbCImWmKu0lvKMvI0d3Oc6/TlI8kvso Kqu4AhdfSofwOwiBSwKQs3O3VwCYcicrEvkRn/e/3/cdQUU+zDwRtzKL8WYRqr7tw8oX rumjmvxfTyBU5ujbU5fchFZwYw6YynoaWgyKo+TTMVIByry0HErAylp0bt0tciYE+90j 4lOrqzzE7IHqVhaAGPo+BtPIQgp/1KyRDOXBrfo5gwkHI14KxPyGHYq7waWmQK+8EXt6 wgpjekCjBiRsECE1UKWKb4EbzSN5SWvydhOrwaHbb2z4y5mDll6HLahFopUMfnOmcU10 xXng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HOYYtD1S; 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 q11si3300957pgc.824.2018.01.26.11.19.02; Fri, 26 Jan 2018 11:19:17 -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=HOYYtD1S; 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 S1752876AbeAZTSQ (ORCPT + 99 others); Fri, 26 Jan 2018 14:18:16 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:39947 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752822AbeAZTSM (ORCPT ); Fri, 26 Jan 2018 14:18:12 -0500 Received: by mail-wr0-f194.google.com with SMTP id i56so1397646wra.7; Fri, 26 Jan 2018 11:18:11 -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=52lE6G9FOb5vAshbK08DnSQT44vi95s6IvjigHuUZKs=; b=HOYYtD1SNw0t7sgORubTdXBfosyw4c35aPMrDmC9cyuNsmEkVLBNEuMD/KpEuNT3E8 +Cexk4nQRnxL7agtbIRDtA1TkRe3XMVzZzMJYxu//E8otJlL2MC6Voa60f673JSaSswv MuVlMA/It0gKg51od01N/oFcG1KdLvNswSf3VpJ25nK0Ey1QS533AxrAQKnOwF89UsrF ZuYtdldNAFgdduS44PFvg2BbXmgiWaTLT35lMAtw7ykAn8snJnD6Wt11vHne4YZ4yI7c FI7WaI6kyPsakL/gmAqordl53L+fQVTjcc9CbcyXYmUFdZfMt++iMWTR0hdJtmpcrjZX RkBw== 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=52lE6G9FOb5vAshbK08DnSQT44vi95s6IvjigHuUZKs=; b=t/N/GHcEf/GsT8Tio1HL8tRrt/fkRHePALXVbVNIemTv13GmeRdEM9sPCXg6D87BTZ rjyDFkOIotWaz7QxlyeUa+UJ52nOPqCIRTaV+V2HwoGV9bAH8XqcQl6l1XqioN5Lj+L/ p4ztr7sPR81iLJ1couXg4y/FUR0XygHxO+dKM5Un0ZMUViOx/Ww7hi4eISZKnbwTeeQG jidxw4i+na4Ro2R5lJmX11aBE3q5nBGso29yLsOOgx/krkXsFIsXayQaCEJ8gBXHFe8Y e7N9S82n//LsZmDIzpLt+tAbUQZVfwCj0Jr+qlkEd7bbdhcbE4xSAAAB3Kp7JHf/uXzA UzmA== X-Gm-Message-State: AKwxytf2Um+J+NyQ2xAsAb9r24nbdEv1cxfWE9Chn4xAoxcr5dAkHfKB N8xSn0K53Pk9UxJe6MNOy94= X-Received: by 10.223.174.236 with SMTP id y99mr11548192wrc.117.1516994290608; Fri, 26 Jan 2018 11:18:10 -0800 (PST) Received: from Red.local (LFbn-MAR-1-494-174.w2-15.abo.wanadoo.fr. [2.15.82.174]) by smtp.googlemail.com with ESMTPSA id k125sm7587510wmd.48.2018.01.26.11.18.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 11:18:10 -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, fabien.dessenne@st.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, linux-sunxi@googlegroups.com, Corentin Labbe Subject: [PATCH v2 4/6] crypto: virtio: convert to new crypto engine API Date: Fri, 26 Jan 2018 20:15:32 +0100 Message-Id: <20180126191534.17569-5-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180126191534.17569-1-clabbe.montjoie@gmail.com> References: <20180126191534.17569-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 | 16 ++++++++++------ drivers/crypto/virtio/virtio_crypto_common.h | 3 +-- drivers/crypto/virtio/virtio_crypto_core.c | 3 --- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/crypto/virtio/virtio_crypto_algs.c b/drivers/crypto/virtio/virtio_crypto_algs.c index abe8c15450df..ba190cfa7aa1 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_ctx enginectx; struct virtio_crypto *vcrypto; struct crypto_tfm *tfm; @@ -491,7 +492,7 @@ static int virtio_crypto_ablkcipher_encrypt(struct ablkcipher_request *req) vc_sym_req->ablkcipher_req = req; vc_sym_req->encrypt = true; - return crypto_transfer_cipher_request_to_engine(data_vq->engine, req); + return crypto_transfer_ablkcipher_request_to_engine(data_vq->engine, req); } static int virtio_crypto_ablkcipher_decrypt(struct ablkcipher_request *req) @@ -511,7 +512,7 @@ static int virtio_crypto_ablkcipher_decrypt(struct ablkcipher_request *req) vc_sym_req->ablkcipher_req = req; vc_sym_req->encrypt = false; - return crypto_transfer_cipher_request_to_engine(data_vq->engine, req); + return crypto_transfer_ablkcipher_request_to_engine(data_vq->engine, req); } static int virtio_crypto_ablkcipher_init(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; @@ -561,8 +565,8 @@ static void virtio_crypto_ablkcipher_finalize_req( struct ablkcipher_request *req, int err) { - crypto_finalize_cipher_request(vc_sym_req->base.dataq->engine, - req, err); + crypto_finalize_ablkcipher_request(vc_sym_req->base.dataq->engine, + 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); -- 2.13.6