[PATCH v5 01/15] ecdsa: fix support of secp521r1

Marko Mäkelä marko.makela at iki.fi
Sat May 16 19:09:09 CEST 2026


Hi Philippe, Raymond, all,

Wed, Apr 22, 2026 at 02:32:22PM -0400, Raymond Mao wrote:
>Hi Philippe,
>
>On Tue, Apr 21, 2026 at 5:10 PM Philippe Reynes
><philippe.reynes at softathome.com> wrote:
>>
>> Current implementation of ecdsa only supports key len aligned on
>> 8 bits. But the curve secp521r1 uses a key of 521 bits which is not
>> aligned on 8 bits. In this commit, we update the keys management
>> for ecdsa to support keys that are not aligned on 8 bits.
>>
>> Signed-off-by: Philippe Reynes <philippe.reynes at softathome.com>

[snip]

>> +static void fdt_free_key(struct ecdsa_public_key *key)
>> +{
>> +       if (!key)
>> +               return;
>> +       free((char *)key->x);
>
>It is safer to be:
>if (key->x)
>     free((char *)key->x);
>
>> +       free((char *)key->y);
>
>Ditto.

Sorry, did I understand correctly that you are requesting to add 
redundant checks to prevent invocations of free() on a NULL pointer?

The C standard specifies that free(NULL) has no effect. The
implementation fREe_impl() in common/dlmalloc.c documents this as well.  
I think that we should aim for minimal code size.

With best regards,

	Marko


More information about the U-Boot mailing list