Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e60c1484 authored by Eric Biggers's avatar Eric Biggers Committed by Paul Lawrence
Browse files

UPSTREAM: fs-verity: rename fsverity_signed_digest to fsverity_formatted_digest



The name "struct fsverity_signed_digest" is causing confusion because it
isn't actually a signed digest, but rather it's the way that the digest
is formatted in order to be signed.  Rename it to
"struct fsverity_formatted_digest" to prevent this confusion.

Also update the struct's comment to clarify that it's specific to the
built-in signature verification support and isn't a requirement for all
fs-verity users.

I'll be renaming this struct in fsverity-utils too.

Acked-by: default avatarLuca Boccassi <luca.boccassi@microsoft.com>
Link: https://lore.kernel.org/r/20201113211918.71883-3-ebiggers@kernel.org


Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Bug: 186190934
Test: With rest of series and ABI update incrementalfs.ko loads
(cherry picked from commit 9e90f30e78572ecfc1c74c735a034c955d822ba6)
Signed-off-by: default avatarPaul Lawrence <paullawrence@google.com>
Change-Id: I70ed689387efb9431418e7f71c3f443980084be1
parent 41018a55
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -372,7 +372,7 @@ kernel. Specifically, it adds support for:
File measurements must be signed in the following format, which is
similar to the structure used by `FS_IOC_MEASURE_VERITY`_::

    struct fsverity_signed_digest {
    struct fsverity_formatted_digest {
            char magic[8];                  /* must be "FSVerity" */
            __le16 digest_algorithm;
            __le16 digest_size;
+12 −5
Original line number Diff line number Diff line
@@ -101,12 +101,19 @@ struct fsverity_descriptor {
					 sizeof(struct fsverity_descriptor))

/*
 * Format in which verity file measurements are signed.  This is the same as
 * 'struct fsverity_digest', except here some magic bytes are prepended to
 * provide some context about what is being signed in case the same key is used
 * for non-fsverity purposes, and here the fields have fixed endianness.
 * Format in which verity file measurements are signed in built-in signatures.
 * This is the same as 'struct fsverity_digest', except here some magic bytes
 * are prepended to provide some context about what is being signed in case the
 * same key is used for non-fsverity purposes, and here the fields have fixed
 * endianness.
 *
 * This struct is specific to the built-in signature verification support, which
 * is optional.  fs-verity users may also verify signatures in userspace, in
 * which case userspace is responsible for deciding on what bytes are signed.
 * This struct may still be used, but it doesn't have to be.  For example,
 * userspace could instead use a string like "sha256:$digest_as_hex_string".
 */
struct fsverity_signed_digest {
struct fsverity_formatted_digest {
	char magic[8];			/* must be "FSVerity" */
	__le16 digest_algorithm;
	__le16 digest_size;
+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ int fsverity_verify_signature(const struct fsverity_info *vi,
	const struct inode *inode = vi->inode;
	const struct fsverity_hash_alg *hash_alg = vi->tree_params.hash_alg;
	const u32 sig_size = le32_to_cpu(desc->sig_size);
	struct fsverity_signed_digest *d;
	struct fsverity_formatted_digest *d;
	int err;

	if (sig_size == 0) {