util/smmstoretool: Allow setting authenticated variable
Change-Id: I82ee1b84dfa7fafb17ddb0d4adf1891e1c5f149b Signed-off-by: Benjamin Doron <benjamin.doron@9elements.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/88425 Reviewed-by: Sean Rhodes <sean@starlabs.systems> Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
parent
e977560e72
commit
88aeb8b7cd
1 changed files with 7 additions and 1 deletions
|
|
@ -140,6 +140,7 @@ static void help_set(FILE *f, const struct subcommand_t *info)
|
|||
fprintf(f, " -n variable-name \\\n");
|
||||
fprintf(f, " -t variable-type \\\n");
|
||||
fprintf(f, " -v value\n");
|
||||
fprintf(f, " -a\n");
|
||||
fprintf(f, "\n");
|
||||
print_types(f);
|
||||
}
|
||||
|
|
@ -150,8 +151,9 @@ static int process_set(int argc, char *argv[], const char store_file[])
|
|||
const char *value = NULL;
|
||||
const char *type_str = NULL;
|
||||
const char *guid_str = NULL;
|
||||
bool authenticated_var = false;
|
||||
int opt;
|
||||
while ((opt = getopt(argc, argv, "n:t:v:g:")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "n:t:v:g:a::")) != -1) {
|
||||
switch (opt) {
|
||||
case 'n':
|
||||
name = optarg;
|
||||
|
|
@ -165,6 +167,9 @@ static int process_set(int argc, char *argv[], const char store_file[])
|
|||
case 'g':
|
||||
guid_str = optarg;
|
||||
break;
|
||||
case 'a':
|
||||
authenticated_var = true;
|
||||
break;
|
||||
|
||||
case '?': /* parsing error */
|
||||
print_sub_command_usage(argv[0]);
|
||||
|
|
@ -217,6 +222,7 @@ static int process_set(int argc, char *argv[], const char store_file[])
|
|||
struct var_t *var = vs_find(&storage.vs, name, &guid);
|
||||
if (var == NULL) {
|
||||
var = vs_new_var(&storage.vs);
|
||||
var->attrs |= authenticated_var ? EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS : 0;
|
||||
var->name = to_uchars(name, &var->name_size);
|
||||
var->data = data;
|
||||
var->data_size = data_size;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue