From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795964464; b=4mQlK96vuWMM9g4h2uQhuWLP+ZiQk1ferha3o7H0niqgiuiig0AL9a22YGVaE9hpqpDO VANpDefuXaLIFiwFZ5IqFqaHAXBp96pFWM2Uf6jfeOFaxXfkBkF4ebkoMlU2AWqyCaWyE 0+ukFRDspgvfUYnISx6Gh7gfBdZNFGjz17NIbYgl1hQG4GnYrLfYwMXROWCNE78U9dFEv arNme6ls3/7839YWO8TZTbW9OwHG9XoVQj765ixvIqHjStAyvFVdDyqSJu3581GlzLggU XnpHVzk4m6BIZ3URz/zM9DhdeZREBb7yvOXdxfQ+gkNYLRrGE+/lAISeFT8JcOqt2Lg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795964464; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=pYHWnwJT1OW7tBBig6wmwBnO0rOR40IPiaf5mMOvKHc=; b=Nhy/jYZVhO3WukWScXFxlSCD3Va9ea90bVih+W/FG5H5Rh4y0G5M8JqxyWwGtupl2k1S CaZrFnRH/pO/D9z8//llkkUiM5iPvP3NpBAfiRSvTkMx6MuYdf1lWAIqgUaKgfUwHZ2td WKO5FwzlG58N8bm+QtQGBTcvR7sQzywD2QMejWvn2G+hFjkK2Ro4DGeOXx8pTJyocgTtC EW5LMIEtDEoFisl4GDTlc2Y8JaJC5Q2iafmkuHyAEExG80JMro36jxw1ZyADPbeA/3F8t mV/StUoh1ze5fvi/rOFqp/Ofneu5znZ6hW/5SZgn1u4O1fY1oKFfgI+u6W8UEirOdEw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WuciLLS0; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56E7C606A32A; Sun, 29 Nov 2026 15:01:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WuciLLS0 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DE611F00897; Sun, 29 Nov 2026 15:01:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795964464; bh=pYHWnwJT1OW7tBBig6wmwBnO0rOR40IPiaf5mMOvKHc=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=WuciLLS08kMZ+VbeMzrZ/7rUl34f5pQIbvReDaprVeKfHd/5wqqtm46EcUgnMoqhA q1MGTa8K18KEQPazf8Xsp3b/bzJSe6OMYYzMCVZPMPI0BlN1435Atkk9FiKEbqpUIg 5eesexKTTDVwcJ6gL410JV6aqLv8RiK/JpEPZSrnbGVIGrQ0FdJciABBXhAkJ3dSAx npxiOQQiQhrnQuuEQxTiTzgSlCq//gaCbU+1l5K8O9puUkVYZqKtuATS9E4zqCWAQm 8nI7tCvGi9gcvouKI5NJvXC9gaJv6pE1gQYn2VJdQR6I/h9FECT7L+uNvjGfhXaowY ZXGflhS7UJqLg== Date: Sun, 29 Nov 2026 16:00:59 +0100 From: Thorsten Blum To: Ryan Prinz Cc: Herbert Xu , "David S . Miller" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4] crypto: atmel-ecc - fix missing ECDH public key validation Message-ID: References: <20261128215039.27155-1-rc4d5a@protonmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261128215039.27155-1-rc4d5a@protonmail.com> v4 fails to apply with the following error: patch fragment without header at line 71: @@ -146,6 +148,20 @@ static int atmel_ecdh_generate_public_key(struct kpp_request *req) More comments below. On Sat, Nov 28, 2026 at 09:51:00PM +0000, Ryan Prinz wrote: > atmel_ecdh_compute_shared_secret() passes the peer's ECDH public point > to the ATECC508A/608A/608B secure element without software validation; > only req->src_len is checked. > > Validate the point in software before it reaches the I2C command, the > same check crypto_ecdh_shared_secret() performs for the generic > "ecdh-nist-p256" implementation: call ecc_is_pubkey_valid_partial() > and reject the request if it fails. > > Fixes: 11105693fa05 ("crypto: atmel-ecc - introduce Microchip / Atmel ECC driver") > Signed-off-by: Ryan Prinz > --- [...] > This has not been tested on hardware. [...] > AI Disclosure: An AI assistant was used to assist with the > analysis and testing. I have verified the vulnerability, the fix, and > the test results myself and take responsibility for this contribution, > per Documentation/process/coding-assistants.rst. The Fixes: tag should be fine, but please drop "I have verified the vulnerability, the fix, and the test results myself". Your notes say it wasn't tested on hardware, and there's no evidence the device accepts a bad key. > --- a/drivers/crypto/atmel-ecc.c > +++ b/drivers/crypto/atmel-ecc.c > @@ -17,8 +17,10 @@ > #include > #include > #include > #include > -#include > -#include > -#include > +#include > +#include > +#include > +#include > +#include > #include "atmel-i2c.h" Sorry, I should have been clearer about the grouping. I'd keep as a group before the other includes, with each group sorted. That also keeps the diff small: +#include #include +#include #include #include > +static int atmel_ecdh_peer_pubkey_valid(const u8 *pubkey_buf) The function name reads like a predicate, but it returns 0 or an errno. atmel_ecdh_validate_peer_pubkey() would be clearer imo. Thanks, Thorsten