ext4: handle casefolding with encryption
authorDaniel Rosenberg <drosen@google.com>
Fri, 19 Mar 2021 07:34:13 +0000 (07:34 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 6 Apr 2021 02:04:20 +0000 (22:04 -0400)
commit471fbbea7ff7061b2d6474665cb5a2ceb4fd6500
treecd425ef9c0fcf3a5ebcdb5b5a81b2111a063ead0
parent400086d7c11327cfe1b1aa4487adceb41e82b4df
ext4: handle casefolding with encryption

This adds support for encryption with casefolding.

Since the name on disk is case preserving, and also encrypted, we can no
longer just recompute the hash on the fly. Additionally, to avoid
leaking extra information from the hash of the unencrypted name, we use
siphash via an fscrypt v2 policy.

The hash is stored at the end of the directory entry for all entries
inside of an encrypted and casefolded directory apart from those that
deal with '.' and '..'. This way, the change is backwards compatible
with existing ext4 filesystems.

[ Changed to advertise this feature via the file:
  /sys/fs/ext4/features/encrypted_casefold -- TYT ]

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Link: https://lore.kernel.org/r/20210319073414.1381041-2-drosen@google.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Documentation/filesystems/ext4/directory.rst
fs/ext4/dir.c
fs/ext4/ext4.h
fs/ext4/hash.c
fs/ext4/inline.c
fs/ext4/namei.c
fs/ext4/super.c
fs/ext4/sysfs.c