From: Daniel Axtens <dja@axtens.net>
To: "Ondrej Mosnáček" <omosnacek@gmail.com>,
linux-crypto@vger.kernel.org,
"Herbert Xu" <herbert@gondor.apana.org.au>
Cc: marcelo.cerri@canonical.com,
Stephan Mueller <smueller@chronox.de>,
leo.barbosa@canonical.com, linuxppc-dev@lists.ozlabs.org,
Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com>
Subject: Re: BUG: p8_aes_ctr randomly returns wrong results
Date: Fri, 15 Mar 2019 12:26:59 +1100 [thread overview]
Message-ID: <878sxhsza4.fsf@dja-thinkpad.axtens.net> (raw)
In-Reply-To: <CAAUqJDtsx6Sdv=6xAb1VWWjDF08y8wh2nsAypR8_x_e99a1Uwg@mail.gmail.com>
Hi Ondrej,
> When I run 'rmmod vmx_crypto' before running the reproducer, I get
> only one (correct) checksum, so this is definitely a bug in the
> driver. Other ciphers (cbc(aes), xts(aes)) are not affected, even
> though the glue code is very similar. That leads me to believe the
> problem is somewhere in the assembly code.
It appears that under certain circumstances, aes_p8_ctr32_encrypt_blocks
changes walk.iv. If this is done when
while ((nbytes = walk.nbytes) >= AES_BLOCK_SIZE) {
is not in its final iteration, it will corrupt the future blocks.
I am not yet sure why this is. Clearly it's pretty late in the assembly
because it doesn't seem to affect the blocks being processed in that
call, only future calls.
Saving and restoring the IV makes the test case pass.
I'll have a look at the asm.
Regards,
Daniel
>
> [1] http://github.com/smuellerDD/libkcapi
>
> Cheers,
> Ondrej
prev parent reply other threads:[~2019-03-15 1:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-13 12:37 BUG: p8_aes_ctr randomly returns wrong results Ondrej Mosnáček
2019-03-13 12:48 ` Ondrej Mosnáček
2019-03-14 0:53 ` Daniel Axtens
2019-03-15 1:26 ` Daniel Axtens [this message]
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=878sxhsza4.fsf@dja-thinkpad.axtens.net \
--to=dja@axtens.net \
--cc=herbert@gondor.apana.org.au \
--cc=leo.barbosa@canonical.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=marcelo.cerri@canonical.com \
--cc=omosnacek@gmail.com \
--cc=pfsmorigo@linux.vnet.ibm.com \
--cc=smueller@chronox.de \
/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