summaryrefslogtreecommitdiffstats
path: root/src/boot
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-10-31 16:50:13 +0100
committerLennart Poettering <lennart@poettering.net>2022-10-31 16:51:12 +0100
commit28acd1e6c3726802a1b07da23e037591b69e8cd4 (patch)
tree9dd77a8e5760a0c3720e5f18ae36e912f627bab1 /src/boot
parentresolved: fix copypasta in resolved varlink API (diff)
downloadsystemd-28acd1e6c3726802a1b07da23e037591b69e8cd4.tar.xz
systemd-28acd1e6c3726802a1b07da23e037591b69e8cd4.zip
measure: banks and phases list are always non-empty
When parsing parameters, we populate these lists with defaults when empty, hence we can rely that there's at least one bank and one phase defined.
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/measure.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/boot/measure.c b/src/boot/measure.c
index 6372c9314b..859810df55 100644
--- a/src/boot/measure.c
+++ b/src/boot/measure.c
@@ -623,6 +623,9 @@ static int verb_calculate(int argc, char *argv[], void *userdata) {
if (!arg_sections[UNIFIED_SECTION_LINUX] && !arg_current)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Either --linux= or --current must be specified, refusing.");
+ assert(!strv_isempty(arg_banks));
+ assert(!strv_isempty(arg_phase));
+
r = pcr_states_allocate(&pcr_states);
if (r < 0)
return r;
@@ -721,6 +724,9 @@ static int verb_sign(int argc, char *argv[], void *userdata) {
if (!arg_private_key)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "No private key specified, use --private-key=.");
+ assert(!strv_isempty(arg_banks));
+ assert(!strv_isempty(arg_phase));
+
/* When signing we only support JSON output */
arg_json_format_flags &= ~JSON_FORMAT_OFF;
@@ -924,9 +930,6 @@ static int verb_sign(int argc, char *argv[], void *userdata) {
}
}
- if (!v)
- return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Unable to find a single working PCR bank.");
-
if (arg_json_format_flags & (JSON_FORMAT_PRETTY|JSON_FORMAT_PRETTY_AUTO))
pager_open(arg_pager_flags);