Re: [PATCH v4 11/12] crypto: asymmetric_keys - Adjust signature size calculation for NIST P521

From: Stefan Berger
Date: Sun Mar 03 2024 - 16:03:23 EST




On 3/3/24 13:47, Lukas Wunner wrote:
On Thu, Feb 29, 2024 at 09:20:06PM -0500, Stefan Berger wrote:
Adjust the calculation of the maximum signature size for support of
NIST P521. While existing curves may prepend a 0 byte to their coordinates
(to make the number positive), NIST P521 will not do this since only the
first bit in the most significant byte is used.

If the encoding of the x & y coordinates requires more than 128 bytes then
an additional byte is needed for the encoding of the length. Take this into
account when calculating the maximum signature size.

Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxx>

Reviewed-by: Lukas Wunner <lukas@xxxxxxxxx>

Thanks. I have to adjust the commit text and comment in the patch, though. It should be '... requires at least 128 bytes then ...'