coreboot/util/smmstoretool/data.h
Benjamin Doron 3058464263 util/smmstoretool: Add support for creating variable from file contents
This helps with initialising UEFI secure boot variables for the first
boot, for example, by setting PKDefault, KEKDefault, dbDefault and
dbxDefault to the desired certificates.

Tested, and the get subcommand returns the same data that the set
command added. However, EDK2's variable driver (from approximately
edk2-stable202505) asserts that the variable store isn't the expected
size, and UEFITool can't decode it correctly. This is also the case for
other types supported before this patch, suggesting that the bug is in
general variable-handling code in this utility. Will be debugged and
addressed in a follow-up.

Change-Id: If36394bb56388a35882702c93e26e63124fe0a63
Signed-off-by: Benjamin Doron <benjamin.doron@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88377
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-07-17 18:14:08 +00:00

28 lines
612 B
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef SMMSTORETOOL__DATA_H__
#define SMMSTORETOOL__DATA_H__
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
enum data_type {
DATA_TYPE_BOOL,
DATA_TYPE_UINT8,
DATA_TYPE_UINT16,
DATA_TYPE_UINT32,
DATA_TYPE_UINT64,
DATA_TYPE_ASCII,
DATA_TYPE_UNICODE,
DATA_TYPE_FILE,
DATA_TYPE_RAW,
};
void print_data(const uint8_t data[], size_t data_size, enum data_type type);
void *make_data(const char source[], size_t *data_size, enum data_type type);
bool parse_data_type(const char str[], enum data_type *type);
#endif // SMMSTORETOOL__DATA_H__