Re: [PATCH 2/2] crypto: ecc - Fix P-521 scalar multiplication for small scalars

From: Laveesh Bansal

Date: Sun Nov 22 2026 - 22:37:40 EST


On Sat, 14 Nov 2026, Arun Iyengar wrote:
> No caller is affected today: the only P-521 caller,
> ecc_is_pubkey_valid_full(), passes k = n.

Hi Arun,

"No caller is affected" holds for the results, but for k = n
ecc_is_pubkey_valid_full() now runs the ladder on 2n instead of 3n, as
P-192, P-256 and P-384 already do. The ecdsa-nist-p521 self-test covers
that path and still passes. It might be worth a line in the commit
message.

I tested the series on an arm64 QEMU guest (7.4.0-rc1, Herbert's tree at
8ba9044ff0bf, KASAN, lockdep and DEBUG_LIST), calling
ecc_make_pub_key() on P-521 for 76 keys, three times each, and comparing
with OpenSSL. With patch 1 alone every key below 2^522 - 2n (42 of 76)
gives the wrong point. With both patches all 76 match. There are no
KASAN or lockdep reports.

Please consider adding a KUnit test for P-521 key generation. Nothing
covers that path today, and a test would have caught both of these bugs.

Tested-by: Laveesh Bansal <laveeshb@xxxxxxxxxxxxxxxxx>

Thanks,
Laveesh