if (arg_verity_settings.data_path)
r = table_add_cell(t, NULL, TABLE_STRING, "external");
- else if (dissected_image_can_do_verity(m, i))
- r = table_add_cell(t, NULL, TABLE_STRING, yes_no(dissected_image_has_verity(m, i)));
+ else if (dissected_image_verity_candidate(m, i))
+ r = table_add_cell(t, NULL, TABLE_STRING, yes_no(dissected_image_verity_ready(m, i)));
else
r = table_add_cell(t, NULL, TABLE_EMPTY, NULL);
if (r < 0)
}
}
-bool dissected_image_can_do_verity(const DissectedImage *image, PartitionDesignator partition_designator) {
+bool dissected_image_verity_candidate(const DissectedImage *image, PartitionDesignator partition_designator) {
+ assert(image);
+
+ /* Checks if this partition could theoretically do Verity. For non-partitioned images this only works
+ * if there's an external verity file supplied, for which we can consult .has_verity. For partitioned
+ * images we only check the partition type.
+ *
+ * This call is used to decide whether to suppress or show a verity column in tabular output of the
+ * image. */
+
if (image->single_file_system)
return partition_designator == PARTITION_ROOT && image->has_verity;
return PARTITION_VERITY_OF(partition_designator) >= 0;
}
-bool dissected_image_has_verity(const DissectedImage *image, PartitionDesignator partition_designator) {
- int k;
+bool dissected_image_verity_ready(const DissectedImage *image, PartitionDesignator partition_designator) {
+ PartitionDesignator k;
+
+ assert(image);
+
+ /* Checks if this partition has verity data available that we can activate. For non-partitioned this
+ * works for the root partition, for others only if the associated verity partition was found. */
+
+ if (!image->verity_ready)
+ return false;
if (image->single_file_system)
- return partition_designator == PARTITION_ROOT && image->verity_ready;
+ return partition_designator == PARTITION_ROOT;
k = PARTITION_VERITY_OF(partition_designator);
return k >= 0 && image->partitions[k].found;
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);
-bool dissected_image_can_do_verity(const DissectedImage *image, PartitionDesignator d);
-bool dissected_image_has_verity(const DissectedImage *image, PartitionDesignator d);
+bool dissected_image_verity_candidate(const DissectedImage *image, PartitionDesignator d);
+bool dissected_image_verity_ready(const DissectedImage *image, PartitionDesignator d);
int mount_image_privately_interactively(const char *path, DissectImageFlags flags, char **ret_directory, LoopDevice **ret_loop_device, DecryptedImage **ret_decrypted_image);