summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2019-11-20 13:09:41 +0800
committerJeremy Kerr <jk@ozlabs.org>2020-01-23 09:02:43 +0800
commitaa2d71a84ed6ba693b7dcde213c82c46f334f640 (patch)
tree6fef7f362d7d90209ebf832b357fe1ea81d6ea64
parentb2e5a7b63eb46e3ff268c8f781d8f590d09c6a02 (diff)
downloadtalos-petitboot-aa2d71a84ed6ba693b7dcde213c82c46f334f640.tar.gz
talos-petitboot-aa2d71a84ed6ba693b7dcde213c82c46f334f640.zip
protocol,types: Add secure & trusted boot state to system info
Add state of secure & trusted boot to struct system_info: - fw_measurement: whether the firmware has been measured - fw_enforcing: whether the firmware has been authenticated - os_enforcing: whether the boot payload will be authenticated Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
-rw-r--r--lib/pb-protocol/pb-protocol.c18
-rw-r--r--lib/types/types.h3
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c
index e0cef36..06c81f2 100644
--- a/lib/pb-protocol/pb-protocol.c
+++ b/lib/pb-protocol/pb-protocol.c
@@ -272,6 +272,9 @@ int pb_protocol_system_info_len(const struct system_info *sysinfo)
4 + optional_strlen(bd_info->mountpoint);
}
+ /* stb info */
+ len += 3 * sizeof(bool);
+
return len;
}
@@ -560,6 +563,13 @@ int pb_protocol_serialise_system_info(const struct system_info *sysinfo,
memset(pos, 0, HWADDR_SIZE);
pos += HWADDR_SIZE;
+ *(bool *)pos = sysinfo->stb_fw_measurement;
+ pos += sizeof(bool);
+ *(bool *)pos = sysinfo->stb_fw_enforcing;
+ pos += sizeof(bool);
+ *(bool *)pos = sysinfo->stb_os_enforcing;
+ pos += sizeof(bool);
+
assert(pos <= buf + buf_len);
return (pos <= buf + buf_len) ? 0 : -1;
@@ -1160,6 +1170,14 @@ int pb_protocol_deserialise_system_info(struct system_info *sysinfo,
pos += HWADDR_SIZE;
len -= HWADDR_SIZE;
+ sysinfo->stb_fw_measurement = !!*pos;
+ pos += sizeof(bool);
+ sysinfo->stb_fw_enforcing = !!*pos;
+ pos += sizeof(bool);
+ sysinfo->stb_os_enforcing = !!*pos;
+ pos += sizeof(bool);
+ len -= 3 * sizeof(bool);
+
rc = 0;
out:
return rc;
diff --git a/lib/types/types.h b/lib/types/types.h
index 22fa337..c923d93 100644
--- a/lib/types/types.h
+++ b/lib/types/types.h
@@ -138,6 +138,9 @@ struct system_info {
struct blockdev_info **blockdevs;
unsigned int n_blockdevs;
uint8_t *bmc_mac;
+ bool stb_fw_measurement;
+ bool stb_fw_enforcing;
+ bool stb_os_enforcing;
};
#define HWADDR_SIZE 6
OpenPOWER on IntegriCloud