Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Tadeusz Struk <tadeusz.struk@intel.com>
Cc: linux-crypto@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 1/3] crypto: skcipher - return the correct request to the user
Date: Thu, 28 Jan 2016 12:53:36 +0800	[thread overview]
Message-ID: <20160128045336.GA7782@gondor.apana.org.au> (raw)
In-Reply-To: <20160127171355.32579.12218.stgit@tstruk-mobl1>

On Wed, Jan 27, 2016 at 09:13:56AM -0800, Tadeusz Struk wrote:
>
> diff --git a/crypto/skcipher.c b/crypto/skcipher.c
> index 69230e9..a9d54c0 100644
> --- a/crypto/skcipher.c
> +++ b/crypto/skcipher.c
> @@ -142,6 +142,15 @@ static int skcipher_setkey_ablkcipher(struct crypto_skcipher *tfm,
>  	return err;
>  }
>  
> +static void skcipher_complete(struct crypto_async_request *req_base, int err)
> +{
> +	void *subreq = ablkcipher_request_cast(req_base);
> +	struct skcipher_request *req =
> +			container_of(subreq, struct skcipher_request, __ctx);
> +
> +	req->base.complete(&req->base, err);
> +}
> +
>  static int skcipher_crypt_ablkcipher(struct skcipher_request *req,
>  				     int (*crypt)(struct ablkcipher_request *))
>  {
> @@ -151,7 +160,7 @@ static int skcipher_crypt_ablkcipher(struct skcipher_request *req,
>  
>  	ablkcipher_request_set_tfm(subreq, *ctx);
>  	ablkcipher_request_set_callback(subreq, skcipher_request_flags(req),
> -					req->base.complete, req->base.data);
> +					skcipher_complete, req->base.data);
>  	ablkcipher_request_set_crypt(subreq, req->src, req->dst, req->cryptlen,
>  				     req->iv);

Rather than playing with lots of casts, just set the ablkcipher
callback data to req and be done with it.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2016-01-28  4:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-27 17:13 [PATCH 0/3] crypto: afalg_skcipher - fixes after skcipher conversion Tadeusz Struk
2016-01-27 17:13 ` [PATCH 1/3] crypto: skcipher - return the correct request to the user Tadeusz Struk
2016-01-28  4:53   ` Herbert Xu [this message]
2016-01-27 17:14 ` [PATCH 2/3] crypto: algif_skcipher - fix async callback after skcipher convertion Tadeusz Struk
2016-01-28  4:56   ` Herbert Xu
2016-01-27 17:14 ` [PATCH 3/3] crypto: algif_skcipher - increase private contex space for async request Tadeusz Struk

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=20160128045336.GA7782@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tadeusz.struk@intel.com \
    /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