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: 10143303 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4376F6034B for ; Wed, 3 Jan 2018 20:32:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 381C429334 for ; Wed, 3 Jan 2018 20:32:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C42629332; Wed, 3 Jan 2018 20:32:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AB8AC29334 for ; Wed, 3 Jan 2018 20:32:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=MUJFmgoExyjwWkA7WUkBosHgwwa9dxThvh1tELroQf4=; b=ihdbbArUCQFfOlSf/FdOtPFHOS owlL9tA5g8+EKvLKHbBCuT4E8vxUt8lbEmAJHj9fK8DoEDsYz4H4KrgAxsmYfOf5/RKfkFDaehJnx hV+oGXSvq1XWYwcZUylO+g7vdcrbK1VyQCi6zybBirSARTFiWMQYUkU/QShTv7N2cKX05mQspuL0Z PT7MI+DimcJpD6JJbqGqP9mu2chLAR+BXxvB2R5VAXLxVa2HkMqugQ26/hyTqqcuhc6Z07L8cmtD7 phpXdPD5geKnCEWuabMHXlgQDFtjm/Gcrnh9awpTJPm14aHaXD2ZY7jUkVsEFZ0o3xGueujTlC1VT O3YqXF2Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eWpi2-0004Od-UQ; Wed, 03 Jan 2018 20:32:22 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eWphQ-0003Pu-2d for linux-arm-kernel@bombadil.infradead.org; Wed, 03 Jan 2018 20:31:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=yuxNFdqyh9fGOBfXt7ecxjJ/90yWX0zeX2nQ3WuQ6Lc=; b=Mxwk5J2Z/A4r/P7rJiYdBZ6kf nLx9HWbeOsHw8P95mgCM/6qZr5gRCPYeeoOJGd53XfARAB8LgHASk40sbZK06q2aWXnPSeEgxgDpN 04h/YxIW7LGlfRIyAwKQBR1hsZkAZGowD3FoPqqsMiIMPbF1NixSPbYjMPeew5ET9DR3go1cFVe5h esCqxU5ujbTCr6WDiSiAeJ1mUkqGsBKQIZrk3VlDkJ1OYmORq7SU2xaCUlAHrTVvEoZ9f726+v4TJ yMSL9J2GZ5svvOM2hepO0wkBIwmHzyKvMBno46XPq1YYHGSFLlZe5SvPiqwbKiNpBZaSGfFqyn352 TLUFqbj8Q==; Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eWpPs-0004ZE-ER for linux-arm-kernel@lists.infradead.org; Wed, 03 Jan 2018 20:13:39 +0000 Received: by mail-wr0-x243.google.com with SMTP id o15so2834485wrf.12 for ; Wed, 03 Jan 2018 12:13:26 -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=E9zoSdUk2g9cazvi9N76+GdwXGxSyTp618o5gjtr9YbgrI0Pos5bWUJEUv8EpJtGMG TuisUU9PWfAsrSm4WUIFxneBl4AX8rf99YjHxYBdeE34lsWyEXuH/8gj6RFKj6i9YvyK GdBl0IrnFtWBx1vtlDTmrxv++2z2FPtd6LmDcJE338rnFi1sQ20xipQ7yGvBO0nPCH1y /k/6eCTShjDJBFqurf+Em0YhZEMbkGEEv3Na0Y8SqeuS3UqVxBj25bpPpVq0LZqFtirH 7zS335ZxJSmlKbTZT0JIJao/VZdTf6XBwIM3haevgZKkGz4pS97y40/eaC+uj2Y0dAsM +AGQ== X-Gm-Message-State: AKGB3mLhVBjFZIpYbZa/uGaoeNLKKUr+UbMlm7U4Alw0SvdvW7cQIi6X hBc45TP6Th7JY8TwuoOrtnc= X-Google-Smtp-Source: ACJfBovO+aG+2dRxOwKfVQrTHyyioMaJt+9kA7u2PgF/49YoFGPZ+ihzyRsAHQ7aVMYFoAaKw67Y4g== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180103_201336_485090_ED37D44D X-CRM114-Status: GOOD ( 13.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, fabien.dessenne@st.com, virtualization@lists.linux-foundation.org, Corentin Labbe , linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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);