aboutsummaryrefslogtreecommitdiff
path: root/include/secvar.h
blob: 413d7997e293dd8ca52a1834f0f5f5e472848a83 (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: Apache-2.0 OR GPL-2.0-or-later
/* Copyright 2019 IBM Corp. */

#ifndef _SECVAR_DRIVER_
#define _SECVAR_DRIVER_

#include <stdint.h>

struct secvar;

struct secvar_storage_driver {
	int (*load_bank)(struct list_head *bank, int section);
	int (*write_bank)(struct list_head *bank, int section);
	int (*store_init)(void);
	void (*lockdown)(void);
	uint64_t max_var_size;
};

struct secvar_backend_driver {
	/* Perform any pre-processing stuff (e.g. determine secure boot state) */
	int (*pre_process)(struct list_head *variable_bank,
			   struct list_head *update_bank);

	/* Process all updates */
	int (*process)(struct list_head *variable_bank,
		       struct list_head *update_bank);

	/* Perform any post-processing stuff (e.g. derive/update variables)*/
	int (*post_process)(struct list_head *variable_bank,
			    struct list_head *update_bank);

	/* Validate a single variable, return boolean */
	int (*validate)(struct secvar *var);

	/* String to use for compatible in secvar node */
	const char *compatible;
};

extern struct secvar_storage_driver secboot_tpm_driver;
extern struct secvar_backend_driver edk2_compatible_v1;

int secvar_main(struct secvar_storage_driver, struct secvar_backend_driver);

#endif