From: Tadeusz Struk <tadeusz.struk@intel.com>
To: Stephan Mueller <smueller@chronox.de>
Cc: herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: af_alg - add async support to algif_aead
Date: Thu, 28 Jan 2016 09:30:10 -0800 [thread overview]
Message-ID: <56AA5022.6000605@intel.com> (raw)
In-Reply-To: <3065480.xA9mO0V5SY@tauon.atsec.com>
On 01/28/2016 09:09 AM, Stephan Mueller wrote:
> Am Donnerstag, 28. Januar 2016, 08:00:25 schrieb Tadeusz Struk:
>
> Hi Tadeusz,
>
>> Hi Stephan,
>>
>> On 01/27/2016 10:26 PM, Stephan Mueller wrote:
>>>> + for (i = 0; i < areq->tsgls; i++)
>>>>
>>>>> + put_page(sg_page(sg + i));
>>>
>>> Shouldn't here be the same logic as in put_sgl? I.e.
>>>
>>> for (i = 0; i < sgl->cur; i++) {
>>>
>>> if (!sg_page(sg + i))
>>>
>>> continue;
>>>
>>> put_page(sg_page(sg + i));
>>> sg_assign_page(sg + i, NULL);
>>>
>>> }
>>
>> Thanks for reviewing.
>> I don't think it is possible that there ever will be any gaps in the tsgl.
>> In fact if there is such a possibility then it is a serious problem, because
>> it would mean that we are sending NULL ptrs to the ciphers (see line 640):
>>
>> sg_mark_end(sgl->sg + sgl->cur - 1);
>> aead_request_set_crypt(&ctx->aead_req, sgl->sg, ctx-
>> first_rsgl.sgl.sg,
>> used, ctx->iv);
>>
>> I don't see any implementation checking for null in sgls. Most of them just
>> do:
>>
>> for_each_sg(sgl, sg, nents, i)
>> sg_virt(sg)...
>>
>> So it would Oops there. I think this check in put_sgl is redundant.
>> Thanks,
>
> algif_skcipher does a similar check in skcipher_pull_sgl:
>
> ...
> if (!sg_page(sg + i))
> continue;
> ...
> if (put)
> put_page(sg_page(sg + i));
> sg_assign_page(sg + i, NULL);
> ...
>
Yes, that's true, but this is because if you look at the skcipher_recvmsg_async()
function, it invokes crypt operation for each recv segment separately, and after each
iteration advances the tsgl forward and marks the sgs that are already processed with NULL.
This is completely different to the aead use case, which always sends everything
in one go.
Thanks,
--
TS
next prev parent reply other threads:[~2016-01-28 17:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-27 22:10 [PATCH] crypto: af_alg - add async support to algif_aead Tadeusz Struk
2016-01-27 22:29 ` kbuild test robot
2016-01-27 22:41 ` Tadeusz Struk
2016-01-28 8:48 ` [kbuild-all] " Fengguang Wu
2016-01-28 6:26 ` Stephan Mueller
2016-01-28 16:00 ` Tadeusz Struk
2016-01-28 17:09 ` Stephan Mueller
2016-01-28 17:30 ` Tadeusz Struk [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-01-15 19:21 Tadeusz Struk
2016-01-17 15:07 ` Stephan Mueller
2016-01-18 15:22 ` Tadeusz Struk
2016-01-19 0:34 ` Herbert Xu
2016-01-19 15:18 ` Tadeusz Struk
2016-01-20 20:18 ` Tadeusz Struk
2016-01-21 5:00 ` Herbert Xu
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=56AA5022.6000605@intel.com \
--to=tadeusz.struk@intel.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=smueller@chronox.de \
/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;
as well as URLs for NNTP newsgroup(s).