From: Stephan Mueller <stephan.mueller@atsec.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "Ondrej Mosnáček" <omosnacek@gmail.com>,
linux-crypto@vger.kernel.org,
"Sahana Prasad" <saprasad@redhat.com>,
"Tomas Mraz" <tmraz@redhat.com>,
"Ard Biesheuvel" <ardb@kernel.org>
Subject: Re: libkcapi tests are failing on kernels 5.5+
Date: Tue, 28 Apr 2020 10:19:19 +0200 [thread overview]
Message-ID: <2055037.HuOjPaZDMi@tauon.chronox.de> (raw)
In-Reply-To: <7154254.Uj1dk3xSE7@tauon.chronox.de>
Am Dienstag, 21. April 2020, 11:19:36 CEST schrieb Stephan Mueller:
Hi Herbert,
could you please help us with the answer to the question below?
> Am Dienstag, 21. April 2020, 10:08:14 CEST schrieb Ondrej Mosnáček:
>
> Hi Ondrej,
>
> > Hi all,
> >
> > the libkcapi [1] tests are failing on kernels 5.5-rc1 and above [2].
> > All encryption/decryption tests that use 'ctr(aes)' and a message size
> > that is not a multiple of 16 fail due to kcapi-enc returning different
> > output than expected.
>
> Confirmed.
>
> On the recent kernels, the data generated by kcapi-enc contains trailing
> zero bytes for data that is a fraction of the block size.
>
> I think the issue is in the following kernel code in _skcipher_recvmsg:
>
> unsigned int bs = crypto_skcipher_chunksize(tfm);
>
> /*
> * If more buffers are to be expected to be processed, process only
> * full block size buffers.
> */
> if (ctx->more || len < ctx->used)
> len -= len % bs;
>
>
> The kernel truncates the size to be processed to the chunk size. As the
> chunksize returns the block size of the underlying cipher (e.g. AES -> 16),
> the kernel code will not process non-aligned data.
>
> Herbert, could you help me identifying what exactly was the root cause for
> the patch 5b0fe9552336338acb52756daf65dd7a4eeca73f ? I.e. it seems that
> stream ciphers made out of a block cipher would not generate the data part
> that is a fraction of the block size (e.g. CTR, CTS).
>
> Ciao
> Stephan
Ciao
Stephan
--
atsec information security GmbH, Steinstraße 70, 81667 München, Germany
Phone: +49 89 442 49 830 - Fax: +49 89 442 49 831
Mobile DE: +49 172 216 55 78 - Mobile US: +1 737 346 1613
HRB: 129439 (Amtsgericht München)
GF: Salvatore la Pietra, Staffan Persson, Manuela Gambarotto
atsec it security news blog - atsec-information-security.blogspot.com
next prev parent reply other threads:[~2020-04-28 8:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-21 8:08 libkcapi tests are failing on kernels 5.5+ Ondrej Mosnáček
2020-04-21 9:19 ` Stephan Mueller
2020-04-28 8:19 ` Stephan Mueller [this message]
2020-05-05 7:58 ` Herbert Xu
2020-05-05 8:05 ` Stephan Mueller
2020-05-05 22:04 ` Stephan Müller
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=2055037.HuOjPaZDMi@tauon.chronox.de \
--to=stephan.mueller@atsec.com \
--cc=ardb@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=omosnacek@gmail.com \
--cc=saprasad@redhat.com \
--cc=tmraz@redhat.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 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).