summaryrefslogtreecommitdiff
path: root/include/linux/platform_data
diff options
context:
space:
mode:
authorJérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>2026-10-08 09:35:53 +0000
committerHerbert Xu <herbert@gondor.apana.org.au>2026-11-04 13:46:50 +0800
commit828c3b265b6df877dced3dde56ea41daa2e6181e (patch)
tree945145eeae530677179862f0960a8325a1d3826f /include/linux/platform_data
parent6628e7d4c6b25c8d18f1345e3a20d21829aae7e4 (diff)
crypto: caam - reject overlong RSA CRT parameters
caam_read_rsa_crt() right-aligns dP, dQ, and qInv in buffers sized from the corresponding prime. rsa_parse_priv_key() only bounds these integers against n, so a malformed key can provide, for example, a two-byte dP with a one-byte p. dstlen - nbytes then underflows and memcpy() writes outside the allocation during set_priv_key(). KASAN reports a slab-out-of-bounds write in caam_read_rsa_crt(). Reject empty or overlong CRT parameters after stripping leading zeros. qInv is consumed by CAAM as a p-sized value, so size it from p rather than q to match the DMA mapping in set_rsa_priv_f3_pdb(). Let the top-level key cleanup handle partial form-3 allocations and return the specific error to the caller. Also test nbytes before dereferencing it while stripping zeros, so an all-zero integer does not read one byte beyond its input. Fixes: 4a651b122adb ("crypto: caam - add support for RSA key form 3") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr> Reviewed-by: Sahil Malhotra <sahil.malhotra@nxp.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/linux/platform_data')
0 files changed, 0 insertions, 0 deletions