mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fabien DESSENNE <fabien.dessenne@st.com>
To: Corentin Labbe <clabbe.montjoie@gmail.com>,
	"herbert@gondor.apana.org.au" <herbert@gondor.apana.org.au>,
	Alexandre TORGUE <alexandre.torgue@st.com>,
	"arei.gonglei@huawei.com" <arei.gonglei@huawei.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"jasowang@redhat.com" <jasowang@redhat.com>,
	"mcoquelin.stm32@gmail.com" <mcoquelin.stm32@gmail.com>,
	"mst@redhat.com" <mst@redhat.com>,
	Lionel DEBIEVE <lionel.debieve@st.com>
Cc: "linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"virtualization@lists.linux-foundation.org" 
	<virtualization@lists.linux-foundation.org>
Subject: Re: [PATCH RFC 4/4] crypto: stm32: convert to the new crypto engine API
Date: Wed, 6 Dec 2017 11:03:23 +0000	[thread overview]
Message-ID: <5835a2df-64d2-1363-15a3-eec4db955d58@st.com> (raw)
In-Reply-To: <20171129084121.9385-5-clabbe.montjoie@gmail.com>

Hi,


On 29/11/17 09:41, Corentin Labbe wrote:
> This patch convert the driver to the new crypto engine API.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Tested-by: Fabien Dessenne <fabien.dessenne@st.com>

> ---
>   drivers/crypto/stm32/stm32-hash.c | 22 +++++++++++++++-------
>   1 file changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c
> index 4ca4a264a833..e3f9f7b04ce2 100644
> --- a/drivers/crypto/stm32/stm32-hash.c
> +++ b/drivers/crypto/stm32/stm32-hash.c
> @@ -122,6 +122,7 @@ enum stm32_hash_data_format {
>   #define HASH_DMA_THRESHOLD		50
>   
>   struct stm32_hash_ctx {
> +	struct crypto_engine_reqctx enginectx;
>   	struct stm32_hash_dev	*hdev;
>   	unsigned long		flags;
>   
> @@ -811,7 +812,7 @@ static void stm32_hash_finish_req(struct ahash_request *req, int err)
>   		rctx->flags |= HASH_FLAGS_ERRORS;
>   	}
>   
> -	crypto_finalize_hash_request(hdev->engine, req, err);
> +	crypto_finalize_request(hdev->engine, &req->base, err);
>   }
>   
>   static int stm32_hash_hw_init(struct stm32_hash_dev *hdev,
> @@ -828,15 +829,21 @@ static int stm32_hash_hw_init(struct stm32_hash_dev *hdev,
>   	return 0;
>   }
>   
> +static int stm32_hash_one_request(struct crypto_engine *engine,
> +				  struct crypto_async_request *areq);
> +static int stm32_hash_prepare_req(struct crypto_engine *engine,
> +				  struct crypto_async_request *areq);
> +
>   static int stm32_hash_handle_queue(struct stm32_hash_dev *hdev,
>   				   struct ahash_request *req)
>   {
> -	return crypto_transfer_hash_request_to_engine(hdev->engine, req);
> +	return crypto_transfer_request_to_engine(hdev->engine, &req->base);
>   }
>   
>   static int stm32_hash_prepare_req(struct crypto_engine *engine,
> -				  struct ahash_request *req)
> +				  struct crypto_async_request *areq)
>   {
> +	struct ahash_request *req = ahash_request_cast(areq);
>   	struct stm32_hash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(req));
>   	struct stm32_hash_dev *hdev = stm32_hash_find_dev(ctx);
>   	struct stm32_hash_request_ctx *rctx;
> @@ -855,8 +862,9 @@ static int stm32_hash_prepare_req(struct crypto_engine *engine,
>   }
>   
>   static int stm32_hash_one_request(struct crypto_engine *engine,
> -				  struct ahash_request *req)
> +				  struct crypto_async_request *areq)
>   {
> +	struct ahash_request *req = ahash_request_cast(areq);
>   	struct stm32_hash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(req));
>   	struct stm32_hash_dev *hdev = stm32_hash_find_dev(ctx);
>   	struct stm32_hash_request_ctx *rctx;
> @@ -1033,6 +1041,9 @@ static int stm32_hash_cra_init_algs(struct crypto_tfm *tfm,
>   	if (algs_hmac_name)
>   		ctx->flags |= HASH_FLAGS_HMAC;
>   
> +	ctx->enginectx.op.do_one_request = stm32_hash_one_request;
> +	ctx->enginectx.op.prepare_request = stm32_hash_prepare_req;
> +	ctx->enginectx.op.unprepare_request = NULL;
>   	return 0;
>   }
>   
> @@ -1493,9 +1504,6 @@ static int stm32_hash_probe(struct platform_device *pdev)
>   		goto err_engine;
>   	}
>   
> -	hdev->engine->prepare_hash_request = stm32_hash_prepare_req;
> -	hdev->engine->hash_one_request = stm32_hash_one_request;
> -
>   	ret = crypto_engine_start(hdev->engine);
>   	if (ret)
>   		goto err_engine_start;

  reply	other threads:[~2017-12-06 11:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-29  8:41 [PATCH RFC 0/4] crypto: engine - Permit to enqueue all async requests Corentin Labbe
2017-11-29  8:41 ` [PATCH RFC 1/4] " Corentin Labbe
2017-12-06 11:02   ` Fabien DESSENNE
2017-12-07  9:24     ` Corentin Labbe
2017-12-22  6:57   ` Herbert Xu
2017-12-22  8:41     ` Corentin Labbe
2017-12-22  9:06       ` Herbert Xu
2017-12-22  9:34         ` Corentin Labbe
2017-11-29  8:41 ` [PATCH RFC 2/4] crypto: omap: convert to new crypto engine API Corentin Labbe
2017-11-29  8:41 ` [PATCH RFC 3/4] crypto: virtio: " Corentin Labbe
2017-11-29  8:41 ` [PATCH RFC 4/4] crypto: stm32: convert to the " Corentin Labbe
2017-12-06 11:03   ` Fabien DESSENNE [this message]
2017-12-06 10:59 ` [PATCH RFC 0/4] crypto: engine - Permit to enqueue all async requests Fabien DESSENNE
2017-12-07  9:37   ` Corentin Labbe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5835a2df-64d2-1363-15a3-eec4db955d58@st.com \
    --to=fabien.dessenne@st.com \
    --cc=alexandre.torgue@st.com \
    --cc=arei.gonglei@huawei.com \
    --cc=clabbe.montjoie@gmail.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=jasowang@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lionel.debieve@st.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome