Re: [BUG] crypto: caam - RSA encrypt doesn't always complete new data in out_buf

From: Herbert Xu

Date: Sat Mar 07 2026 - 00:34:15 EST


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.

Thanks,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt