[PATCH v5 01/15] ecdsa: fix support of secp521r1
Simon Glass
sjg at chromium.org
Thu May 21 01:04:14 CEST 2026
Hi Marko,
On Sat, 16 May 2026 at 12:09, Marko Mäkelä <marko.makela at iki.fi> wrote:
>
> 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.
Yes, good point. It is a bit strange to make fdt_free_key() handle a
NULL arg though. I'll leave it up to you.
Regards,
Simon
More information about the U-Boot
mailing list