Re: [f2fs-dev] [RFC PATCH 01/25] fs, fscrypt: move uapi definitions to new header

2017-10-27 Thread Michael Halcrow via Linux-f2fs-devel
On Mon, Oct 23, 2017 at 02:40:34PM -0700, Eric Biggers wrote: > From: Eric Biggers > > There are going to be more filesystem encryption definitions added, and > we don't want to use a disproportionate amount of space in > for filesystem encryption stuff. So move the fscrypt definitions to a > n

Re: [f2fs-dev] [RFC PATCH 02/25] fscrypt: use FSCRYPT_ prefix for uapi constants

2017-10-27 Thread Michael Halcrow via Linux-f2fs-devel
On Mon, Oct 23, 2017 at 02:40:35PM -0700, Eric Biggers wrote: > From: Eric Biggers > > Prefix all filesystem encryption UAPI constants except the ioctl numbers > with "FSCRYPT_" rather than with "FS_". This namespaces the constants > more appropriately and makes it clear that they are related sp

Re: [f2fs-dev] [RFC PATCH 03/25] fscrypt: use FSCRYPT_* definitions, not FS_*

2017-10-27 Thread Michael Halcrow via Linux-f2fs-devel
On Mon, Oct 23, 2017 at 02:40:36PM -0700, Eric Biggers wrote: > From: Eric Biggers > > Update the filesystem encryption kernel code to use the new names for > the UAPI constants rather than the old names. > > Signed-off-by: Eric Biggers Reviewed-by: Michael Halcrow > --- > fs/crypto/fname.c

Re: [f2fs-dev] [RFC PATCH 04/25] fscrypt: refactor finding and deriving key

2017-10-27 Thread Michael Halcrow via Linux-f2fs-devel
On Mon, Oct 23, 2017 at 02:40:37PM -0700, Eric Biggers wrote: > From: Eric Biggers > > In preparation for introducing a new way to find the master keys and > derive the per-file keys, clean up the current method. This includes: > > - Introduce a helper function find_and_derive_key() so that we

Re: [f2fs-dev] [RFC PATCH 05/25] fs: add ->s_master_keys to struct super_block

2017-10-27 Thread Michael Halcrow via Linux-f2fs-devel
On Mon, Oct 23, 2017 at 02:40:38PM -0700, Eric Biggers wrote: > From: Eric Biggers > > Add an ->s_master_keys keyring to 'struct super_block' for holding > encryption keys which have been added to the filesystem. This keyring > will be populated using a new fscrypt ioctl. > > This is needed for

Re: [f2fs-dev] [RFC PATCH 06/25] fscrypt: add FS_IOC_ADD_ENCRYPTION_KEY ioctl

2017-10-27 Thread Michael Halcrow via Linux-f2fs-devel
On Mon, Oct 23, 2017 at 02:40:39PM -0700, Eric Biggers wrote: > By having an API to add a key to the *filesystem* we'll be able to > eliminate all the above hacks and better express the intended semantics: > the "locked/unlocked" status of an encrypted directory is global. And > orthogonally to en

Re: [f2fs-dev] [RFC PATCH 07/25] fs/inode.c: export inode_lru_list_del()

2017-10-27 Thread Michael Halcrow via Linux-f2fs-devel
On Mon, Oct 23, 2017 at 02:40:40PM -0700, Eric Biggers wrote: > From: Eric Biggers > > When a filesystem encryption key is removed, we need all files which had > been "unlocked" (had ->i_crypt_info set up) with it to appear "locked" > again. This is most easily done by evicting the inodes. This

Re: [f2fs-dev] [PATCH 2/2] f2fs: refactor read path to allow multiple postprocessing steps

2018-04-16 Thread Michael Halcrow via Linux-f2fs-devel
Given recent talk I've seen on potentially applying file-based protections in NFS, I think it's worth making some cautionary observations at this stage. Moxie's Cryptographic Doom Principle is an approachable take on the argument that one should verify before performing any other cryptographic ope

Re: [f2fs-dev] [PATCH 1/6] fscrypt: add v2 encryption context and policy

2017-07-13 Thread Michael Halcrow via Linux-f2fs-devel
On Wed, Jul 12, 2017 at 02:00:30PM -0700, Eric Biggers wrote: > From: Eric Biggers > > Currently, the fscrypt_context (i.e. the encryption xattr) does not > contain a cryptographically secure identifier for the master key's > payload. Therefore it's not possible to verify that the correct key wa

Re: [f2fs-dev] [PATCH 2/6] fscrypt: rename ->ci_master_key to ->ci_master_key_descriptor

2017-07-14 Thread Michael Halcrow via Linux-f2fs-devel
On Wed, Jul 12, 2017 at 02:00:31PM -0700, Eric Biggers wrote: > From: Eric Biggers > > In struct fscrypt_info, ->ci_master_key is the master key descriptor, > not the master key itself. In preparation for introducing a struct > fscrypt_master_key and making ->ci_master_key point to it, rename th

