diff options
| author | Peter Jones <pjones@redhat.com> | 2024-05-15 16:01:34 -0400 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2025-02-24 15:24:24 -0500 |
| commit | 887c0edab93c52e2558047897847166b73dc8c3a (patch) | |
| tree | bb9ae0f39cfa003758c1b709b7c16b121a264526 /mok.c | |
| parent | 49db3de08ef2c55f6dbc3c2b8e6ab7b2f22e5309 (diff) | |
| download | efi-boot-shim-887c0edab93c52e2558047897847166b73dc8c3a.tar.gz efi-boot-shim-887c0edab93c52e2558047897847166b73dc8c3a.zip | |
mok variables: add a format callback
This adds a member to the mok_state_variable struct to provide a
callback function for formatting external data. It basically has
snprintf()-like semantics for filling the buffer, but without the actual
printf-like formatting bits.
Signed-off-by: Peter Jones <pjones@redhat.com>
Diffstat (limited to 'mok.c')
| -rw-r--r-- | mok.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -985,8 +985,22 @@ EFI_STATUS import_one_mok_state(struct mok_state_variable *v, } } + if (v->format) { + v->data_size = v->format(NULL, 0, v); + if (v->data_size > 0) { + v->data = AllocatePool(v->data_size); + if (!v->data) { + perror(L"Could not allocate %lu bytes for %s\n", + v->data_size, v->name); + return EFI_OUT_OF_RESOURCES; + } + } + v->format(v->data, v->data_size, v); + } + if (!v->data && !v->data_size && - (v->flags & MOK_VARIABLE_CONFIG_ONLY)) { + (v->flags & MOK_VARIABLE_CONFIG_ONLY) && + !v->format) { efi_status = get_variable_attr(v->name, &v->data, &v->data_size, *v->guid, &attrs); |
