From: Simon Glass <sjg@chromium.org> Normally v5 GUIDs are big-endian, so rename this function. Signed-off-by: Simon Glass <sjg@chromium.org> --- include/u-boot/uuid.h | 4 ++-- lib/efi_loader/efi_firmware.c | 8 ++++---- lib/uuid.c | 2 +- test/lib/uuid.c | 10 ++++------ tools/mkeficapsule.c | 7 +++---- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/include/u-boot/uuid.h b/include/u-boot/uuid.h index 7f8414dc906..124a42da297 100644 --- a/include/u-boot/uuid.h +++ b/include/u-boot/uuid.h @@ -147,14 +147,14 @@ void gen_rand_uuid_str(char *uuid_str, int str_format); struct efi_guid; /** - * gen_v5_guid() - generate little endian v5 GUID from namespace and other seed data. + * gen_v5_guid_le() - generate little-endian v5 GUID from namespace and data * * @namespace: pointer to UUID namespace salt * @guid: pointer to allocated GUID output * @...: NULL terminated list of seed data as pairs of pointers * to data and their lengths */ -void gen_v5_guid(const struct uuid *namespace, struct efi_guid *guid, ...); +void gen_v5_guid_le(const struct uuid *namespace, struct efi_guid *guid, ...); /** * uuid_str_to_le_bin() - Convert string UUID to little endian binary data. diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c index 5a754c9cd03..d47c4ee96f7 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -287,10 +287,10 @@ static efi_status_t efi_gen_capsule_guids(void) log_err("fw_name is not defined. Not generating capsule GUIDs\n"); return EFI_INVALID_PARAMETER; } - gen_v5_guid(&namespace, - &fw_array[i].image_type_id, - compatible, strlen(compatible), - fw_array[i].fw_name, u16_strlen(fw_array[i].fw_name) * sizeof(uint16_t), + gen_v5_guid_le(&namespace, &fw_array[i].image_type_id, + compatible, strlen(compatible), + fw_array[i].fw_name, + u16_strlen(fw_array[i].fw_name) * sizeof(u16), NULL); log_debug("Image %ls UUID %pUl\n", fw_array[i].fw_name, diff --git a/lib/uuid.c b/lib/uuid.c index 3f7885d0877..4ca36530710 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -432,7 +432,7 @@ static void configure_uuid(struct uuid *uuid, unsigned char version) uuid->clock_seq_hi_and_reserved |= (UUID_VARIANT << UUID_VARIANT_SHIFT); } -void gen_v5_guid(const struct uuid *namespace, struct efi_guid *guid, ...) +void gen_v5_guid_le(const struct uuid *namespace, struct efi_guid *guid, ...) { sha1_context ctx; va_list args; diff --git a/test/lib/uuid.c b/test/lib/uuid.c index d00e9563a47..ac51c211256 100644 --- a/test/lib/uuid.c +++ b/test/lib/uuid.c @@ -67,8 +67,7 @@ static int lib_test_uuid_bits(struct unit_test_state *uts) ut_assert((uuid[8] & UUID_VARIANT_MASK) == (UUID_VARIANT << UUID_VARIANT_SHIFT)); /* Test v5, use the v4 UUID as the namespace */ - gen_v5_guid((struct uuid *)uuid, - &guid, "test", 4, NULL); + gen_v5_guid_le((struct uuid *)uuid, &guid, "test", 4, NULL); printf("v5 GUID: %pUl\n", (efi_guid_t *)uuid); @@ -105,10 +104,9 @@ static int lib_test_dynamic_uuid_case(struct unit_test_state *uts, efi_guid_t uuid; char uuid_str[37]; - gen_v5_guid(&namespace, &uuid, - data->compatible, strlen(data->compatible), - image, u16_strlen(image) * sizeof(uint16_t), - NULL); + gen_v5_guid_le(&namespace, &uuid, data->compatible, + strlen(data->compatible), image, + u16_strlen(image) * sizeof(u16), NULL); uuid_bin_to_str((unsigned char *)&uuid, uuid_str, UUID_STR_FORMAT_GUID); ut_asserteq_str(expected_uuid, uuid_str); diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c index fb6c57f77c1..4eb70639005 100644 --- a/tools/mkeficapsule.c +++ b/tools/mkeficapsule.c @@ -947,10 +947,9 @@ static int genguid(int argc, char **argv) for (int i = 0; i < namelen; i++) fw_image[i] = (uint16_t)argv[idx][i]; - gen_v5_guid((struct uuid *)&namespace, &image_type_id, - compatible, strlen(compatible), - fw_image, namelen * sizeof(uint16_t), - NULL); + gen_v5_guid_le((struct uuid *)&namespace, &image_type_id, + compatible, strlen(compatible), fw_image, + namelen * sizeof(uint16_t), NULL); printf("%s: ", argv[idx]); print_guid(&image_type_id); -- 2.43.0