From: Eric Biggers <ebiggers@kernel.org>
To: "Luís Henriques" <lhenriques@suse.de>
Cc: Jeff Layton <jlayton@kernel.org>,
ceph-devel@vger.kernel.org, fstests@vger.kernel.org
Subject: Re: [PATCH] common/encrypt: allow the use of 'fscrypt:' as key prefix
Date: Fri, 1 Apr 2022 18:12:14 +0000 [thread overview]
Message-ID: <YkdAfpN/YzAm18pl@gmail.com> (raw)
In-Reply-To: <20220401104553.32036-1-lhenriques@suse.de>
On Fri, Apr 01, 2022 at 11:45:53AM +0100, Luís Henriques wrote:
> fscrypt keys have used the $FSTYP as prefix. However this format is being
> deprecated -- newer kernels already allow the usage of the generic
> 'fscrypt:' prefix for ext4 and f2fs. This patch allows the usage of this
> new prefix for testing filesystems that have never supported the old
> format, but keeping the $FSTYP prefix for filesystems that support it, so
> that old kernels can be tested.
>
> Signed-off-by: Luís Henriques <lhenriques@suse.de>
> ---
> common/encrypt | 38 +++++++++++++++++++++++++++-----------
> 1 file changed, 27 insertions(+), 11 deletions(-)
>
> diff --git a/common/encrypt b/common/encrypt
> index f90c4ef05a3f..897c97e0f6fa 100644
> --- a/common/encrypt
> +++ b/common/encrypt
> @@ -250,6 +250,27 @@ _num_to_hex()
> fi
> }
>
> +# Keys are named $FSTYP:KEYDESC where KEYDESC is the 16-character key descriptor
> +# hex string. Newer kernels (ext4 4.8 and later, f2fs 4.6 and later) also allow
> +# the common key prefix "fscrypt:" in addition to their filesystem-specific key
> +# prefix ("ext4:", "f2fs:"). It would be nice to use the common key prefix, but
> +# for now use the filesystem- specific prefix for these 2 filesystems to make it
> +# possible to test older kernels, and the "fscrypt" prefix for anything else.
> +_get_fs_keyprefix()
> +{
> + local prefix=""
> +
> + case $FSTYP in
> + ext4|f2fs|ubifs)
> + prefix="$FSTYP"
> + ;;
> + *)
> + prefix="fscrypt"
> + ;;
> + esac
> + echo $prefix
> +}
ubifs can use the "fscrypt" prefix, since there was never a kernel that
supported ubifs encryption but not the "fscrypt" prefix. Also, the "prefix"
local variable is unnecessary. So:
case $FSTYP in
ext4|f2fs)
echo $FSTYP
;;
*)
echo fscrypt
;;
esac
Otherwise, this patch looks fine if we want to keep supporting testing kernels
older than 4.8. However, since 4.4 is no longer a supported LTS kernel, perhaps
this is no longer needed and we could just always use "fscrypt"? I'm not sure
what xfstests's policy on old kernels is.
- Eric
next prev parent reply other threads:[~2022-04-01 18:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-01 10:45 [PATCH] common/encrypt: allow the use of 'fscrypt:' as key prefix Luís Henriques
2022-04-01 12:37 ` Jeff Layton
2022-04-01 18:12 ` Eric Biggers [this message]
2022-04-04 8:55 ` Luís Henriques
2022-04-01 20:47 ` Jeff Layton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YkdAfpN/YzAm18pl@gmail.com \
--to=ebiggers@kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=fstests@vger.kernel.org \
--cc=jlayton@kernel.org \
--cc=lhenriques@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).