All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Tom Lendacky <thomas.lendacky@amd.com>,
	linux-arm-kernel@lists.infradead.org,
	"David S. Miller" <davem@davemloft.net>,
	Fabio Estevam <fabio.estevam@freescale.com>,
	Shawn Guo <shawn.guo@linaro.org>,
	linux-crypto@vger.kernel.org
Subject: Re: [PATCH 1/5] crypto: Fully restore ahash request before completing
Date: Sat, 4 Jan 2014 08:20:09 +0100	[thread overview]
Message-ID: <201401040820.09129.marex@denx.de> (raw)
In-Reply-To: <20140103223344.GA15394@gondor.apana.org.au>

On Friday, January 03, 2014 at 11:33:44 PM, Herbert Xu wrote:
> On Fri, Jan 03, 2014 at 09:10:30AM -0600, Tom Lendacky wrote:
> > On Monday, December 30, 2013 05:01:13 PM Herbert Xu wrote:
> > > On Fri, Dec 27, 2013 at 01:21:36AM +0100, Marek Vasut wrote:
> > > > > > -	complete(data, err);
> > > > > > +	areq->base.complete = complete;
> > > > > > +	areq->base.data = data;
> > > > > > +
> > > > > > +	complete(&areq->base, err);
> > > > > 
> > > > > This looks completely bogus.  While restoring areq isn't wrong per
> > > > > se, calling complete with &areq->base makes no sense.  The original
> > > > > completion data is in the variable "data".
> > > > 
> > > > Is there some documentation for this so I can understand why this is
> > > > wrong, please? I really don't quite get it, sorry. Actually, is
> > > > there some documentation for writing crypto API drivers at all
> > > > please ?
> > > 
> > > Well it's wrong because the completion function (req->base.complete)
> > > is meant to take data (req->base.data) as its first argument.  So
> > > giving it a pointer to req->base makes no sense.
> > 
> > The crypto_completion_t typdef is defined as:
> > 
> > typedef void (*crypto_completion_t)(struct crypto_async_request *req, int
> > err);
> > 
> > so I believe &areq->base is the proper first argument (which is actually
> > just the req parameter on the ahash_op_unaligned_done function).
> 
> You are right.  This unaligned code obviously has never worked.
> I will apply Marek's patch to fix this up.
> 
> > Additionally, you should probably also fix up ahash_def_finup_done2 and
> > ahash_def_finup_done1.
> 
> Yep I'll fix them up too.

I'll try to cook some patches shortly, I will probably also cook some 
documentation for writing drivers using the crypto API, what do you say ?

Best regards,
Marek Vasut

WARNING: multiple messages have this Message-ID (diff)
From: marex@denx.de (Marek Vasut)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] crypto: Fully restore ahash request before completing
Date: Sat, 4 Jan 2014 08:20:09 +0100	[thread overview]
Message-ID: <201401040820.09129.marex@denx.de> (raw)
In-Reply-To: <20140103223344.GA15394@gondor.apana.org.au>

On Friday, January 03, 2014 at 11:33:44 PM, Herbert Xu wrote:
> On Fri, Jan 03, 2014 at 09:10:30AM -0600, Tom Lendacky wrote:
> > On Monday, December 30, 2013 05:01:13 PM Herbert Xu wrote:
> > > On Fri, Dec 27, 2013 at 01:21:36AM +0100, Marek Vasut wrote:
> > > > > > -	complete(data, err);
> > > > > > +	areq->base.complete = complete;
> > > > > > +	areq->base.data = data;
> > > > > > +
> > > > > > +	complete(&areq->base, err);
> > > > > 
> > > > > This looks completely bogus.  While restoring areq isn't wrong per
> > > > > se, calling complete with &areq->base makes no sense.  The original
> > > > > completion data is in the variable "data".
> > > > 
> > > > Is there some documentation for this so I can understand why this is
> > > > wrong, please? I really don't quite get it, sorry. Actually, is
> > > > there some documentation for writing crypto API drivers at all
> > > > please ?
> > > 
> > > Well it's wrong because the completion function (req->base.complete)
> > > is meant to take data (req->base.data) as its first argument.  So
> > > giving it a pointer to req->base makes no sense.
> > 
> > The crypto_completion_t typdef is defined as:
> > 
> > typedef void (*crypto_completion_t)(struct crypto_async_request *req, int
> > err);
> > 
> > so I believe &areq->base is the proper first argument (which is actually
> > just the req parameter on the ahash_op_unaligned_done function).
> 
> You are right.  This unaligned code obviously has never worked.
> I will apply Marek's patch to fix this up.
> 
> > Additionally, you should probably also fix up ahash_def_finup_done2 and
> > ahash_def_finup_done1.
> 
> Yep I'll fix them up too.

I'll try to cook some patches shortly, I will probably also cook some 
documentation for writing drivers using the crypto API, what do you say ?

Best regards,
Marek Vasut

  reply	other threads:[~2014-01-04 10:14 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-10 19:26 [PATCH 1/5] crypto: Fully restore ahash request before completing Marek Vasut
2013-12-10 19:26 ` Marek Vasut
2013-12-10 19:26 ` [PATCH V2 2/5] crypto: mxs: Remove the old DCP driver Marek Vasut
2013-12-10 19:26   ` Marek Vasut
2013-12-10 19:26 ` [PATCH V3 3/5] crypto: mxs: Add Freescale MXS " Marek Vasut
2013-12-10 19:26   ` Marek Vasut
2013-12-10 19:26 ` [PATCH 4/5] ARM: mxs: dts: Enable DCP for MXS Marek Vasut
2013-12-10 19:26   ` Marek Vasut
2013-12-10 19:26 ` [PATCH V2 5/5] crypto: Sort drivers/crypto/Makefile Marek Vasut
2013-12-10 19:26   ` Marek Vasut
2013-12-20 12:04 ` [PATCH 1/5] crypto: Fully restore ahash request before completing Herbert Xu
2013-12-20 12:04   ` Herbert Xu
2013-12-27  0:21   ` Marek Vasut
2013-12-27  0:21     ` Marek Vasut
2013-12-30  9:01     ` Herbert Xu
2013-12-30  9:01       ` Herbert Xu
2014-01-03 15:10       ` Tom Lendacky
2014-01-03 15:10         ` Tom Lendacky
2014-01-03 22:33         ` Herbert Xu
2014-01-03 22:33           ` Herbert Xu
2014-01-04  7:20           ` Marek Vasut [this message]
2014-01-04  7:20             ` Marek Vasut
2014-01-05 13:05 ` Herbert Xu
2014-01-05 13:05   ` Herbert Xu
2014-01-05 15:33   ` Marek Vasut
2014-01-05 15:33     ` Marek Vasut
2014-01-05 23:29     ` Herbert Xu
2014-01-05 23:29       ` Herbert Xu
2014-01-14 17:34       ` Marek Vasut
2014-01-14 17:34         ` Marek Vasut
  -- strict thread matches above, loose matches on Subject: below --
2013-12-01 21:20 Marek Vasut
2013-12-01 21:20 ` Marek Vasut

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=201401040820.09129.marex@denx.de \
    --to=marex@denx.de \
    --cc=davem@davemloft.net \
    --cc=fabio.estevam@freescale.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=shawn.guo@linaro.org \
    --cc=thomas.lendacky@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.