summaryrefslogtreecommitdiff
path: root/Documentation/filesystems/ext4/directory.rst
diff options
context:
space:
mode:
authorDaniel Rosenberg <drosen@google.com>2019-10-07 18:12:23 -0700
committerSumit Semwal <sumit.semwal@linaro.org>2021-01-08 12:15:39 +0530
commit3345841e02917d9020ddc352f78e0d237521e804 (patch)
treedc8fcf9af276fbc10b4fec97811fc7d0a6ad0f6f /Documentation/filesystems/ext4/directory.rst
parentc3b6910c954ffbe1b5ede71ac4a61693e19454cf (diff)
ANDROID: 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. Signed-off-by: Daniel Rosenberg <drosen@google.com> Signed-off-by: Paul Lawrence <paullawrence@google.com> Test: Boots, /data/media is case insensitive Bug: 138322712 Bug: 161184936 Change-Id: I07354e3129aa07d309fbe36c002fee1af718f348 Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Diffstat (limited to 'Documentation/filesystems/ext4/directory.rst')
-rw-r--r--Documentation/filesystems/ext4/directory.rst27
1 files changed, 27 insertions, 0 deletions
diff --git a/Documentation/filesystems/ext4/directory.rst b/Documentation/filesystems/ext4/directory.rst
index 073940cc64ed..55f618b37144 100644
--- a/Documentation/filesystems/ext4/directory.rst
+++ b/Documentation/filesystems/ext4/directory.rst
@@ -121,6 +121,31 @@ The directory file type is one of the following values:
* - 0x7
- Symbolic link.
+To support directories that are both encrypted and casefolded directories, we
+must also include hash information in the directory entry. We append
+``ext4_extended_dir_entry_2`` to ``ext4_dir_entry_2`` except for the entries
+for dot and dotdot, which are kept the same. The structure follows immediately
+after ``name`` and is included in the size listed by ``rec_len`` If a directory
+entry uses this extension, it may be up to 271 bytes.
+
+.. list-table::
+ :widths: 8 8 24 40
+ :header-rows: 1
+
+ * - Offset
+ - Size
+ - Name
+ - Description
+ * - 0x0
+ - \_\_le32
+ - hash
+ - The hash of the directory name
+ * - 0x4
+ - \_\_le32
+ - minor\_hash
+ - The minor hash of the directory name
+
+
In order to add checksums to these classic directory blocks, a phony
``struct ext4_dir_entry`` is placed at the end of each leaf block to
hold the checksum. The directory entry is 12 bytes long. The inode
@@ -322,6 +347,8 @@ The directory hash is one of the following values:
- Half MD4, unsigned.
* - 0x5
- Tea, unsigned.
+ * - 0x6
+ - Siphash.
Interior nodes of an htree are recorded as ``struct dx_node``, which is
also the full length of a data block: