boot: Use strsize8/16
This commit is contained in:
+3
-3
@@ -2375,7 +2375,7 @@ static EFI_STATUS image_start(
|
||||
CHAR16 *options = options_initrd ?: entry->options;
|
||||
if (options) {
|
||||
loaded_image->LoadOptions = options;
|
||||
loaded_image->LoadOptionsSize = StrSize(options);
|
||||
loaded_image->LoadOptionsSize = strsize16(options);
|
||||
|
||||
/* Try to log any options to the TPM, especially to catch manually edited options */
|
||||
(void) tpm_log_load_options(options);
|
||||
@@ -2426,14 +2426,14 @@ static void config_write_entries_to_variable(Config *config) {
|
||||
assert(config);
|
||||
|
||||
for (UINTN i = 0; i < config->entry_count; i++)
|
||||
sz += StrSize(config->entries[i]->id);
|
||||
sz += strsize16(config->entries[i]->id);
|
||||
|
||||
p = buffer = xallocate_pool(sz);
|
||||
|
||||
for (UINTN i = 0; i < config->entry_count; i++) {
|
||||
UINTN l;
|
||||
|
||||
l = StrSize(config->entries[i]->id);
|
||||
l = strsize16(config->entries[i]->id);
|
||||
CopyMem(p, config->entries[i]->id, l);
|
||||
|
||||
p += l;
|
||||
|
||||
@@ -45,7 +45,7 @@ static EFI_STATUS loaded_image_register(
|
||||
/* if a cmdline is set convert it to UCS2 */
|
||||
if (cmdline) {
|
||||
loaded_image->LoadOptions = xstra_to_str(cmdline);
|
||||
loaded_image->LoadOptionsSize = StrSize(loaded_image->LoadOptions);
|
||||
loaded_image->LoadOptionsSize = strsize16(loaded_image->LoadOptions);
|
||||
}
|
||||
|
||||
/* install a new LoadedImage protocol. ret_handle is a new image handle */
|
||||
|
||||
@@ -25,7 +25,7 @@ static EFI_STATUS tpm1_measure_to_pcr_and_event_log(
|
||||
assert(tcg);
|
||||
assert(description);
|
||||
|
||||
desc_len = StrSize(description);
|
||||
desc_len = strsize16(description);
|
||||
tcg_event = xallocate_zero_pool(offsetof(TCG_PCR_EVENT, Event) + desc_len);
|
||||
*tcg_event = (TCG_PCR_EVENT) {
|
||||
.EventSize = desc_len,
|
||||
@@ -56,7 +56,7 @@ static EFI_STATUS tpm2_measure_to_pcr_and_event_log(
|
||||
assert(tcg);
|
||||
assert(description);
|
||||
|
||||
desc_len = StrSize(description);
|
||||
desc_len = strsize16(description);
|
||||
tcg_event = xallocate_zero_pool(offsetof(EFI_TCG2_EVENT, Event) + desc_len);
|
||||
*tcg_event = (EFI_TCG2_EVENT) {
|
||||
.Size = offsetof(EFI_TCG2_EVENT, Event) + desc_len,
|
||||
@@ -171,7 +171,7 @@ EFI_STATUS tpm_log_load_options(const CHAR16 *load_options) {
|
||||
|
||||
err = tpm_log_event(pcr,
|
||||
POINTER_TO_PHYSICAL_ADDRESS(load_options),
|
||||
StrSize(load_options), load_options);
|
||||
strsize16(load_options), load_options);
|
||||
if (EFI_ERROR(err))
|
||||
return log_error_status_stall(err, L"Unable to add load options (i.e. kernel command) line measurement to PCR %u: %r", pcr, err);
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ EFI_STATUS efivar_set(const EFI_GUID *vendor, const CHAR16 *name, const CHAR16 *
|
||||
assert(vendor);
|
||||
assert(name);
|
||||
|
||||
return efivar_set_raw(vendor, name, value, value ? StrSize(value) : 0, flags);
|
||||
return efivar_set_raw(vendor, name, value, value ? strsize16(value) : 0, flags);
|
||||
}
|
||||
|
||||
EFI_STATUS efivar_set_uint_string(const EFI_GUID *vendor, const CHAR16 *name, UINTN i, UINT32 flags) {
|
||||
|
||||
Reference in New Issue
Block a user