Re: [f2fs-dev] [PATCH 3/6] fscrypt: use HKDF-SHA512 to derive the per-inode encryption keys

2017-07-14 Thread Michael Halcrow via Linux-f2fs-devel
On Wed, Jul 12, 2017 at 02:00:32PM -0700, Eric Biggers wrote: > From: Eric Biggers > > By design, the keys which userspace provides in the keyring are not used > to encrypt data directly. Instead, a KDF (Key Derivation Function) is > used to derive a unique encryption key for each inode, given a

Re: [f2fs-dev] [PATCH 4/6] fscrypt: verify that the correct master key was supplied

2017-07-14 Thread Michael Halcrow via Linux-f2fs-devel
On Wed, Jul 12, 2017 at 02:00:33PM -0700, Eric Biggers wrote: > From: Eric Biggers > > Currently, while a fscrypt master key is required to have a certain > description in the keyring, its payload is never verified to be correct. > While sufficient for well-behaved userspace, this is insecure in

Re: [f2fs-dev] [PATCH 3/6] fscrypt: use HKDF-SHA512 to derive the per-inode encryption keys

2017-07-14 Thread Michael Halcrow via Linux-f2fs-devel
On Fri, Jul 14, 2017 at 09:24:40AM -0700, Michael Halcrow wrote: > On Wed, Jul 12, 2017 at 02:00:32PM -0700, Eric Biggers wrote: > > From: Eric Biggers > > > > By design, the keys which userspace provides in the keyring are not used > > to encrypt data directly. Instead, a KDF (Key Derivation Fu

Re: [f2fs-dev] [PATCH 5/6] fscrypt: cache the HMAC transform for each master key

2017-07-17 Thread Michael Halcrow via Linux-f2fs-devel
On Wed, Jul 12, 2017 at 02:00:34PM -0700, Eric Biggers wrote: > From: Eric Biggers > > Now that we have a key_hash field which securely identifies a master key > payload, introduce a cache of the HMAC transforms for the master keys > currently in use for inodes using v2+ encryption policies. The

Re: [f2fs-dev] [PATCH 6/6] fscrypt: for v2 policies, support "fscrypt:" key prefix only

2017-07-17 Thread Michael Halcrow via Linux-f2fs-devel
On Wed, Jul 12, 2017 at 02:00:35PM -0700, Eric Biggers wrote: > From: Eric Biggers > > Since v2 encryption policies are opt-in, take the opportunity to also > drop support for the legacy filesystem-specific key description prefixes > "ext4:", "f2fs:", and "ubifs:", instead requiring the generic p

Re: [f2fs-dev] [PATCH v2] fscrypt: add a documentation file for filesystem-level encryption

2017-09-01 Thread Michael Halcrow via Linux-f2fs-devel
On Thu, Aug 31, 2017 at 05:02:17PM -0700, Eric Biggers wrote: > From: Eric Biggers > > Perhaps long overdue, add a documentation file for filesystem-level > encryption, a.k.a. fscrypt or fs/crypto/, to the Documentation > directory. The new file is based loosely on the latest version of the > "E

[f2fs-dev] [PATCH 1/3] ext4 crypto: Return -EXDEV for link, rename, and cross-rename between incompat contexts

2017-09-07 Thread Michael Halcrow via Linux-f2fs-devel
Gives user space the opportunity to fall back to copy-and-delete. Signed-off-by: Michael Halcrow --- fs/ext4/namei.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index c1cf020d1889..3c493bc4273d 100644 --- a/fs/ext4/namei.c +++ b/fs/

[f2fs-dev] [PATCH 2/3] F2FS crypto: Return -EXDEV for link, rename, and cross-rename between incompat contexts

2017-09-07 Thread Michael Halcrow via Linux-f2fs-devel
Gives user space the opportunity to fall back to copy-and-delete. Signed-off-by: Michael Halcrow --- fs/f2fs/namei.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 760d85223c81..689c671cf8b8 100644 --- a/fs/f2fs/namei.c +++ b/fs/

[f2fs-dev] [PATCH 0/3] fscrypto: Return -EXDEV for link, rename, and cross-rename between incompat contexts

2017-09-07 Thread Michael Halcrow via Linux-f2fs-devel
Currently file systems support fscrypto will return -EPERM when the user attempts to link, rename, or cross-rename between two directories that have incompatible encryption policy contexts. User space tools will fail the operation when receiving this errno. With -EXDEV, user space tools will typi

[f2fs-dev] [PATCH 3/3] UBIFS crypto: Return -EXDEV for link, rename, and cross-rename between incompat contexts

2017-09-07 Thread Michael Halcrow via Linux-f2fs-devel
Gives user space the opportunity to fall back to copy-and-delete. Signed-off-by: Michael Halcrow --- fs/ubifs/dir.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 417fe0b29f23..6c5753a2f79f 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubif