1 /* 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 14 struct 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 25 struct var_store_t { 26 struct var_t *vars; 27 bool auth_vars; 28 }; 29 30 struct var_store_t vs_load(struct mem_range_t vs_data, bool auth_vars); 31 32 bool vs_store(struct var_store_t *vs, struct mem_range_t vs_data); 33 34 struct var_t *vs_new_var(struct var_store_t *vs); 35 36 struct var_t *vs_find(struct var_store_t *vs, 37 const char name[], 38 const EFI_GUID *guid); 39 40 void vs_delete(struct var_store_t *vs, struct var_t *var); 41 42 void vs_free(struct var_store_t *vs); 43 44 #endif // SMMSTORETOOL__VS_H__ 45