Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/smbiostbl.c
Show First 20 Lines • Show All 552 Lines • ▼ Show 20 Lines | smbios_generic_initializer(struct smbios_structure *template_entry, | ||||
if (template_strings != NULL) { | if (template_strings != NULL) { | ||||
int i; | int i; | ||||
for (i = 0; template_strings[i] != NULL; i++) { | for (i = 0; template_strings[i] != NULL; i++) { | ||||
const char *string; | const char *string; | ||||
int len; | int len; | ||||
string = template_strings[i]; | string = template_strings[i]; | ||||
len = strlen(string) + 1; | len = strnlen(string, SMBIOS_MAX_LENGTH) + 1; | ||||
memcpy(curaddr, string, len); | memcpy(curaddr, string, len); | ||||
curaddr += len; | curaddr += len; | ||||
} | } | ||||
*curaddr = '\0'; | *curaddr = '\0'; | ||||
curaddr++; | curaddr++; | ||||
} else { | } else { | ||||
/* Minimum string section is double nul */ | /* Minimum string section is double nul */ | ||||
*curaddr = '\0'; | *curaddr = '\0'; | ||||
Show All 36 Lines | if (guest_uuid_str != NULL) { | ||||
* Universally unique and yet reproducible are an | * Universally unique and yet reproducible are an | ||||
* oxymoron, however reproducible is desirable in | * oxymoron, however reproducible is desirable in | ||||
* this case. | * this case. | ||||
*/ | */ | ||||
if (gethostname(hostname, sizeof(hostname))) | if (gethostname(hostname, sizeof(hostname))) | ||||
return (-1); | return (-1); | ||||
MD5Init(&mdctx); | MD5Init(&mdctx); | ||||
MD5Update(&mdctx, vmname, strlen(vmname)); | MD5Update(&mdctx, vmname, strnlen(vmname, PATH_MAX)); | ||||
MD5Update(&mdctx, hostname, sizeof(hostname)); | MD5Update(&mdctx, hostname, sizeof(hostname)); | ||||
MD5Final(digest, &mdctx); | MD5Final(digest, &mdctx); | ||||
/* | /* | ||||
* Set the variant and version number. | * Set the variant and version number. | ||||
*/ | */ | ||||
digest[6] &= 0x0F; | digest[6] &= 0x0F; | ||||
digest[6] |= 0x30; /* version 3 */ | digest[6] |= 0x30; /* version 3 */ | ||||
▲ Show 20 Lines • Show All 207 Lines • Show Last 20 Lines |