CVE Database›Document archive›CVE-2025-37984

CVE-2025-37984

kernel: crypto: ecdsa - Harden against integer overflows in DIV_ROUND_UP()

Loading…

Severity

Low

Red Hat Product Security

2.5

CVSS 3.1

Review impact separately from score.

Published · May 20, 2025

Updated · July 30, 2026

Description

In the Linux kernel, the following vulnerability has been resolved:

crypto: ecdsa - Harden against integer overflows in DIV_ROUND_UP()

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().

Statement

A hardening patch was introduced in the Linux kernel ECDSA implementation to mitigate potential integer overflows in size calculations using DIV_ROUND_UP(). The fix replaces it with a safer macro, DIV_ROUND_UP_POW2(), specifically designed for power-of-two divisions and preventing wraparound when key_size() returns large values. This prevents potential memory corruption issues in the ECDSA verification logic.

CVSS score applicability

The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.

Mitigation

No mitigation is specified in collected source.

CVSS / CWE

CVSS 3.1 · 2.5
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L

CWE not specified