From: Eric Biggers <ebiggers@kernel.org>
To: Satya Tangirala <satyat@google.com>
Cc: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org,
linux-fscrypt@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net,
linux-ext4@vger.kernel.org,
Barani Muthukumaran <bmuthuku@qti.qualcomm.com>,
Kuohong Wang <kuohong.wang@mediatek.com>,
Kim Boojin <boojin.kim@samsung.com>
Subject: Re: [PATCH v7 7/9] fscrypt: add inline encryption support
Date: Fri, 21 Feb 2020 21:39:05 -0800 [thread overview]
Message-ID: <20200222053905.GC848@sol.localdomain> (raw)
In-Reply-To: <20200221115050.238976-8-satyat@google.com>
On Fri, Feb 21, 2020 at 03:50:48AM -0800, Satya Tangirala wrote:
> diff --git a/fs/crypto/keysetup.c b/fs/crypto/keysetup.c
> index 65cb09fa6ead..7c157130c16a 100644
> --- a/fs/crypto/keysetup.c
> +++ b/fs/crypto/keysetup.c
> @@ -19,6 +19,8 @@ struct fscrypt_mode fscrypt_modes[] = {
> .cipher_str = "xts(aes)",
> .keysize = 64,
> .ivsize = 16,
> + .blk_crypto_mode = BLK_ENCRYPTION_MODE_AES_256_XTS,
> + .blk_crypto_dun_bytes_required = 8,
> },
> [FSCRYPT_MODE_AES_256_CTS] = {
> .friendly_name = "AES-256-CTS-CBC",
> @@ -31,6 +33,8 @@ struct fscrypt_mode fscrypt_modes[] = {
> .cipher_str = "essiv(cbc(aes),sha256)",
> .keysize = 16,
> .ivsize = 16,
> + .blk_crypto_mode = BLK_ENCRYPTION_MODE_AES_128_CBC_ESSIV,
> + .blk_crypto_dun_bytes_required = 8,
> },
> [FSCRYPT_MODE_AES_128_CTS] = {
> .friendly_name = "AES-128-CTS-CBC",
> @@ -43,6 +47,8 @@ struct fscrypt_mode fscrypt_modes[] = {
> .cipher_str = "adiantum(xchacha12,aes)",
> .keysize = 32,
> .ivsize = 32,
> + .blk_crypto_mode = BLK_ENCRYPTION_MODE_ADIANTUM,
> + .blk_crypto_dun_bytes_required = 24,
> },
> };
The DUN bytes required is actually determined by the IV generation method too.
Currently fscrypt has the following combinations:
AES-256-XTS: 8 bytes
AES-128-CBC-ESSIV: 8 bytes
Adiantum without DIRECT_KEY: 8 bytes
Adiantum with DIRECT_KEY: 24 bytes
I.e., DIRECT_KEY is only allowed with Adiantum, but not required for it.
So it's technically incorrect to always pass dun_bytes_required=24 for Adiantum.
And it's conceivable that in the future we could add an fscrypt setting that
uses AES-256-XTS with 16 IV bytes. Such a setting wouldn't be usable with UFS
inline encryption, yet the existing AES-256-XTS settings still would.
So, how about instead of putting .blk_crypto_dun_bytes_required in the
crypto_mode table, using logic like:
dun_bytes_required = 8;
if (flags & FSCRYPT_POLICY_FLAG_DIRECT_KEY)
dun_bytes_required += 16;
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 3cd4fe6b845e..2331ff0464b2 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -1370,6 +1370,7 @@ extern int send_sigurg(struct fown_struct *fown);
> #define SB_NODIRATIME 2048 /* Do not update directory access times */
> #define SB_SILENT 32768
> #define SB_POSIXACL (1<<16) /* VFS does not apply the umask */
> +#define SB_INLINE_CRYPT (1<<17) /* inodes in SB use blk-crypto */
> #define SB_KERNMOUNT (1<<22) /* this is a kern_mount call */
> #define SB_I_VERSION (1<<23) /* Update inode I_version field */
> #define SB_LAZYTIME (1<<25) /* Update the on-disk [acm]times lazily */
This flag probably should be called "SB_INLINECRYPT" to match the mount option,
which is "inlinecrypt" not "inline_crypt".
Also, the addition of this flag, along with the update to show_sb_opts() in
fs/proc_namespace.c which I think is needed, maybe should go in a separate patch
whose subject is prefixed with "fs: " to make it clearer to reviewers that this
part is a VFS-level change.
- Eric
next prev parent reply other threads:[~2020-02-22 5:39 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-21 11:50 [PATCH v7 0/9] Inline Encryption Support Satya Tangirala
2020-02-21 11:50 ` [PATCH v7 1/9] block: Keyslot Manager for Inline Encryption Satya Tangirala
2020-02-21 17:04 ` Christoph Hellwig
2020-02-21 17:31 ` Christoph Hellwig
2020-02-27 18:14 ` Eric Biggers
2020-02-27 21:25 ` Satya Tangirala
2020-03-05 16:11 ` Christoph Hellwig
2020-02-27 18:48 ` Eric Biggers
2020-02-21 11:50 ` [PATCH v7 2/9] block: Inline encryption support for blk-mq Satya Tangirala
2020-02-21 17:22 ` Christoph Hellwig
2020-02-22 0:52 ` Satya Tangirala
2020-02-24 23:34 ` Christoph Hellwig
2020-02-27 18:25 ` Eric Biggers
2020-02-21 11:50 ` [PATCH v7 3/9] block: blk-crypto-fallback for Inline Encryption Satya Tangirala
2020-02-21 16:51 ` Randy Dunlap
2020-02-21 17:25 ` Christoph Hellwig
2020-02-21 17:35 ` Christoph Hellwig
2020-02-21 18:34 ` Eric Biggers
2020-02-24 23:36 ` Christoph Hellwig
2020-02-27 19:25 ` Eric Biggers
2020-02-21 11:50 ` [PATCH v7 4/9] scsi: ufs: UFS driver v2.1 spec crypto additions Satya Tangirala
2020-02-21 11:50 ` [PATCH v7 5/9] scsi: ufs: UFS crypto API Satya Tangirala
2020-02-22 4:59 ` Eric Biggers
2020-02-21 11:50 ` [PATCH v7 6/9] scsi: ufs: Add inline encryption support to UFS Satya Tangirala
2020-02-21 17:22 ` Christoph Hellwig
2020-02-21 18:11 ` Eric Biggers
2020-02-23 13:47 ` Stanley Chu
2020-02-24 23:37 ` Christoph Hellwig
2020-02-25 7:21 ` Stanley Chu
2020-02-26 1:12 ` Eric Biggers
2020-02-26 6:43 ` Stanley Chu
2020-03-02 9:17 ` Stanley Chu
2020-02-21 11:50 ` [PATCH v7 7/9] fscrypt: add inline encryption support Satya Tangirala
2020-02-21 18:40 ` Eric Biggers
2020-02-22 5:39 ` Eric Biggers [this message]
2020-02-26 0:30 ` Eric Biggers
2020-02-21 11:50 ` [PATCH v7 8/9] f2fs: " Satya Tangirala
2020-02-21 11:50 ` [PATCH v7 9/9] ext4: " Satya Tangirala
2020-02-22 5:21 ` Eric Biggers
2020-02-21 17:16 ` [PATCH v7 0/9] Inline Encryption Support Eric Biggers
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=20200222053905.GC848@sol.localdomain \
--to=ebiggers@kernel.org \
--cc=bmuthuku@qti.qualcomm.com \
--cc=boojin.kim@samsung.com \
--cc=kuohong.wang@mediatek.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fscrypt@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=satyat@google.com \
/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).