summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/partition/repart.c6
-rwxr-xr-xtest/units/testsuite-58.sh13
2 files changed, 13 insertions, 6 deletions
diff --git a/src/partition/repart.c b/src/partition/repart.c
index c95b1d601d..920b442316 100644
--- a/src/partition/repart.c
+++ b/src/partition/repart.c
@@ -2471,8 +2471,10 @@ static int context_dump_partitions(Context *context) {
if (p->new_padding != UINT64_MAX)
sum_padding += p->new_padding;
- if (p->verity == VERITY_HASH) {
- rh = p->roothash ? hexmem(p->roothash, p->roothash_size) : strdup("TBD");
+ if (p->verity != VERITY_OFF) {
+ Partition *hp = p->verity == VERITY_HASH ? p : p->siblings[VERITY_HASH];
+
+ rh = hp->roothash ? hexmem(hp->roothash, hp->roothash_size) : strdup("TBD");
if (!rh)
return log_oom();
}
diff --git a/test/units/testsuite-58.sh b/test/units/testsuite-58.sh
index e83df97067..8b52a435e6 100755
--- a/test/units/testsuite-58.sh
+++ b/test/units/testsuite-58.sh
@@ -819,7 +819,12 @@ EOF
--certificate="$defs/verity.crt" \
"$imgs/verity")
- roothash=$(jq -r ".[] | select(.type == \"root-${architecture}-verity\") | .roothash" <<< "$output")
+ drh=$(jq -r ".[] | select(.type == \"root-${architecture}\") | .roothash" <<< "$output")
+ hrh=$(jq -r ".[] | select(.type == \"root-${architecture}-verity\") | .roothash" <<< "$output")
+ srh=$(jq -r ".[] | select(.type == \"root-${architecture}-verity-sig\") | .roothash" <<< "$output")
+
+ assert_eq "$drh" "$hrh"
+ assert_eq "$hrh" "$srh"
# Check that we can dissect, mount and unmount a repart verity image. (and that the image UUID is deterministic)
@@ -828,9 +833,9 @@ EOF
return
fi
- systemd-dissect "$imgs/verity" --root-hash "$roothash"
- systemd-dissect "$imgs/verity" --root-hash "$roothash" --json=short | grep -q '"imageUuid":"1d2ce291-7cce-4f7d-bc83-fdb49ad74ebd"'
- systemd-dissect "$imgs/verity" --root-hash "$roothash" -M "$imgs/mnt"
+ systemd-dissect "$imgs/verity" --root-hash "$drh"
+ systemd-dissect "$imgs/verity" --root-hash "$drh" --json=short | grep -q '"imageUuid":"1d2ce291-7cce-4f7d-bc83-fdb49ad74ebd"'
+ systemd-dissect "$imgs/verity" --root-hash "$drh" -M "$imgs/mnt"
systemd-dissect -U "$imgs/mnt"
}