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

From: Lukas Wunner
Date: Sun Mar 03 2024 - 13:47:59 EST


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>