All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Stephan Müller" <smueller@chronox.de>
To: Harsh Jain <harshjain.prof@gmail.com>
Cc: linux-crypto@vger.kernel.org, Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: BUG: Seems un-initialed dst pointer received from algif_aead when outlen is zero
Date: Tue, 21 Mar 2017 16:00:04 +0100	[thread overview]
Message-ID: <1593289.epxWzXFfWH@positron.chronox.de> (raw)
In-Reply-To: <CAFXBA==5EOXOJV4UFaG+1AxAmuEo9PzFKsHe25YTMa8LGfKkkQ@mail.gmail.com>

Am Dienstag, 21. März 2017, 14:23:31 CET schrieb Harsh Jain:

Hi Harsh,

> Yes, Driver can figure out when to discard dst SGL but for that Driver
> has to put checks before accessing dst SGL. Isn't better if AF_ALG
> sends NULL for dst SGL.

With the code in [1], the first longer patch is planned to be merged after the 
memory management changes are agreed upon. That patch contains:

+               /* chain the areq TX SGL holding the tag with RX SGL */
+               if (!last_rsgl) {
+                       /* no RX SGL present (e.g. only authentication) */
+                       sg_init_table(areq->first_rsgl.sgl.sg, 2);
+                       sg_chain(areq->first_rsgl.sgl.sg, 2, areq->tsgl);
+               } else {
+                       /* RX SGL present */
+                       struct af_alg_sgl *sgl_prev = &last_rsgl->sgl;
+
+                       sg_unmark_end(sgl_prev->sg + sgl_prev->npages - 1);
+                       sg_chain(sgl_prev->sg, sgl_prev->npages + 1, areq-
>tsgl);
+               }


This code snipped would exactly do what you want: the SGL is always 
initialized. Besides, the code will do an in-place cipher operation.

https://www.spinics.net/lists/linux-crypto/msg24343.html

Ciao
Stephan

  reply	other threads:[~2017-03-21 15:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-21  6:13 BUG: Seems un-initialed dst pointer received from algif_aead when outlen is zero Harsh Jain
2017-03-21 10:04 ` Stephan Müller
2017-03-21 10:59   ` Harsh Jain
2017-03-21 11:17     ` Harsh Jain
2017-03-21 11:43     ` Stephan Müller
2017-03-21 13:23       ` Harsh Jain
2017-03-21 15:00         ` Stephan Müller [this message]
2017-03-22  2:57           ` 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=1593289.epxWzXFfWH@positron.chronox.de \
    --to=smueller@chronox.de \
    --cc=harshjain.prof@gmail.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.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 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.