Skip to content

crypto: caam - Fix RSA error-path unmap and unaligned dst buffers

Changwei Zou linux-crypto lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 1 replyIn review
  2. v22 patches 5 repliesSuperseded
  3. v12 patches 4 repliesSuperseded

Changes in v3 from the cover letter

- Patch 1: Dispatch the error-path unmap on the operation (the completion callback rsa_pub_done vs rsa_priv_f_done) instead of key->d, so the unmap always matches the map.
- Patch 2: Bound the bounce-buffer copy-back to the RSA output size (key->n_sz) instead of the full dst_len, so the trailing capacity of the caller's destination buffer is left untouched; add Tested-by from Stephane Debusne.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2crypto: caam - Fix wrong unmap operationsdrivers/crypto/caam/caampkc.c+31 -120 replies
2/2crypto: caam - Use bounce buffer for unaligned RSA destination buffersdrivers/crypto/caam/caampkc.c drivers/crypto/caam/caampkc.h+92 -11 reply

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchSahil MalhotraMartin Kepplinger-NovakovicStephane Debusne
1/2R-b
2/2T-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/2] crypto: caam - Fix RSA error-path unmap and unaligned dst buffers

This series fixes two issues in the rsa-caam driver.

Patch 1 fixes wrong unmap operations where rsa_pub_unmap() was called regardless of the key type.

Patch 2 adds a bounce buffer to handle unaligned RSA destination buffers on DMA-incoherent hardware such as i.MX8, fixing intermittent -EKEYREJECTED errors when loading signed kernel modules.

Changes in v3:
- Patch 1: Dispatch the error-path unmap on the operation (the completion callback rsa_pub_done vs rsa_priv_f_done) instead of key->d, so the unmap always matches the map.
- Patch 2: Bound the bounce-buffer copy-back to the RSA output size (key->n_sz) instead of the full dst_len, so the trailing capacity of the caller's destination buffer is left untouched; add Tested-by from Stephane Debusne.

Changes in v2:
- Patch 1: Add Fixes: tag; pick up Reviewed-by from Sahil Malhotra.
- Patch 2: Move the !bounce_buf check out of do_rsa_bounce_buf() into the caller rsa_bounce_buf_done() so the helper is only entered when a bounce buffer actually exists; add Reported-by/Closes and Tested-by from Martin Kepplinger-Novakovic.

Link to v2:
https://lore.kernel.org/linux-crypto/[email protected]/

Link to v1:
https://lore.kernel.org/linux-crypto/[email protected]/

Changwei Zou (2):
crypto: caam - Fix wrong unmap operations
crypto: caam - Use bounce buffer for unaligned RSA destination buffers

 drivers/crypto/caam/caampkc.c | 130 ++++++++++++++++++++++++++++++----
 drivers/crypto/caam/caampkc.h |   6 ++
 2 files changed, 123 insertions(+), 13 deletions(-)
Signature · 1 line
2.43.0