prepare-root: Fold together composefs signature cases
authorColin Walters <walters@verbum.org>
Mon, 21 Aug 2023 21:12:08 +0000 (17:12 -0400)
committerColin Walters <walters@verbum.org>
Fri, 25 Aug 2023 19:22:21 +0000 (15:22 -0400)
Now that we don't support digest-but-not-signature verification
for composefs, the logic here was unnecessarily complicated.
With a prior prep patch that moved the composefs option
initialization up, we can just have everything related to signature
verification in a single conditonal.

src/switchroot/ostree-prepare-root.c

index 682e71ea82352af0920b8b4aea633daa61414cd5..a75c1981b47f28d52b7fed7994cd2e34103f57bb 100644 (file)
@@ -479,21 +479,11 @@ main (int argc, char *argv[])
 
           expected_digest = g_malloc (OSTREE_SHA256_STRING_LEN + 1);
           ot_bin2hex (expected_digest, cfs_digest_buf, g_variant_get_size (cfs_digest_v));
-        }
 
-      if (expected_digest != NULL)
-        {
           cfs_options.flags |= LCFS_MOUNT_FLAGS_REQUIRE_VERITY;
           g_print ("composefs: Verifying digest: %s\n", expected_digest);
           cfs_options.expected_fsverity_digest = expected_digest;
         }
-      else
-        {
-          // If we're not verifying a digest, then we *must* also have signatures disabled.
-          // Or stated in reverse: if signature verification is enabled, then digest verification
-          // must also be.
-          g_assert (!composefs_config->is_signed);
-        }
 
       if (lcfs_mount_image (OSTREE_COMPOSEFS_NAME, TMP_SYSROOT, &cfs_options) == 0)
         {