Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Stephan Mueller <smueller@chronox.de>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: Re: [PATCH 2/11] crypto: scatterwalk - Add missing sg_init_table to scatterwalk_ffwd
Date: Wed, 27 May 2015 13:24:48 +0200	[thread overview]
Message-ID: <12583562.IssoB2EnSZ@tauon> (raw)
In-Reply-To: <20150527090855.GB27692@gondor.apana.org.au>

Am Mittwoch, 27. Mai 2015, 17:08:55 schrieb Herbert Xu:

Hi Herbert,

>On Wed, May 27, 2015 at 11:00:55AM +0200, Stephan Mueller wrote:
>> Shouldn't there be a check for src == NULL here? I see the scatterwalk_ffwd
>> being used in the IV generators where they simply use the AD len and
>> others.
>> For AF_ALG, those values may be set by user space in a deliberately wrong
>> way (e.g. more AD len than provided buffers).
>
>algif_aead should be verifying the user provided input.  AFAICS it
>is doing exactly that.  The crash we had previously were due to
>bugs in my algif_aead patch.

To be precise, the concern I currently have are as follows. But I will test it 
later and report back:

The seqiv.c uses the following call:

                        scatterwalk_ffwd(dstbuf, req->dst,
                                         req->assoclen + ivsize),
                        scatterwalk_ffwd(srcbuf, req->src,
                                         req->assoclen + ivsize),

That together with my other tests for seqniv(rfc4106()) this indicates that 
the input SGL must contain AD || IV || PT.

The algif_aead, however only slurps in AD || PT via the sendmsg call and 
processes that as documented in the recvmsg call. So, the IV part is missing 
in the picture as the IV is set via the setsockopt.

So, the aforementioned call unconditionally advances the SGL by AD + 8 bytes 
where I am not sure that the 8 bytes are always accounted for by algif_aead.


Ciao
Stephan

  reply	other threads:[~2015-05-27 11:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-27  6:35 [PATCH 0/11] crypto: aead - Tweaks/fixes to new AEAD interface Herbert Xu
2015-05-27  6:37 ` [PATCH 1/11] crypto: aead - Document behaviour of AD in destination buffer Herbert Xu
2015-05-27  6:37 ` [PATCH 2/11] crypto: scatterwalk - Add missing sg_init_table to scatterwalk_ffwd Herbert Xu
2015-05-27  9:00   ` Stephan Mueller
2015-05-27  9:08     ` Herbert Xu
2015-05-27 11:24       ` Stephan Mueller [this message]
2015-05-27 12:01         ` Herbert Xu
2015-05-27  6:37 ` [PATCH 3/11] crypto: aead - Preserve in-place processing in old_crypt Herbert Xu
2015-05-27  6:37 ` [PATCH 4/11] crypto: aead - Add common IV generation code Herbert Xu
2015-05-27  6:37 ` [PATCH 5/11] crypto: echainiv - Copy AD along with plain text Herbert Xu
2015-05-27  6:37 ` [PATCH 6/11] crypto: echainiv - Use common IV generation code Herbert Xu
2015-05-27  6:37 ` [PATCH 7/11] crypto: echainiv - Fix IV size in context size calculation Herbert Xu
2015-05-27  6:37 ` [PATCH 8/11] crypto: seqiv - Copy AD along with plain/cipher text Herbert Xu
2015-05-27  6:37 ` [PATCH 9/11] crypto: seqiv - Use common IV generation code Herbert Xu
2015-05-27  6:37 ` [PATCH 10/11] crypto: seqiv - Fix IV size in context size calculation Herbert Xu
2015-05-27  6:37 ` [PATCH 11/11] crypto: seqiv - Fix module unload/reload crash 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=12583562.IssoB2EnSZ@tauon \
    --to=smueller@chronox.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox