Re: [PATCH v3] crypto: rsassa-pkcs1 - Align DMA buffer to CRYPTO_DMA_ALIGN

From: Herbert Xu

Date: Wed Jul 29 2026 - 19:38:01 EST


On Wed, Jul 29, 2026 at 09:26:09PM +0200, Lukas Wunner wrote:
>
> That crypto_akcipher_alignmask() doesn't exist yet, but can
> easily be copy-pasted from crypto_skcipher_alignmask()
> except it invokes crypto_akcipher_tfm() instead of
> crypto_skcipher_tfm().

I don't think we should create crypto_akcipher_alignmask. In fact
alignmask is being phased out everywhere else too.

The general rule is for the driver to ensure that the data is
aligned, possibly by copying if necessary.

Even when alignmask is used it's still the driver's responsibility
to copy the data when it isn't aligned.

So the bug isn't really in rsa but it's the fault of the underlying
driver if it didn't check alignment before supplying the buffer
to the hardware.

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