Corrected understanding of relation of RFC 4122 and UEFI GUID.
Thanks Andrei Borzenkov.
This commit is contained in:
parent
866f647fad
commit
9d64318502
@ -2597,26 +2597,29 @@ int iso_write_opts_set_efi_bootp(IsoWriteOpts *opts, char *image_path,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Control whether the emerging GPT gets a pseudo-randomly generated disk GUID
|
* Control whether the emerging GPT gets a pseudo-randomly generated disk GUID
|
||||||
* or * whether it gets a user supplied GUID.
|
* or whether it gets a user supplied GUID.
|
||||||
* The partition GUIDs will be generated in a reproducible way by exoring a
|
* The partition GUIDs will be generated in a reproducible way by exoring the
|
||||||
* little-endian 32 bit counter with the disk GUID beginning at byte offset 9.
|
* little-endian 32 bit partion number with the disk GUID beginning at byte
|
||||||
|
* offset 9.
|
||||||
*
|
*
|
||||||
* @param opts
|
* @param opts
|
||||||
* The option set to be manipulated.
|
* The option set to be manipulated.
|
||||||
* @param guid
|
* @param guid
|
||||||
* 16 bytes of user supplied GUID.
|
* 16 bytes of user supplied GUID. Readily byte-swapped as prescribed by
|
||||||
* The upper 4 bit of guid[6] and guid[7] should bear the value 4 to
|
* UEFI specs: 4 byte, 2 byte, 2 byte as little-endian. The rest as
|
||||||
* express the version 4 in both endiannesses. Bit 7 of byte[8] should
|
* big-endian.
|
||||||
* be set to 1 and bit 6 be set to 0, in order to express the RFC 4122
|
* The upper 4 bit of guid[7] should bear the value 4 to express the
|
||||||
* variant of GUID, where version 4 means "random".
|
* RFC 4122 version 4. Bit 7 of byte[8] should be set to 1 and bit 6
|
||||||
|
* be set to 0, in order to express the RFC 4122 variant of UUID,
|
||||||
|
* where version 4 means "pseudo-random uuid".
|
||||||
* @param mode
|
* @param mode
|
||||||
* 0 = ignore parameter guid and produce the GPT disk GUID by a
|
* 0 = ignore parameter guid and produce the GPT disk GUID by a
|
||||||
* pseudo-random algorithm. This is the default setting.
|
* pseudo-random algorithm. This is the default setting.
|
||||||
* 1 = use parameter guid as GPT disk GUID
|
* 1 = use parameter guid as GPT disk GUID
|
||||||
* 2 = ignore parameter guid and derive the GPT disk GUID from
|
* 2 = ignore parameter guid and derive the GPT disk GUID from
|
||||||
* parameter vol_uuid of iso_write_opts_set_pvd_times().
|
* parameter vol_uuid of iso_write_opts_set_pvd_times().
|
||||||
* The 16 bytes of vol_uuid get copied and bytes 6, 7, 8 get their
|
* The 16 bytes of vol_uuid get copied and bytes 7, 8 get their
|
||||||
* upper bits changed to comply to RFC 4122.
|
* upper bits changed to comply to RFC 4122 and UEFI.
|
||||||
* Error ISO_GPT_NO_VOL_UUID will occur if image production begins
|
* Error ISO_GPT_NO_VOL_UUID will occur if image production begins
|
||||||
* before vol_uuid was set.
|
* before vol_uuid was set.
|
||||||
*
|
*
|
||||||
|
@ -2362,10 +2362,9 @@ uint32_t iso_crc32_gpt(unsigned char *data, int count, int flag)
|
|||||||
|
|
||||||
void iso_mark_guid_version_4(uint8_t *u)
|
void iso_mark_guid_version_4(uint8_t *u)
|
||||||
{
|
{
|
||||||
/* Mark as UUID version 4. RFC 4122 says u[6], but isohybrid swapping
|
/* Mark as UUID version 4. RFC 4122 says u[6], but UEFI prescribes
|
||||||
effectively puts the 4 into u[7]. So i mark both. 4 bits wasted.
|
bytes 6 and 7 to be swapped.
|
||||||
*/
|
*/
|
||||||
u[6] = (u[6] & 0x0f) | 0x40;
|
|
||||||
u[7] = (u[7] & 0x0f) | 0x40;
|
u[7] = (u[7] & 0x0f) | 0x40;
|
||||||
|
|
||||||
/* Variant is "1 0 x" as described in RFC 4122.
|
/* Variant is "1 0 x" as described in RFC 4122.
|
||||||
@ -2389,7 +2388,7 @@ void iso_generate_gpt_guid(uint8_t guid[16])
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
uint8_t *u;
|
uint8_t *u;
|
||||||
/* produced by uuid_generate() and byte-swapped to isohybrid.c habits */
|
/* produced by uuid_generate() and byte-swapped to UEFI specs */
|
||||||
static uint8_t uuid_template[16] = {
|
static uint8_t uuid_template[16] = {
|
||||||
0xee, 0x29, 0x9d, 0xfc, 0x65, 0xcc, 0x7c, 0x40,
|
0xee, 0x29, 0x9d, 0xfc, 0x65, 0xcc, 0x7c, 0x40,
|
||||||
0x92, 0x61, 0x5b, 0xcd, 0x6f, 0xed, 0x08, 0x34
|
0x92, 0x61, 0x5b, 0xcd, 0x6f, 0xed, 0x08, 0x34
|
||||||
|
Loading…
x
Reference in New Issue
Block a user