diff options
author | Lennart Poettering <lennart@poettering.net> | 2022-11-30 18:44:06 +0100 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2022-12-03 00:22:23 +0100 |
commit | c2534821dc13510dbfa57673af6f54d6172c3712 (patch) | |
tree | 2ce0a99bba54dec10702ab1b1da996aacf101db8 /src/shared/dissect-image.h | |
parent | dissect: pick up gpt partition flags (diff) | |
download | systemd-c2534821dc13510dbfa57673af6f54d6172c3712.tar.xz systemd-c2534821dc13510dbfa57673af6f54d6172c3712.zip |
dissect: add new helper verity_settings_data_covers()
This function checks if the external verity data referenced in
VeritySettings covers the specified partition (indicated via
designator).
Right now, we'll use that at one place, but in a later commit in more.
Diffstat (limited to 'src/shared/dissect-image.h')
-rw-r--r-- | src/shared/dissect-image.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/shared/dissect-image.h b/src/shared/dissect-image.h index 5402e4fca2..059b9aecbb 100644 --- a/src/shared/dissect-image.h +++ b/src/shared/dissect-image.h @@ -166,6 +166,14 @@ int dissected_image_relinquish(DissectedImage *m); int verity_settings_load(VeritySettings *verity, const char *image, const char *root_hash_path, const char *root_hash_sig_path); void verity_settings_done(VeritySettings *verity); +static inline bool verity_settings_data_covers(const VeritySettings *verity, PartitionDesignator d) { + /* Returns true if the verity settings contain sufficient information to cover the specified partition */ + return verity && + ((d >= 0 && verity->designator == d) || (d == PARTITION_ROOT && verity->designator < 0)) && + verity->root_hash && + verity->data_path; +} + int dissected_image_load_verity_sig_partition(DissectedImage *m, int fd, VeritySettings *verity); bool dissected_image_verity_candidate(const DissectedImage *image, PartitionDesignator d); |