linux-yocto/include
Lukas Wunner f2133b849f crypto: ecdsa - Harden against integer overflows in DIV_ROUND_UP()
commit b16510a530 upstream.

Herbert notes that DIV_ROUND_UP() may overflow unnecessarily if an ecdsa
implementation's ->key_size() callback returns an unusually large value.
Herbert instead suggests (for a division by 8):

  X / 8 + !!(X & 7)

Based on this formula, introduce a generic DIV_ROUND_UP_POW2() macro and
use it in lieu of DIV_ROUND_UP() for ->key_size() return values.

Additionally, use the macro in ecc_digits_from_bytes(), whose "nbytes"
parameter is a ->key_size() return value in some instances, or a
user-specified ASN.1 length in the case of ecdsa_get_signature_rs().

Link: https://lore.kernel.org/r/Z3iElsILmoSu6FuC@gondor.apana.org.au/
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-07-17 18:37:24 +02:00
..
acpi ACPICA: Avoid sequence overread in call to strncmp() 2025-06-27 11:11:26 +01:00
asm-generic mm: hugetlb: Add huge page size param to huge_ptep_get_and_clear() 2025-03-13 13:02:17 +01:00
clocksource
crypto crypto: ahash - Set default reqsize from ahash_alg 2025-05-29 11:02:40 +02:00
cxl
drm drm/framebuffer: Acquire internal references on GEM handles 2025-07-17 18:37:12 +02:00
dt-bindings
keys
kunit kunit: platform: Resolve 'struct completion' warning 2025-02-21 14:01:25 +01:00
kvm
linux crypto: ecdsa - Harden against integer overflows in DIV_ROUND_UP() 2025-07-17 18:37:24 +02:00
math-emu
media media: v4l: Memset argument to 0 before calling get_mbus_config pad op 2025-05-29 11:02:49 +02:00
memory
misc
net netfilter: flowtable: account for Ethernet header in nf_flow_pppoe_proto() 2025-07-17 18:37:18 +02:00
pcmcia
ras
rdma RDMA/uverbs: Propagate errors from rdma_lookup_get_uobject() 2025-05-29 11:02:19 +02:00
rv rv: Reset per-task monitors also for idle tasks 2025-02-17 10:05:30 +01:00
scsi
soc soc: qcom: ice: introduce devm_of_qcom_ice_get 2025-05-02 07:58:52 +02:00
sound ASoC: soc-acpi: add get_function_tplg_files ops 2025-07-17 18:37:02 +02:00
target
trace erofs: refine readahead tracepoint 2025-07-17 18:37:18 +02:00
uapi vsock/uapi: fix linux/vm_sockets.h userspace compilation errors 2025-07-06 11:01:40 +02:00
ufs scsi: ufs: Introduce quirk to extend PA_HIBERN8TIME for UFS devices 2025-05-29 11:01:58 +02:00
vdso
video
xen xen/mcelog: Add __nonstring annotations for unterminated strings 2025-04-20 10:15:12 +02:00