diff options
| author | Tom Rini <[email protected]> | 2020-07-13 11:29:51 -0400 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2020-07-13 11:29:51 -0400 |
| commit | 959a481f8f49cb01d757363ae816d83e9c145ab7 (patch) | |
| tree | 2536cd6e870df4b797e8da6278d2447abf106197 /cmd | |
| parent | 497c7598c4e713eb9ad88fd7963e57b21b8b35e1 (diff) | |
| parent | 4a3155de3dbadfcb933287dbb84c8eff0fd951eb (diff) | |
Merge tag 'efi-2020-10-rc1-3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Pull request for UEFI sub-system for efi-2020-10-rc1 (3)
Up to now UEFI variables where stored in U-Boot environment variables.
Saving UEFI variables was not possible without saving the U-Boot
environment variables. With this patch series file ubootefi.var in the
EFI system partition is used for saving UEFI variables. Furthermore the
UEFI variables are exposed for reading at runtime.
Code corrections for UEFI secure boot are provided.
A buffer overrun in the RSA library is fixed.
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/nvedit_efi.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c index 29cad38e19b..3f61d5d6ccb 100644 --- a/cmd/nvedit_efi.c +++ b/cmd/nvedit_efi.c @@ -9,11 +9,13 @@ #include <common.h> #include <command.h> #include <efi_loader.h> +#include <efi_variable.h> #include <env.h> #include <exports.h> #include <hexdump.h> #include <malloc.h> #include <mapmem.h> +#include <rtc.h> #include <uuid.h> #include <linux/kernel.h> @@ -34,6 +36,7 @@ static const struct { {EFI_VARIABLE_RUNTIME_ACCESS, "RT"}, {EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS, "AW"}, {EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS, "AT"}, + {EFI_VARIABLE_READ_ONLY, "RO"}, }; static const struct { @@ -87,20 +90,22 @@ static void efi_dump_single_var(u16 *name, const efi_guid_t *guid, bool verbose) { u32 attributes; u8 *data; + u64 time; + struct rtc_time tm; efi_uintn_t size; int count, i; efi_status_t ret; data = NULL; size = 0; - ret = EFI_CALL(efi_get_variable(name, guid, &attributes, &size, data)); + ret = efi_get_variable_int(name, guid, &attributes, &size, data, &time); if (ret == EFI_BUFFER_TOO_SMALL) { data = malloc(size); if (!data) goto out; - ret = EFI_CALL(efi_get_variable(name, guid, &attributes, &size, - data)); + ret = efi_get_variable_int(name, guid, &attributes, &size, + data, &time); } if (ret == EFI_NOT_FOUND) { printf("Error: \"%ls\" not defined\n", name); @@ -109,13 +114,16 @@ static void efi_dump_single_var(u16 *name, const efi_guid_t *guid, bool verbose) if (ret != EFI_SUCCESS) goto out; - printf("%ls:\n %s:", name, efi_guid_to_str(guid)); + rtc_to_tm(time, &tm); + printf("%ls:\n %s:\n", name, efi_guid_to_str(guid)); + if (attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) + printf(" %04d-%02d-%02d %02d:%02d:%02d\n", tm.tm_year, + tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); + printf(" "); for (count = 0, i = 0; i < ARRAY_SIZE(efi_var_attrs); i++) if (attributes & efi_var_attrs[i].mask) { if (count) putc('|'); - else - putc(' '); count++; puts(efi_var_attrs[i].text); } @@ -592,8 +600,8 @@ int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc, p = var_name16; utf8_utf16_strncpy(&p, var_name, len + 1); - ret = EFI_CALL(efi_set_variable(var_name16, &guid, attributes, - size, value)); + ret = efi_set_variable_int(var_name16, &guid, attributes, size, value, + true); unmap_sysmem(value); if (ret == EFI_SUCCESS) { ret = CMD_RET_SUCCESS; |
