From: Thorsten Blum <blum@kernel.org>
To: Ryan Prinz <rc4d5a@protonmail.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
"David S . Miller" <davem@davemloft.net>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] crypto: atmel-ecc - fix missing ECDH public key validation
Date: Sun, 29 Nov 2026 16:00:59 +0100 [thread overview]
Message-ID: <aww-K5pU7QvldhHN@kernel.org> (raw)
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 <rc4d5a@protonmail.com>
> ---
[...]
> 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 <linux/of.h>
> #include <linux/scatterlist.h>
> #include <linux/slab.h>
> #include <linux/workqueue.h>
> -#include <crypto/internal/kpp.h>
> -#include <crypto/ecdh.h>
> -#include <crypto/kpp.h>
> +#include <crypto/ecc_curve.h>
> +#include <crypto/ecdh.h>
> +#include <crypto/internal/ecc.h>
> +#include <crypto/internal/kpp.h>
> +#include <crypto/kpp.h>
> #include "atmel-i2c.h"
Sorry, I should have been clearer about the grouping. I'd keep
<crypto/internal/*> as a group before the other <crypto/*> includes,
with each group sorted. That also keeps the diff small:
+#include <crypto/internal/ecc.h>
#include <crypto/internal/kpp.h>
+#include <crypto/ecc_curve.h>
#include <crypto/ecdh.h>
#include <crypto/kpp.h>
> +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
prev parent reply other threads:[~2026-11-29 15:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 21:51 Ryan Prinz
2026-11-29 15:00 ` Thorsten Blum [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aww-K5pU7QvldhHN@kernel.org \
--to=blum@kernel.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rc4d5a@protonmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®