Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80DC4262FC4 for ; Tue, 20 May 2025 17:09:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747760970; cv=none; b=KrJhadDQ60JEj57q86EeOKg4TbCplJHawB3wDMkap7aIv/LYbeMcD6EVMKsco52ncnnJm98us1Xufe3QUtn/ab+KkXeJgGo/MNW5DYyTR7k/DB72ciZMcW7VSYiH0EDqWHxwIcq7nqklPK8ItbowbPrmp3RMjdRCqmlw9ooix4M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747760970; c=relaxed/simple; bh=9ydcxVIL6dlPN+Qtc4zGsVK8ueJ/0dD4MERPCv4bATY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qEOvncjqcM+wGdQ8IoCX9YFRe64NpQACtcuoxJkLGxQSHrykmo1Q1XjlAr5yhoy93lW7QR471XXRCz9W34odOdxLsgu0k8XMgqiyPm/gjOVpkEXzjO9g9zUw+kR5NfbnW3LDh2WfoaS//dHaSGoSWlP/pT0N2Q3jCffX0u6iWQs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=AXgCiCrZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="AXgCiCrZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E74EC4CEE9; Tue, 20 May 2025 17:09:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1747760970; bh=9ydcxVIL6dlPN+Qtc4zGsVK8ueJ/0dD4MERPCv4bATY=; h=From:To:Cc:Subject:Date:Reply-to:From; b=AXgCiCrZB4+uLzadkaDhkOeSaz/X2oIhlv4JA3dPfDpijGXti8th0pwaU3ZJzeY1Z qzEV/MQEldWlAff1dkhl0oFZ2gUHkWEtbLXMHuwXhavrXDLw4K4EhBufiZFwIYT1um hk1jIhlUMDrOwdwyXuf8DmVTBqIvw94GCYSS9S0s= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-37984: crypto: ecdsa - Harden against integer overflows in DIV_ROUND_UP() Date: Tue, 20 May 2025 19:07:37 +0200 Message-ID: <2025052037-CVE-2025-37984-be4c@gregkh> X-Mailer: git-send-email 2.49.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=2240; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Pwx3bp52N4kGUm80KU/qTkfQWA5uwghhHj1fMGhXBsA=; b=owGbwMvMwCRo6H6F97bub03G02pJDBk6224yZ/+8fDr6sVels9Ak5d3fJgQUMD3ndZzRsqjou Csf42uzjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZjIVH2GBYvOhhzjDI4o2n8m iHkOn5DPvVWM3Qzz06Y5T5z8TTPOm29hhZzHNU6bYk4NAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman 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(). The Linux kernel CVE team has assigned CVE-2025-37984 to this issue. Affected and fixed versions =========================== Fixed in 6.14.5 with commit 921b8167f10708e38080f84e195cdc68a7a561f1 Fixed in 6.15-rc1 with commit b16510a530d1e6ab9683f04f8fb34f2e0f538275 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2025-37984 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: crypto/ecc.c crypto/ecdsa-p1363.c crypto/ecdsa-x962.c include/linux/math.h Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/921b8167f10708e38080f84e195cdc68a7a561f1 https://git.kernel.org/stable/c/b16510a530d1e6ab9683f04f8fb34f2e0f538275