blob: 2ac9e6c8b256dc02d6e6562a1d394257fd2ed860 [file] [log] [blame]
Sergii Dmytruk04bd9652023-11-17 19:31:20 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
2
3#ifndef SMMSTORETOOL__VS_H__
4#define SMMSTORETOOL__VS_H__
5
6#include <stdbool.h>
7
8#include "udk2017.h"
9#include "utils.h"
10
11// Variable store is part of firmware volume. This unit doesn't deal with its
12// header only with data that follows.
13
14struct var_t {
15 uint8_t reserved;
16 uint32_t attrs;
17 EFI_GUID guid;
18 CHAR16 *name;
19 size_t name_size; // in bytes
20 uint8_t *data;
21 size_t data_size; // in bytes
22 struct var_t *next;
23};
24
25struct var_store_t {
26 struct var_t *vars;
27 bool auth_vars;
28};
29
30struct var_store_t vs_load(struct mem_range_t vs_data, bool auth_vars);
31
32bool vs_store(struct var_store_t *vs, struct mem_range_t vs_data);
33
34struct var_t *vs_new_var(struct var_store_t *vs);
35
36struct var_t *vs_find(struct var_store_t *vs,
37 const char name[],
38 const EFI_GUID *guid);
39
40void vs_delete(struct var_store_t *vs, struct var_t *var);
41
42void vs_free(struct var_store_t *vs);
43
44#endif // SMMSTORETOOL__VS_H__