lib: uuid: add UUID v5 support

Add support for generating version 5 UUIDs, these are determistic and work
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.

In addition, move the common bit twiddling code from gen_ran_uuid into a
separate function and rewrite it not to use clrsetbits (which is not
available when building as part of host tools).

Tests for this are added in an upcoming patch.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
This commit is contained in:
Caleb Connolly
2024-08-30 13:34:32 +01:00
committed by Heinrich Schuchardt
parent 3cc3bc08f4
commit 4c5e1ff31b
3 changed files with 68 additions and 9 deletions

View File

@@ -73,6 +73,7 @@ config HAVE_PRIVATE_LIBGCC
config LIB_UUID
bool
select SHA1
config RANDOM_UUID
bool "GPT Random UUID generation"