From: Herbert Xu <herbert@gondor.apana.org.au>
To: Erwin Pawliczek <pawliczekerwin@gmail.com>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
Ignat Korchagin <ignat@linux.win>,
"David S . Miller" <davem@davemloft.net>,
Lukas Wunner <lukas@wunner.de>,
Stefan Berger <stefanb@linux.ibm.com>,
Randy Dunlap <rdunlap@infradead.org>,
Paul Louvel <paul.louvel@bootlin.com>
Subject: Re: [PATCH] crypto: ecc - Randomize the initial Z in ecc_make_pub_key()
Date: Thu, 12 Nov 2026 17:55:05 +0800 [thread overview]
Message-ID: <avWM-fsR_sC11zXB@gondor.apana.org.au> (raw)
In-Reply-To: <20261026034429.742489-1-pawliczekerwin@gmail.com>
On Sun, Oct 25, 2026 at 10:44:29PM -0500, Erwin Pawliczek wrote:
> ecc_make_pub_key() calls ecc_point_mult() without an initial Z, so the
> final Z, and therefore the input to vli_mod_inv(), is a deterministic
> function of the private key. vli_mod_inv() is not constant time, so
> key generation leaks information about the private key through its
> running time.
>
> crypto_ecdh_shared_secret() already passes a random initial Z, which
> blinds the inversion input. Do the same in ecc_make_pub_key().
>
> Key generation is used in the kernel by Bluetooth SMP and TPM2 HMAC
> sessions, which generate ephemeral P-256 keys.
>
> crypto_kpp_generate_public_key(), KVM guest on an i7-1165G7 (median
> over 4 boots of the best of 9 runs of 300 calls):
>
> P-256: 744.9 us -> 753.2 us (+1.1%; within noise)
> P-384: 1674.2 us -> 1651.6 us (-1.4%; within noise)
>
> Suggested-by: Ignat Korchagin <ignat@linux.win>
> Signed-off-by: Erwin Pawliczek <pawliczekerwin@gmail.com>
> ---
> Replaces "crypto: ecc - Use constant-time modular inversion in ecc_point_mult()":
> https://lore.kernel.org/all/20260928042641.307683-1-pawliczekerwin@gmail.com/
>
> crypto/ecc.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
prev parent reply other threads:[~2026-11-12 9:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 4:26 [PATCH] crypto: ecc - Use constant-time modular inversion in ecc_point_mult() Erwin Pawliczek
2026-10-05 3:32 ` Herbert Xu
2026-10-13 10:00 ` Ignat Korchagin
2026-10-13 10:13 ` Ignat Korchagin
2026-10-26 3:44 ` [PATCH] crypto: ecc - Randomize the initial Z in ecc_make_pub_key() Erwin Pawliczek
2026-11-06 18:26 ` Ignat Korchagin
2026-11-12 9:55 ` Herbert Xu [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=avWM-fsR_sC11zXB@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=davem@davemloft.net \
--cc=ignat@linux.win \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=paul.louvel@bootlin.com \
--cc=pawliczekerwin@gmail.com \
--cc=rdunlap@infradead.org \
--cc=stefanb@linux.ibm.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®