All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephan Mueller <smueller@chronox.de>
To: "Ondrej Mosnáček" <omosnacek@gmail.com>
Cc: linux-crypto@vger.kernel.org,
	Herbert Xu <herbert@gondor.apana.org.au>,
	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, 21 Apr 2020 11:19:36 +0200	[thread overview]
Message-ID: <7154254.Uj1dk3xSE7@tauon.chronox.de> (raw)
In-Reply-To: <CAAUqJDvZt7_j+eor1sXRg+QmrdXTjMiymFnji86PoatsYPUugA@mail.gmail.com>

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



  reply	other threads:[~2020-04-21  9:20 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 [this message]
2020-04-28  8:19   ` Stephan Mueller
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=7154254.Uj1dk3xSE7@tauon.chronox.de \
    --to=smueller@chronox.de \
    --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 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.