static SD_VARLINK_DEFINE_METHOD(
Extend,
- SD_VARLINK_FIELD_COMMENT("PCR number to extend, in range of 0…23"),
- SD_VARLINK_DEFINE_INPUT(pcr, SD_VARLINK_INT, 0),
- SD_VARLINK_DEFINE_INPUT(nvpcr, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
+ SD_VARLINK_FIELD_COMMENT("PCR number to extend, in range of 0…23. Either this or 'nvpcr' must be specified, not both, not neither."),
+ SD_VARLINK_DEFINE_INPUT(pcr, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
+ SD_VARLINK_FIELD_COMMENT("NvPCR to extend, identified by a string. Either this or 'pcr' must be specified, not both, not neither."),
+ SD_VARLINK_DEFINE_INPUT(nvpcr, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
SD_VARLINK_FIELD_COMMENT("Text string to measure. (Specify either this, or the 'data' field below, not both)"),
SD_VARLINK_DEFINE_INPUT(text, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
SD_VARLINK_FIELD_COMMENT("Binary data to measure, encoded in Base64. (Specify either this, or the 'text' field above, not both)"),
DIGEST_ACTUAL="$(systemd-analyze nvpcrs test --json=pretty | jq -r '.[] | select(.name=="test") | .value')"
test "$DIGEST_ACTUAL" = "$DIGEST_EXPECTED"
-# Now "destroy" the value via another measurement
-/usr/lib/systemd/systemd-pcrextend --nvpcr=test schnurz
+# Now "destroy" the value via another measurement (this time we use Varlink, to test the API)
+varlinkctl call /usr/lib/systemd/systemd-pcrextend io.systemd.PCRExtend.Extend '{"nvpcr":"test","text":"schnurz"}'
DIGEST_ACTUAL2="$(systemd-analyze nvpcrs test --json=pretty | jq -r '.[] | select(.name=="test") | .value')"
test "$DIGEST_ACTUAL2" != "$DIGEST_EXPECTED"