| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
|
| 3 |
#include "varlink-io.systemd.PCRExtend.h" |
| 4 |
|
| 5 |
static SD_VARLINK_DEFINE_ENUM_TYPE( |
| 6 |
EventType, |
| 7 |
SD_VARLINK_DEFINE_ENUM_VALUE(phase), |
| 8 |
SD_VARLINK_DEFINE_ENUM_VALUE(filesystem), |
| 9 |
SD_VARLINK_DEFINE_ENUM_VALUE(volume_key), |
| 10 |
SD_VARLINK_DEFINE_ENUM_VALUE(machine_id), |
| 11 |
SD_VARLINK_DEFINE_ENUM_VALUE(product_id), |
| 12 |
SD_VARLINK_DEFINE_ENUM_VALUE(keyslot), |
| 13 |
SD_VARLINK_DEFINE_ENUM_VALUE(nvpcr_init), |
| 14 |
SD_VARLINK_DEFINE_ENUM_VALUE(nvpcr_separator), |
| 15 |
SD_VARLINK_DEFINE_ENUM_VALUE(dm_verity), |
| 16 |
SD_VARLINK_DEFINE_ENUM_VALUE(imds_userdata)); |
| 17 |
|
| 18 |
static SD_VARLINK_DEFINE_METHOD( |
| 19 |
Extend, |
| 20 |
SD_VARLINK_FIELD_COMMENT("PCR number to extend, in range of 0…23. Either this or 'nvpcr' must be specified, not both, not neither."), |
| 21 |
SD_VARLINK_DEFINE_INPUT(pcr, SD_VARLINK_INT, SD_VARLINK_NULLABLE), |
| 22 |
SD_VARLINK_FIELD_COMMENT("NvPCR to extend, identified by a string. Either this or 'pcr' must be specified, not both, not neither."), |
| 23 |
SD_VARLINK_DEFINE_INPUT(nvpcr, SD_VARLINK_STRING, SD_VARLINK_NULLABLE), |
| 24 |
SD_VARLINK_FIELD_COMMENT("Text string to measure. (Specify either this, or the 'data' field below, not both)"), |
| 25 |
SD_VARLINK_DEFINE_INPUT(text, SD_VARLINK_STRING, SD_VARLINK_NULLABLE), |
| 26 |
SD_VARLINK_FIELD_COMMENT("Binary data to measure, encoded in Base64. (Specify either this, or the 'text' field above, not both)"), |
| 27 |
SD_VARLINK_DEFINE_INPUT(data, SD_VARLINK_STRING, SD_VARLINK_NULLABLE), |
| 28 |
SD_VARLINK_FIELD_COMMENT("Event type to include in the (userspace) event log). This is optional, and mostly for debugging."), |
| 29 |
SD_VARLINK_DEFINE_INPUT_BY_TYPE(eventType, EventType, SD_VARLINK_NULLABLE)); |
| 30 |
|
| 31 |
static SD_VARLINK_DEFINE_ERROR(NoSuchNvPCR); |
| 32 |
|
| 33 |
SD_VARLINK_DEFINE_INTERFACE( |
| 34 |
io_systemd_PCRExtend, |
| 35 |
"io.systemd.PCRExtend", |
| 36 |
SD_VARLINK_INTERFACE_COMMENT("TPM PCR Extension APIs"), |
| 37 |
SD_VARLINK_SYMBOL_COMMENT("Measure some text or binary data into a PCR"), |
| 38 |
&vl_method_Extend, |
| 39 |
SD_VARLINK_SYMBOL_COMMENT("Event type to store in event log"), |
| 40 |
&vl_type_EventType, |
| 41 |
&vl_error_NoSuchNvPCR); |