[PATCH v2 1/7] lib: uuid: add UUID v5 support

Simon Glass sjg at chromium.org
Wed May 29 21:46:37 CEST 2024


Hi Caleb,

On Wed, 29 May 2024 at 12:55, Caleb Connolly <caleb.connolly at linaro.org> wrote:
>
> Hi Simon,
>
> On 29/05/2024 18:30, Simon Glass wrote:
> > Hi Caleb,
> >
> > On Wed, 29 May 2024 at 08:49, Caleb Connolly <caleb.connolly at linaro.org> wrote:
> >>
> >> Add support for generate version 5 UUIDs, these are determistic and work
> >
> > spelling
>
> Thanks
> >
> >> by hashing a "namespace" UUID together with some unique data. One intended
> >> usecase is to allow for dynamically generate payload UUIDs for UEFI
> >> capsule updates, so that supported boards can have their own UUIDs
> >> without needing to hardcode them.
> >>
> >> Signed-off-by: Caleb Connolly <caleb.connolly at linaro.org>
> >> ---
> >>   include/uuid.h | 17 +++++++++++++++++
> >>   lib/Kconfig    |  8 ++++++++
> >>   lib/uuid.c     | 37 +++++++++++++++++++++++++++++++++++++
> >>   3 files changed, 62 insertions(+)
> >>
> >
> > Can you please mention the tests for this? I believe they are in your
> > last commit?
>
> Yeah will do.
> >
> >> diff --git a/include/uuid.h b/include/uuid.h
> >> index f5a941250f48..539affaa47b9 100644
> >> --- a/include/uuid.h
> >> +++ b/include/uuid.h
> >> @@ -10,8 +10,9 @@
> >>   #ifndef __UUID_H__
> >>   #define __UUID_H__
> >>
> >>   #include <linux/bitops.h>
> >> +#include <linux/kconfig.h>
> >>
> >>   /*
> >>    * UUID - Universally Unique IDentifier - 128 bits unique number.
> >>    *        There are 5 versions and one variant of UUID defined by RFC4122
> >> @@ -142,8 +143,24 @@ void gen_rand_uuid(unsigned char *uuid_bin);
> >>    * @param          - uuid output type: UUID - 0, GUID - 1
> >>    */
> >>   void gen_rand_uuid_str(char *uuid_str, int str_format);
> >>
> >> +#if IS_ENABLED(CONFIG_UUID_GEN_V5)
> >> +/**
> >> + * gen_uuid_v5() - generate UUID v5 from namespace and other seed data.
> >> + *
> >> + * @namespace:   pointer to UUID namespace salt
> >> + * @uuid:        pointer to allocated UUID output
> >> + * @...:         NULL terminated list of seed data as pairs of pointers
> >> + *               to data and their lengths
> >> + */
> >> +void gen_uuid_v5(const struct uuid *namespace, struct uuid *uuid, ...);
> >> +#else
> >> +static inline void gen_uuid_v5(const struct uuid *namespace, struct uuid *uuid, ...)
> >> +{
> >> +}
> >> +#endif
> >> +
> [...]
> >> +#if IS_ENABLED(CONFIG_UUID_GEN_V5)
> >> +void gen_uuid_v5(const struct uuid *namespace, struct uuid *uuid, ...)
> >
> > Is this in a header file somewhere? It needs a function comment there.
>
> Yes, see directly above where I add it to include/uuid.h

OK thanks. We are using a different format now - the old @param stuff
is in the past :-)

Regards,
Simon


More information about the U-Boot mailing list