]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
crypto: asymmetric_keys - prevent overflow in asymmetric_key_generate_id
authorThorsten Blum <thorsten.blum@linux.dev>
Mon, 13 Oct 2025 11:40:10 +0000 (13:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 12:54:47 +0000 (13:54 +0100)
commitc73be4f51eed98fa0c7c189db8f279e1c86bfbf7
tree1cfef56eed25195a6c98186da657d6894a1fc3e6
parent7e7135c84287250c2d82a031156ab69cbf7660a4
crypto: asymmetric_keys - prevent overflow in asymmetric_key_generate_id

[ Upstream commit df0845cf447ae1556c3440b8b155de0926cbaa56 ]

Use check_add_overflow() to guard against potential integer overflows
when adding the binary blob lengths and the size of an asymmetric_key_id
structure and return ERR_PTR(-EOVERFLOW) accordingly. This prevents a
possible buffer overflow when copying data from potentially malicious
X.509 certificate fields that can be arbitrarily large, such as ASN.1
INTEGER serial numbers, issuer names, etc.

Fixes: 7901c1a8effb ("KEYS: Implement binary asymmetric key ID handling")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
crypto/asymmetric_keys/asymmetric_type.c