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 /include/mok.h | |
| 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 'include/mok.h')
| -rw-r--r-- | include/mok.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/mok.h b/include/mok.h index fe92cf03..c37ccba5 100644 --- a/include/mok.h +++ b/include/mok.h @@ -17,6 +17,7 @@ typedef enum { struct mok_state_variable; typedef vendor_addend_category_t (vendor_addend_categorizer_t)(struct mok_state_variable *); +typedef UINTN (mok_variable_format_helper_t)(UINT8 *buf, size_t sz, struct mok_state_variable *); /* * MoK variables that need to have their storage validated. @@ -91,6 +92,23 @@ struct mok_state_variable { * mirrored. */ UINT8 *state; + + /* + * If this is non-NULL, this function will be called during the + * "import" phase to format the variable data. It'll get called + * twice, once as: + * + * sz = format(NULL, 0, ptr); + * + * a buffer of size sz will then be allocated, and it'll be called + * again to fill the buffer: + * + * format(buf, sz, ptr); + * + * Note that as an implementation detail data and data_size must be + * NULL and 0 respectively for this entry. + */ + mok_variable_format_helper_t *format; }; extern size_t n_mok_state_variables; |
