From: Andrey Ryabinin <aryabinin@odin.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>,
<linux-crypto@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] crypto/testmgr: don't copy from source IV too much
Date: Fri, 4 Sep 2015 19:42:26 +0300 [thread overview]
Message-ID: <55E9C9F2.5060402@odin.com> (raw)
In-Reply-To: <20150903132057.GA31317@gondor.apana.org.au>
On 09/03/2015 04:20 PM, Herbert Xu wrote:
> On Thu, Sep 03, 2015 at 02:32:00PM +0300, Andrey Ryabinin wrote:
>> While the destination buffer 'iv' is MAX_IVLEN size,
>> the source 'template[i].iv' could be smaller. Thus
>> copying it via memcpy() leads to invalid memory access.
>> Use strlcpy() instead.
>>
>> Signed-off-by: Andrey Ryabinin <aryabinin@odin.com>
>
> Thanks for the patch. Unfortunately it's broken because the IV
> is not a string and can contain NULs. So either fix it by using
> the real ivsize,
So I've tried to use crypto_ablkcipher_ivsize(tfm) for that.
But noticed that some algs don't set ivsize (which makes it zero).
E.g. "ecb-cast6-avx" doesn't set it, but test vectors (cast6_enc_tv_template[], cast6_dec_tv_template[])
have .iv of 16bytes.
So I'm not sure what part is wrong here.
Is it wrong to use crypto_ablkcipher_ivsize(tfm) to get ivsize here?
Is it bug in 'ecb-cast6-avx'?
Or maybe something else?
> or change template[i].iv to a char array.
>
> Cheers,
>
next prev parent reply other threads:[~2015-09-04 16:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-03 11:32 [PATCH] crypto/testmgr: don't copy from source IV too much Andrey Ryabinin
2015-09-03 11:32 ` [PATCH] x86/crypto/ghash-intel: specify context size for ghash async algorithm Andrey Ryabinin
2015-09-04 15:24 ` Herbert Xu
2015-09-03 13:20 ` [PATCH] crypto/testmgr: don't copy from source IV too much Herbert Xu
2015-09-04 16:42 ` Andrey Ryabinin [this message]
2015-09-05 2:04 ` Herbert Xu
2015-09-10 10:11 ` [PATCH v2] " Andrey Ryabinin
2015-09-11 14:14 ` 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=55E9C9F2.5060402@odin.com \
--to=aryabinin@odin.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@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