aboutsummaryrefslogtreecommitdiff
path: root/util/smmstoretool/vs.h
blob: 2ac9e6c8b256dc02d6e6562a1d394257fd2ed860 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* SPDX-License-Identifier: GPL-2.0-or-later */

#ifndef SMMSTORETOOL__VS_H__
#define SMMSTORETOOL__VS_H__

#include <stdbool.h>

#include "udk2017.h"
#include "utils.h"

// Variable store is part of firmware volume.  This unit doesn't deal with its
// header only with data that follows.

struct var_t {
	uint8_t reserved;
	uint32_t attrs;
	EFI_GUID guid;
	CHAR16 *name;
	size_t name_size; // in bytes
	uint8_t *data;
	size_t data_size; // in bytes
	struct var_t *next;
};

struct var_store_t {
	struct var_t *vars;
	bool auth_vars;
};

struct var_store_t vs_load(struct mem_range_t vs_data, bool auth_vars);

bool vs_store(struct var_store_t *vs, struct mem_range_t vs_data);

struct var_t *vs_new_var(struct var_store_t *vs);

struct var_t *vs_find(struct var_store_t *vs,
		      const char name[],
		      const EFI_GUID *guid);

void vs_delete(struct var_store_t *vs, struct var_t *var);

void vs_free(struct var_store_t *vs);

#endif // SMMSTORETOOL__VS_H__