From: Lukas Wunner <lukas@wunner.de>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Kepplinger-Novakovic Martin
<Martin.Kepplinger-Novakovic@ginzinger.com>,
"ebiggers@google.com" <ebiggers@google.com>,
"horia.geanta@nxp.com" <horia.geanta@nxp.com>,
"pankaj.gupta@nxp.com" <pankaj.gupta@nxp.com>,
"gaurav.jain@nxp.com" <gaurav.jain@nxp.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"ignat@cloudflare.com" <ignat@cloudflare.com>,
"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [BUG] crypto: caam - RSA encrypt doesn't always complete new data in out_buf
Date: Sat, 7 Mar 2026 14:31:14 +0100 [thread overview]
Message-ID: <aawoonmcpvx58hL3@wunner.de> (raw)
In-Reply-To: <aau4hTzIYEVKyAT3@gondor.apana.org.au>
On Sat, Mar 07, 2026 at 02:32:53PM +0900, Herbert Xu wrote:
> On Thu, Feb 26, 2026 at 08:17:18AM +0100, Lukas Wunner wrote:
> > That's fine for the RSA software implementation in crypto/rsa.c but
> > I could very well imagine it causes problems with an RSA accelerator,
> > particularly because rsa_edesc_alloc() in drivers/crypto/caam/caampkc.c
> > now maps the same buffer with DMA_TO_DEVICE and then DMA_FROM_DEVICE.
>
> That's definitely not good. It needs to handle in-place encryption
> by using DMA_BIDIRECTIONAL. If the hardware is not capable of that
> then an extra copy must be performed by the driver.
Okay. However in the latest hexdump provided by Martin (on Feb 26),
the data returned from the caam RSA accelerator is byte-swapped.
i.MX6 does seem to be capable of big endian mode, but I guess
peripherals still use little endian and so it would be necessary
to postprocess (i.e. byte-swap) the buffer in caampkc.c if the CPU
is running in big endian mode.
It's unclear to me whether the byte swap issue is the only problem
or whether there's a DMA issue on top. Martin hasn't responded to
my latest e-mail yet and without someone willing to answer questions
or test patches, I can't help any further here as I don't have such a
device myself.
Thanks,
Lukas
prev parent reply other threads:[~2026-03-07 13:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-24 14:17 [BUG] crypto: caam - RSA encrypt doesn't always complete new data in out_buf Kepplinger-Novakovic Martin
2026-02-24 15:04 ` Lukas Wunner
2026-02-24 16:09 ` Kepplinger-Novakovic Martin
2026-02-24 16:41 ` Lukas Wunner
2026-02-25 8:02 ` Kepplinger-Novakovic Martin
2026-02-25 8:13 ` Lukas Wunner
2026-02-25 8:47 ` Kepplinger-Novakovic Martin
2026-02-26 7:17 ` Lukas Wunner
2026-02-26 11:41 ` Kepplinger-Novakovic Martin
2026-02-26 13:27 ` Lukas Wunner
2026-03-10 8:57 ` Kepplinger-Novakovic Martin
2026-03-13 9:18 ` Lukas Wunner
2026-03-17 11:45 ` Kepplinger-Novakovic Martin
2026-03-07 5:32 ` Herbert Xu
2026-03-07 13:31 ` Lukas Wunner [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=aawoonmcpvx58hL3@wunner.de \
--to=lukas@wunner.de \
--cc=Martin.Kepplinger-Novakovic@ginzinger.com \
--cc=davem@davemloft.net \
--cc=ebiggers@google.com \
--cc=gaurav.jain@nxp.com \
--cc=herbert@gondor.apana.org.au \
--cc=horia.geanta@nxp.com \
--cc=ignat@cloudflare.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pankaj.gupta@nxp.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