lib: Rename gen_v5_guid() to indicate it is little-endian
Normally v5 GUIDs are big-endian, so rename this function. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user